CLAM-Development  1.4.0
ControlPrinterTyped.hxx
Go to the documentation of this file.
1 /*
2  * Copyright (c) 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 _ControlPrinterTyped_
23 #define _ControlPrinterTyped_
24 
25 
26 #include <CLAM/Enum.hxx>
27 
28 #include "DataTypes.hxx"
29 #include "Processing.hxx"
30 #include "ProcessingConfig.hxx"
31 #include "ControlArray.hxx"
32 #include "InControl.hxx"
33 
34 namespace CLAM
35 {
36 
37 class EnumTypedTypes: public CLAM::Enum {
38 public:
40  EnumTypedTypes(tValue v) : CLAM::Enum(ValueTable(), v) {};
41  EnumTypedTypes(const std::string & s) : CLAM::Enum(ValueTable(), s) {};
42 
43  virtual CLAM::Component * Species() const {return new EnumTypedTypes();}
44 
45  typedef enum {
47  eFloat=1,
49  eInt=3,
50  eMidi=4,
51  } tEnum;
53  {
54  static tEnumValue sValueTable[] =
55  {
56  {eString,"s"},
57  {eFloat,"f"},
58  {eDouble,"d"},
59  {eInt,"i"},
60  {eMidi,"M"},
61  {0,NULL}
62  };
63  return sValueTable;
64  }
65 };
66 
67 
69 {
70  public:
72  DYN_ATTRIBUTE (0, public, std::string, Identifier);
73  DYN_ATTRIBUTE (1, public, std::string, TypesMask);
74  DYN_ATTRIBUTE (2, public, bool, GuiOnly );
75 
76 
77  private:
78  void DefaultInit();
79 };
80 
82 {
83  typedef std::vector<InControlBase*> InControls;
85  InControls mInControls;
86 
87  public:
88  const char *GetClassName() const { return "ControlPrinterTyped"; }
92  bool ConcreteConfigure( const ProcessingConfig& cfg );
93  const ProcessingConfig& GetConfig() const { return _config; }
94  bool Do();
95  protected:
96  void RemoveOldControls();
97  private:
98  void ResizeControls(unsigned nInputs, const std::string & baseName);
99  void ResizeControls(unsigned nInputs, const std::list<std::string> & names);
100 
101  const unsigned int GetInputsNumber() const;
102 
103  InControlBase * createControl(const std::string & type, const std::string & name);
104  void ClearControls();
105 };
106 
107 }
108 
109 #endif
110