00001 #ifndef InControlBase_hxx 00002 #define InControlBase_hxx 00003 00004 #include <string> 00005 #include <list> 00006 #include <typeinfo> 00007 00008 namespace CLAM { 00009 class Processing; 00010 class OutControlBase; 00011 00013 typedef float TControlData; 00014 00022 class InControlBase 00023 { 00024 std::string mName; 00025 protected: 00026 Processing * mProcessing; 00027 typedef std::list<OutControlBase*> Peers; 00029 Peers mLinks; 00030 TControlData mDefaultValue; 00031 TControlData mUpperBound; 00032 TControlData mLowerBound; 00033 bool mBounded; 00034 bool mHasDefaultValue; 00035 mutable bool _hasBeenRead; 00036 private: 00038 InControlBase(const InControlBase & toBeCopied ) {} 00039 public: 00040 bool HasBeenRead() const { return _hasBeenRead; } 00046 InControlBase(const std::string &name, Processing * processing = 0); 00052 virtual ~InControlBase(); 00062 virtual const std::type_info& GetTypeId() const = 0; 00064 const std::string& GetName() const { return mName; } 00066 Processing * GetProcessing() const { return mProcessing; } 00068 bool IsConnected() const { return not mLinks.empty(); } 00070 bool IsConnectedTo(OutControlBase & out); 00071 00075 //{@ 00076 bool IsBounded() const; 00077 TControlData UpperBound() const; 00078 TControlData LowerBound() const; 00080 TControlData DefaultValue() const; 00081 void SetDefaultValue(TControlData val); 00082 void SetBounds(TControlData lower, TControlData upper); 00084 00086 void OutControlInterface_AddLink(OutControlBase & outControl) 00087 { 00088 mLinks.push_back(&outControl); 00089 } 00091 void OutControlInterface_RemoveLink(OutControlBase & outControl) 00092 { 00093 mLinks.remove(&outControl); 00094 } 00095 virtual const std::string GetLastValueAsString () 00096 { 00097 return "Non printable type"; 00098 } 00099 }; 00100 } // End namespace CLAM 00101 #endif // InControlBase_hxx