Changeset 16 in flair-src for trunk/demos/Sinus/src/Sinus.h
- Timestamp:
- 04/08/16 15:48:40 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/demos/Sinus/src/Sinus.h
r14 r16 15 15 #define SINUS_H 16 16 17 // necessary includes, as IODevice and Thread are bases of our class17 // necessary includes, as IODevice and Thread are bases of our class 18 18 #include <IODevice.h> 19 19 #include <Thread.h> 20 20 21 // forward declaration for other classes21 // forward declaration for other classes 22 22 namespace flair { 23 24 25 26 27 28 29 30 31 32 33 34 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 35 } 36 36 37 // sinus is a class generating a sinus signal38 // in this example, it emulates a sensonr, so we extend the namespace sensor39 // it derives frome37 // 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 40 // IODevice: as it has an ouput 41 41 // Thread: is it a thread 42 namespace 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); 42 namespace flair { 43 namespace sensor { 44 class Sinus : public core::IODevice, public core::Thread { 45 public: 46 /*! 47 * \brief Constructor 48 * 49 * Builds a sinus generator 50 * 51 * \param parent the FrameworkManager to use 52 * \param name object name 53 * \param priority Thread priority, 50 by default (1:mini, 99:maxi) 54 */ 55 Sinus(const core::FrameworkManager *parent, std::string name, 56 int priority = 50); 55 57 56 57 58 59 58 /*! 59 * \brief Destructor 60 */ 61 ~Sinus(); 60 62 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; 63 /*! 64 * \brief Output matrix 65 * 66 * allows to access output matrix, to get signal value or to put it in a graph. 67 *\n 68 * 69 * \return un pointeur vers la matrice de sortie 70 */ 71 core::cvmatrix *GetMatrix(void) const; 69 72 70 71 72 73 74 75 76 77 73 /*! 74 * \brief Value 75 * 76 * this method is equivalent to GetMatrix()->Value(0,0) 77 * 78 * \return actual signal value 79 */ 80 float GetValue(void) const; 78 81 79 80 81 82 83 84 85 82 /*! 83 * \brief Use defautl plot 84 * 85 * this method put a graph in a specific tab 86 * 87 */ 88 void UseDefaultPlot(void); 86 89 87 88 89 90 91 92 93 94 90 /*! 91 * \brief SetupLayout 92 * 93 * this method allows to add other widgets in the sinus tab. 94 * 95 * \return the GridLayout 96 */ 97 gui::GridLayout *GetSetupLayout(void) const; 95 98 96 97 98 99 100 101 102 103 99 /*! 100 * \brief Plot 101 * 102 * this method allows to add other curves in the graph 103 * 104 * \return the DataPlot1D 105 */ 106 gui::DataPlot1D *GetPlot(void) const; 104 107 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); 108 private: 109 // UpdateFrom method from base class IODevice 110 // sinus is like a sensor, so it does not have input; we define an empty 111 // method 112 void UpdateFrom(const core::io_data *data){}; 113 void Run(void); 110 114 111 112 gui::Tab*mainTab;113 gui::TabWidget*tabWidget;114 gui::DataPlot1D*plot;115 gui::DoubleSpinBox *frequency,*amplitude,*offset;116 117 gui::GridLayout*setupLayout;118 119 } // end namespace sensor120 } // end namespace flair115 core::cvmatrix *output; 116 gui::Tab *mainTab; 117 gui::TabWidget *tabWidget; 118 gui::DataPlot1D *plot; 119 gui::DoubleSpinBox *frequency, *amplitude, *offset; 120 gui::SpinBox *period; 121 gui::GridLayout *setupLayout; 122 }; 123 } // end namespace sensor 124 } // end namespace flair 121 125 #endif // SINUS_H
Note:
See TracChangeset
for help on using the changeset viewer.