00001 #ifndef _INCONTROL_PUBLISHER_HXX_ 00002 #define _INCONTROL_PUBLISHER_HXX_ 00003 00004 #include "InControl.hxx" 00005 #include "InControl.hxx" 00006 #include <string> 00007 00008 // TODO: Refactoring... 00009 // Extract common interface from InControlPublisher, InControl and create a common base class 00010 namespace CLAM 00011 { 00012 class InControlPublisher : public InControl 00013 { 00014 InControl* mPublished; //TODO should be a list, in the future 00015 00016 public: 00017 InControlPublisher() 00018 : InControl( "InControlPublisher", 0 ) 00019 { 00020 mPublished=NULL; 00021 } 00022 00023 InControlPublisher( const std::string& name, Processing* father ) 00024 : InControl( name, father ) 00025 { 00026 mPublished=NULL; 00027 } 00028 00029 void PublishInControl( InControl& in ) 00030 { 00031 mPublished = ∈ 00032 } 00033 int DoControl(TControlData val) 00034 { 00035 if(mPublished) 00036 return mPublished->DoControl(val); 00037 else 00038 return InControl::DoControl(val); 00039 } 00040 const TControlData& GetLastValue() const 00041 { 00042 if(mPublished) 00043 return mPublished->GetLastValue(); 00044 else 00045 return mLastValue; 00046 } 00047 00048 }; 00049 00050 } // namespace CLAM 00051 00052 #endif 00053