ControlPrinterTyped.hxx

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2004 MUSIC TECHNOLOGY GROUP (MTG)
00003  *                         UNIVERSITAT POMPEU FABRA
00004  *
00005  *
00006  * This program is free software; you can redistribute it and/or modify
00007  * it under the terms of the GNU General Public License as published by
00008  * the Free Software Foundation; either version 2 of the License, or
00009  * (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software
00018  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019  *
00020  */
00021 
00022 #ifndef _ControlPrinterTyped_
00023 #define _ControlPrinterTyped_
00024 
00025 
00026 #include <CLAM/Enum.hxx>
00027 
00028 #include "DataTypes.hxx"
00029 #include "Processing.hxx"
00030 #include "ProcessingConfig.hxx"
00031 #include "ControlArray.hxx"
00032 #include "InControl.hxx"
00033 
00034 namespace CLAM
00035 {
00036 
00037 class EnumTypedTypes: public CLAM::Enum {
00038 public:
00039         EnumTypedTypes() : CLAM::Enum(ValueTable(), eFloat) {}
00040         EnumTypedTypes(tValue v) : CLAM::Enum(ValueTable(), v) {};
00041         EnumTypedTypes(const std::string & s) : CLAM::Enum(ValueTable(), s) {};
00042 
00043         virtual CLAM::Component * Species() const {return new EnumTypedTypes();}
00044 
00045         typedef enum {
00046                 eString=0,
00047                 eFloat=1,
00048                 eDouble=2,
00049                 eInt=3,
00050                 eMidi=4,
00051         } tEnum;
00052         static tEnumValue * ValueTable()
00053         {
00054                 static tEnumValue sValueTable[] =
00055                 {
00056                         {eString,"s"},
00057                         {eFloat,"f"},
00058                         {eDouble,"d"},
00059                         {eInt,"i"},
00060                         {eMidi,"M"},
00061                         {0,NULL}
00062                 };
00063                 return sValueTable;
00064         }
00065 };
00066 
00067 
00068 class ControlPrinterTypedConfig : public ProcessingConfig
00069 {
00070         public:
00071                 DYNAMIC_TYPE_USING_INTERFACE (ControlPrinterTypedConfig, 3, ProcessingConfig);
00072                 DYN_ATTRIBUTE (0, public, std::string, Identifier);
00073                 DYN_ATTRIBUTE (1, public, std::string, TypesMask);
00074                 DYN_ATTRIBUTE (2, public, bool, GuiOnly );
00075 
00076 
00077         private:
00078                 void DefaultInit();
00079 };
00080 
00081 class ControlPrinterTyped : public Processing
00082 {
00083         typedef std::vector<InControlBase*> InControls;
00084         ControlPrinterTypedConfig _config;
00085         InControls mInControls;
00086 
00087         public:
00088                 const char *GetClassName() const { return "ControlPrinterTyped"; }
00089                 ControlPrinterTyped();
00090                 ControlPrinterTyped( const ControlPrinterTypedConfig& cfg ); 
00091                 ~ControlPrinterTyped();
00092                 bool ConcreteConfigure( const ProcessingConfig& cfg ); 
00093                 const ProcessingConfig& GetConfig() const { return _config; }
00094                 bool Do();
00095         protected:
00096                 void RemoveOldControls();
00097         private:
00098                 void ResizeControls(unsigned nInputs, const std::string & baseName);
00099                 void ResizeControls(unsigned nInputs, const std::list<std::string> & names);
00100                 
00101                 const unsigned int GetInputsNumber() const;
00102 
00103                 InControlBase * createControl(const std::string & type, const std::string & name);
00104                 void ClearControls();
00105 };
00106 
00107 }
00108 
00109 #endif
00110 
Generated by  doxygen 1.6.3