Control2Data.hxx
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef _Control2Data_
00023 #define _Control2Data_
00024
00025 #include "Processing.hxx"
00026 #include "ProcessingData.hxx"
00027 #include "InControlArray.hxx"
00028
00029 #include <vector>
00030 #include <queue>
00031
00032 #include "Mutex.hxx"
00033
00034 namespace CLAM {
00035
00037
00042 class Control2DataConfig : public ProcessingConfig
00043 {
00044 public:
00045 DYNAMIC_TYPE_USING_INTERFACE (Control2DataConfig, 3, ProcessingConfig);
00046 DYN_ATTRIBUTE (0, public, unsigned, NumControls);
00047 DYN_CONTAINER_ATTRIBUTE (1, public, std::vector<TControlData>, MinValues, foo);
00048 DYN_CONTAINER_ATTRIBUTE (2, public, std::vector<TControlData>, MaxValues, foo);
00049 protected:
00051 void DefaultInit(void);
00052
00053 };
00055
00065 class Control2Data : public Processing
00066 {
00067 public:
00068 typedef Control2DataConfig Config;
00069 Control2Data(const Config& c=Config());
00070 virtual ~Control2Data (){};
00075 bool Do();
00077 const ProcessingConfig& GetConfig() const;
00078 protected:
00079
00080
00081
00083 typedef std::queue<TControlData> TQueue;
00085 typedef std::list<int> IdxList;
00086
00087
00088
00093 virtual bool GenerateOutputData(int id, TControlData val)=0;
00094
00098 void BufferQueueInit( int ncontrols );
00103 void EnqueueControl(unsigned id, TControlData data);
00105 TControlData PopControl(unsigned id);
00107 bool Empty(unsigned id);
00109 IdxList GetQueues();
00110
00116 void ControlCallbackId(int id, TControlData val );
00117
00119 virtual bool ConcreteConfigure(const ProcessingConfig&);
00121 const char *GetClassName() const {return "Control2Data";}
00122
00123 protected:
00124
00125
00129 InControlArray mInArray;
00130
00134 FloatInControl mStop;
00135
00137 Config mConfig;
00138
00140 std::vector<TQueue> mDataQueues;
00141
00143 Mutex mDataMutex;
00145 Mutex mControl2DataDoMutex;
00146 };
00148 };
00149
00150 #endif // _Control2Data_
00151