frePointSupportedMetricCtrlrs.cxx

Go to the documentation of this file.
00001 /*=========================================================================
00002  
00003   Program:   F.R.E.E. - flexible registration evaluation engine
00004   Version:   v.1.0.0
00005   Date:      $Date: 2006/09/01 12:00:00 $
00006   Module:    $RCSfile: frePointSupportedMetricCtrlrs.cxx,v $
00007   Language:  C++
00008  
00009  
00010         
00011   Copyright (c) 2007 Ralf o Floca (Department of Medical Informatics,
00012   Institute for Medical Biometry and Informatics, University of Heidelberg,
00013   Germany). All rights reserved.
00014   See FREECopyright.txt or http://www.mi.med.uni-hd.de/free/copyright.htm
00015   for details.
00016  
00017      This software is distributed WITHOUT ANY WARRANTY; without even 
00018      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00019      PURPOSE.  See the above copyright notices for more information.
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 } // end of anonymous namspace of dll interface
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     //Metrics
00112     internalControllerList.push_back(ControllerID::PointSupported2DMetricController);
00113     internalControllerList.push_back(ControllerID::PointSupported3DMetricController);
00114 
00115     //create export array with controller names.
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     //Metrics
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 } //end of namespace free

Generated at Sat Oct 13 17:06:57 2007 for f.r.e.e. - Flexible Registration and Evaluation Engine by doxygen 1.5.3 written by Dimitri van Heesch, © 1997-2000