00001 /* 00002 * Copyright (c) 2001-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 _OutControl_ 00023 #define _OutControl_ 00024 00025 #include "InControl.hxx" 00026 #include <list> 00027 #include <string> 00028 #include "Assert.hxx" 00029 00030 namespace CLAM 00031 { 00032 00033 class Processing; 00034 00035 //free method to link two Processing 00036 // void LinkOutWithInControl(Processing* outProc, std::string outControl, 00037 // Processing* inProc, std::string inControl); 00038 00045 class OutControl 00046 { 00047 //Attributes 00048 private: 00049 std::list<InControl*> mLinks; 00050 std::string mName; 00051 Processing * mParent; 00052 //Constructor/Destructor 00053 public: 00054 virtual ~OutControl(); 00069 OutControl(const std::string& name, Processing* parent=0, const bool publish=true ); 00070 00071 00072 //Methods 00073 public: 00074 virtual void AddLink(InControl& in); //TODO think if should be renamed to Connect 00075 void RemoveLink(InControl& in); 00076 00077 std::list<InControl*>::iterator BeginInControlsConnected(); 00078 std::list<InControl*>::iterator EndInControlsConnected(); 00079 00080 int SendControl(TControlData val); 00081 00087 int SendControlAsBoolean( bool booleanValue ) 00088 { 00089 return SendControl( booleanValue ? TControlData(1) : TControlData(0) ); 00090 } 00091 00097 int SendControlAsInteger( int intvalue ) 00098 { 00099 return SendControl( (TControlData)intvalue ); 00100 } 00101 00102 const std::string& GetName(void) const { return mName; } 00103 bool IsConnected(); 00104 bool IsConnectedTo( InControl & ); 00105 Processing * GetProcessing() const { return mParent;} 00106 }; 00107 00108 00109 00110 }; // namespace CLAM 00111 00112 #endif //_OutControl_ 00113