source: flair-src/trunk/demos/Sinus/src/Sinus.h@ 14

Last change on this file since 14 was 14, checked in by Sanahuja Guillaume, 8 years ago

sinus

File size: 3.3 KB
Line 
1// created: 2013/06/26
2// filename: Sinus.h
3//
4// author: Guillaume Sanahuja
5// Copyright Heudiasyc UMR UTC/CNRS 7253
6//
7// version: $Id: $
8//
9// purpose: class generating a sinus signal
10//
11//
12/*********************************************************************/
13
14#ifndef SINUS_H
15#define SINUS_H
16
17//necessary includes, as IODevice and Thread are bases of our class
18#include <IODevice.h>
19#include <Thread.h>
20
21//forward declaration for other classes
22namespace flair {
23 namespace core {
24 class FrameworkManager;
25 class cvmatrix;
26 }
27 namespace gui {
28 class Tab;
29 class TabWidget;
30 class GridLayout;
31 class DoubleSpinBox;
32 class SpinBox;
33 class DataPlot1D;
34 }
35}
36
37//sinus is a class generating a sinus signal
38//in this example, it emulates a sensonr, so we extend the namespace sensor
39//it derives frome
40// IODevice: as it has an ouput
41// Thread: is it a thread
42namespace flair { namespace sensor {
43 class Sinus : public core::IODevice, public core::Thread {
44 public:
45 /*!
46 * \brief Constructor
47 *
48 * Builds a sinus generator
49 *
50 * \param parent the FrameworkManager to use
51 * \param name object name
52 * \param priority Thread priority, 50 by default (1:mini, 99:maxi)
53 */
54 Sinus(const core::FrameworkManager* parent,std::string name,int priority=50);
55
56 /*!
57 * \brief Destructor
58 */
59 ~Sinus();
60
61 /*!
62 * \brief Output matrix
63 *
64 * allows to access output matrix, to get signal value or to put it in a graph. \n
65 *
66 * \return un pointeur vers la matrice de sortie
67 */
68 core::cvmatrix *GetMatrix(void) const;
69
70 /*!
71 * \brief Value
72 *
73 * this method is equivalent to GetMatrix()->Value(0,0)
74 *
75 * \return actual signal value
76 */
77 float GetValue(void) const;
78
79 /*!
80 * \brief Use defautl plot
81 *
82 * this method put a graph in a specific tab
83 *
84 */
85 void UseDefaultPlot(void);
86
87 /*!
88 * \brief SetupLayout
89 *
90 * this method allows to add other widgets in the sinus tab.
91 *
92 * \return the GridLayout
93 */
94 gui::GridLayout *GetSetupLayout(void) const;
95
96 /*!
97 * \brief Plot
98 *
99 * this method allows to add other curves in the graph
100 *
101 * \return the DataPlot1D
102 */
103 gui::DataPlot1D *GetPlot(void) const;
104
105 private:
106 //UpdateFrom method from base class IODevice
107 //sinus is like a sensor, so it does not have input; we define an empty method
108 void UpdateFrom(const core::io_data *data){};
109 void Run(void);
110
111 core::cvmatrix *output;
112 gui::Tab* mainTab;
113 gui::TabWidget* tabWidget;
114 gui::DataPlot1D* plot;
115 gui::DoubleSpinBox *frequency,*amplitude,*offset;
116 gui::SpinBox *period;
117 gui::GridLayout* setupLayout;
118 };
119}// end namespace sensor
120}// end namespace flair
121#endif // SINUS_H
Note: See TracBrowser for help on using the repository browser.