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

Last change on this file since 26 was 16, checked in by Bayard Gildas, 9 years ago

Reformatting

File size: 2.6 KB
RevLine 
[14]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
[16]17// necessary includes, as IODevice and Thread are bases of our class
[14]18#include <IODevice.h>
19#include <Thread.h>
20
[16]21// forward declaration for other classes
[14]22namespace flair {
[16]23namespace core {
24class FrameworkManager;
25class cvmatrix;
[14]26}
[16]27namespace gui {
28class Tab;
29class TabWidget;
30class GridLayout;
31class DoubleSpinBox;
32class SpinBox;
33class DataPlot1D;
34}
35}
[14]36
[16]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
[14]40// IODevice: as it has an ouput
41// Thread: is it a thread
[16]42namespace flair {
43namespace sensor {
44class Sinus : public core::IODevice, public core::Thread {
45public:
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);
[14]57
[16]58 /*!
59 * \brief Destructor
60 */
61 ~Sinus();
[14]62
[16]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;
[14]72
[16]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;
[14]81
[16]82 /*!
83 * \brief Use defautl plot
84 *
85 * this method put a graph in a specific tab
86 *
87 */
88 void UseDefaultPlot(void);
[14]89
[16]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;
[14]98
[16]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;
[14]107
[16]108private:
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);
[14]114
[16]115 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
[14]125#endif // SINUS_H
Note: See TracBrowser for help on using the repository browser.