00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef __freControllerCollector_h
00023 #define __freControllerCollector_h
00024
00025 #include "freElementals.h"
00026 #include "freEvents.h"
00027 #include "freSetup.h"
00028 #include "freControllerEvents.h"
00029 #include "freControllerBase.h"
00030
00031 #include "itkMutexLock.h"
00032 #include "itkDynamicLoader.h"
00033
00034 namespace FREE
00035 {
00036
00037 class ControllerCollectorInfo : public itk::Object
00038 {
00039 public:
00040 typedef ControllerCollectorInfo Self;
00041 typedef itk::LightObject Superclass;
00042 typedef itk::SmartPointer<Self> Pointer;
00043 typedef itk::SmartPointer<const Self> ConstPointer;
00044
00045 itkNewMacro(Self);
00046 itkTypeMacro(ControllerCollectorInfo,itk::LightObject;);
00047
00048 enum ControllerStatus
00049 {
00050 CSActive = 0,
00051 CSIgnored = 1,
00052 CSOutdated = 2
00053 };
00054
00055 itkSetMacro(ControllerID,std::string);
00056 itkGetConstReferenceMacro(ControllerID,std::string);
00057
00058 itkSetMacro(LibraryFile,std::string);
00059 itkGetConstReferenceMacro(LibraryFile,std::string);
00060
00061 itkSetMacro(ControllerStatus,ControllerStatus);
00062 itkGetConstReferenceMacro(ControllerStatus,ControllerStatus);
00063
00064 protected:
00065 ControllerCollectorInfo();
00066
00067 std::string m_ControllerID;
00068 std::string m_LibraryFile;
00069 ControllerStatus m_ControllerStatus;
00070
00071 private:
00072 ControllerCollectorInfo(const ControllerCollectorInfo& destionation);
00073 ControllerCollectorInfo& operator =(const ControllerCollectorInfo& destionation);
00074 };
00075
00089 class ControllerCollector : public itk::Object
00090 {
00091 public:
00092 typedef ControllerCollector Self;
00093 typedef itk::Object Superclass;
00094 typedef itk::SmartPointer<Self> Pointer;
00095 typedef itk::SmartPointer<const Self> ConstPointer;
00096
00097 itkNewMacro(Self);
00098 itkTypeMacro(ControllerCollectorInfo,itk::Object;);
00099
00100 enum ControllerStatus
00101 {
00102 CSActive = 0,
00103 CSIgnored = 1,
00104 CSOutdated = 2
00105 };
00106
00107 typedef std::multimap<std::string, ControllerCollectorInfo::Pointer> ControllerListType;
00108
00110 typedef ControllerCollector Self;
00111
00113 void Initialize();
00114
00115 ControllerListType& GetControllerList() {return m_Controllers;} ;
00116 const ControllerListType& GetControllerList() const {return m_Controllers;};
00117
00121 void SetOnControlEvent(ProgressEventBase* pOnControl);
00122
00123 protected:
00124 ControllerCollector();
00125
00126 private:
00127
00136 bool TriggerControlEvent(const int iStatusID, const std::string& sComment, void* pSender = 0, long threadID = 0);
00137
00139 void LoadDynamicControllers();
00140
00142 void LoadLibrariesInPath( const char*);
00143
00145 ControllerListType m_Controllers;
00146
00149 ProgressEventBase::Pointer m_fnOnControl;
00150
00151 ControllerCollector(const ControllerCollector& destionation);
00152 ControllerCollector& operator =(const ControllerCollector& destionation);
00153 };
00154
00155 }
00156
00157 #endif