CLAM-Development  1.4.0
Control2Data.hxx
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2001-2004 MUSIC TECHNOLOGY GROUP (MTG)
3  * UNIVERSITAT POMPEU FABRA
4  *
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19  *
20  */
21 
22 #ifndef _Control2Data_
23 #define _Control2Data_
24 
25 #include "Processing.hxx"
26 #include "ProcessingData.hxx"
27 #include "InControlArray.hxx"
28 
29 #include <vector>
30 #include <queue>
31 
32 #include "Mutex.hxx"
33 
34 namespace CLAM {
35 
37 
43 {
44 public:
46  DYN_ATTRIBUTE (0, public, unsigned, NumControls);
47  DYN_CONTAINER_ATTRIBUTE (1, public, std::vector<TControlData>, MinValues, foo);
48  DYN_CONTAINER_ATTRIBUTE (2, public, std::vector<TControlData>, MaxValues, foo);
49 protected:
51  void DefaultInit(void);
52 
53 };
55 
65 class Control2Data : public Processing
66 {
67 public:
69  Control2Data(const Config& c=Config());
70  virtual ~Control2Data (){};
75  bool Do();
77  const ProcessingConfig& GetConfig() const;
78 protected:
79 
80  //typedefs
81 
83  typedef std::queue<TControlData> TQueue;
85  typedef std::list<int> IdxList;
86 
87  //protected methods
88 
93  virtual bool GenerateOutputData(int id, TControlData val)=0;
94 
98  void BufferQueueInit( int ncontrols );
103  void EnqueueControl(unsigned id, TControlData data);
105  TControlData PopControl(unsigned id);
107  bool Empty(unsigned id);
109  IdxList GetQueues();
110 
116  void ControlCallbackId(int id, TControlData val );
117 
119  virtual bool ConcreteConfigure(const ProcessingConfig&);
121  const char *GetClassName() const {return "Control2Data";}
122 
123 protected:
124 //protected member attributes
125 
130 
135 
138 
140  std::vector<TQueue> mDataQueues;
141 
146 };
148 }; // namespace CLAM
149 
150 #endif // _Control2Data_
151