00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include "frePointSupportedMetricCtrlrs.h"
00023
00024 #include "frePointSupportedMetricController.h"
00025
00026 namespace FREE
00027 {
00028
00029 #ifndef __FREE_DISABLE_DLL_INTERFACE
00030
00031 namespace
00032 {
00033
00034 extern "C"
00035 #ifdef _WIN32
00036 __declspec( dllexport )
00037 #endif
00038 void FREEGetControllerList(int& iControllerCount, const char**& pControllerIDs)
00039 {
00040 ::FREE::PointSupportedMetricCtrlrs::GetControllerList(iControllerCount, pControllerIDs);
00041 };
00042
00043 extern "C"
00044 #ifdef _WIN32
00045 __declspec( dllexport )
00046 #endif
00047 GenericComponentController* FREECreateController(const char* pControllerID)
00048 {
00049 return ::FREE::PointSupportedMetricCtrlrs::CreateController(pControllerID);
00050 };
00051
00052 extern "C"
00053 #ifdef _WIN32
00054 __declspec( dllexport )
00055 #endif
00056 bool FREEDeleteController (GenericComponentController* pController)
00057 {
00058 if (pController)
00059 {
00060 delete pController;
00061 }
00062 return true;
00063 };
00064
00065 extern "C"
00066 #ifdef _WIN32
00067 __declspec( dllexport )
00068 #endif
00069 void FREELinkCentralAsDedicated (::FREE::ControllerCentral::ControllerListType* pDedicatedControllerList,
00070 ::FREE::ControllerCentral::LibraryHandleListType* pDedicatedLibraryHandles,
00071 ::FREE::ProgressEventBase* pfnOnControl, ::FREE::ProgressEventBase* pfnOnBuild,
00072 ::FREE::ControllerCentral::CtrlCallbackListType* pCtrlCallbackList,
00073 ::FREE::ControllerCentral::CtrlProgressListType* pCtrlProgressList,
00074 ::itk::MutexLock* pGlobalCallbackMutex,
00075 ::itk::MutexLock* pGlobalProgressMutex)
00076 {
00077 ::FREE::ControllerCentral::LinkControllerCentralAsDedicated(pDedicatedControllerList,pDedicatedLibraryHandles,pfnOnControl,pfnOnBuild,pCtrlCallbackList,pCtrlProgressList,pGlobalCallbackMutex,pGlobalProgressMutex);
00078 }
00079
00080
00081 }
00082
00083 #endif // __FREE_DISABLE_DLL_INTERFACE
00084
00088
00089
00090 void PointSupportedMetricCtrlrs::RegisterAllControllers(ControllerCentral* pCentral)
00091 {
00092 int iCount = 0;
00093 const char** pControllerIDs = 0;
00094
00095 PointSupportedMetricCtrlrs::GetControllerList(iCount,pControllerIDs);
00096
00097 for (int iPos = 0; iPos < iCount; iPos++)
00098 {
00099 pCentral->RegisterController(PointSupportedMetricCtrlrs::CreateController(pControllerIDs[iPos]));
00100 }
00101
00102 if (pControllerIDs)
00103 delete pControllerIDs;
00104 };
00105
00106 void PointSupportedMetricCtrlrs::GetControllerList(int& iControllerCount, const char**& pControllerIDs)
00107 {
00108 typedef std::vector<const char*> ControllerListType;
00109 ControllerListType internalControllerList;
00110
00111
00112 internalControllerList.push_back(ControllerID::PointSupported2DMetricController);
00113 internalControllerList.push_back(ControllerID::PointSupported3DMetricController);
00114
00115
00116 iControllerCount = internalControllerList.size();
00117 pControllerIDs = new const char*[iControllerCount];
00118 for (unsigned int iPos = 0; iPos<iControllerCount; iPos++)
00119 {
00120 pControllerIDs[iPos] = internalControllerList.at(iPos);
00121 }
00122 };
00123
00124 GenericComponentController* PointSupportedMetricCtrlrs::CreateController(const char* pControllerID)
00125 {
00126 std::string sControllerID(pControllerID);
00127
00128
00129 if (sControllerID == ControllerID::PointSupported2DMetricController)
00130 return(GenericComponentController*)new PointSupported2DMetricController;
00131 if (sControllerID == ControllerID::PointSupported3DMetricController)
00132 return(GenericComponentController*)new PointSupported3DMetricController;
00133
00134 return NULL;
00135 };
00136
00137
00138 }