Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

igtlObjectFactoryBase.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Open IGT Link Library
00004   Module:    $HeadURL: http://svn.na-mic.org/NAMICSandBox/trunk/OpenIGTLink/Source/igtlObjectFactoryBase.h $
00005   Language:  C++
00006   Date:      $Date: 2008-12-22 19:05:42 -0500 (Mon, 22 Dec 2008) $
00007   Version:   $Revision: 3460 $
00008 
00009   Copyright (c) Insight Software Consortium. All rights reserved.
00010 
00011   This software is distributed WITHOUT ANY WARRANTY; without even
00012   the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00013   PURPOSE.  See the above copyright notices for more information.
00014 
00015 =========================================================================*/
00016 /*=========================================================================
00017 
00018   Program:   Insight Segmentation & Registration Toolkit
00019   Module:    $RCSfile: itkObjectFactoryBase.h,v $
00020   Language:  C++
00021   Date:      $Date: 2008-12-22 19:05:42 -0500 (Mon, 22 Dec 2008) $
00022   Version:   $Revision: 3460 $
00023 
00024   Copyright (c) Insight Software Consortium. All rights reserved.
00025   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
00026 
00027   Portions of this code are covered under the VTK copyright.
00028   See VTKCopyright.txt or http://www.kitware.com/VTKCopyright.htm for details.
00029 
00030      This software is distributed WITHOUT ANY WARRANTY; without even 
00031      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00032      PURPOSE.  See the above copyright notices for more information.
00033 
00034 =========================================================================*/
00035 #ifndef __igtlObjectFactoryBase_h
00036 #define __igtlObjectFactoryBase_h
00037 
00038 #include "igtlObject.h"
00039 #include "igtlCreateObjectFunction.h"
00040 #include <list>
00041 #include <vector>
00042 
00043 namespace igtl
00044 {
00063 class OverRideMap;
00064 
00065 class IGTLCommon_EXPORT ObjectFactoryBase : public Object
00066 {
00067 public:  
00069   typedef ObjectFactoryBase        Self;
00070   typedef Object                   Superclass;
00071   typedef SmartPointer<Self>       Pointer;
00072   typedef SmartPointer<const Self> ConstPointer;
00073 
00075   igtlTypeMacro(ObjectFactoryBase, Object);
00076 
00081   static LightObject::Pointer CreateInstance(const char* igtlclassname);
00082 
00087   static std::list<LightObject::Pointer>
00088   CreateAllInstance(const char* igtlclassname);
00089 
00092   static void ReHash(); 
00093 
00095   static void RegisterFactory(ObjectFactoryBase* );
00096 
00098   static void UnRegisterFactory(ObjectFactoryBase*);
00099 
00101   static void UnRegisterAllFactories();
00102 
00105   static std::list<ObjectFactoryBase*> GetRegisteredFactories();
00106 
00112   virtual const char* GetIGTLSourceVersion(void) const = 0;
00113 
00115   virtual const char* GetDescription(void) const = 0;
00116 
00118   virtual std::list<std::string> GetClassOverrideNames();
00119 
00121   virtual std::list<std::string> GetClassOverrideWithNames();
00122 
00124   virtual std::list<std::string> GetClassOverrideDescriptions();
00125 
00127   virtual std::list<bool> GetEnableFlags();
00128 
00130   virtual void SetEnableFlag(bool flag,
00131            const char* className,
00132            const char* subclassName);
00133 
00135   virtual bool GetEnableFlag(const char* className,
00136                              const char* subclassName);
00137 
00141   virtual void Disable(const char* className);
00142 
00144   const char* GetLibraryPath();
00145 
00148   struct OverrideInformation
00149     {
00150     std::string m_Description;
00151     std::string m_OverrideWithName;
00152     bool m_EnabledFlag;
00153     CreateObjectFunctionBase::Pointer m_CreateObject;
00154     };
00155 
00156 protected:
00157   virtual void PrintSelf(std::ostream& os) const;
00158 
00160   void RegisterOverride(const char* classOverride,
00161       const char* overrideClassName,
00162       const char* description,
00163       bool enableFlag,
00164       CreateObjectFunctionBase* createFunction);
00165 
00169   virtual LightObject::Pointer CreateObject(const char* igtlclassname );
00170 
00171   ObjectFactoryBase();
00172   virtual ~ObjectFactoryBase();
00173 
00174 private:
00175   OverRideMap* m_OverrideMap;
00176 
00177   ObjectFactoryBase(const Self&); //purposely not implemented
00178   void operator=(const Self&); //purposely not implemented
00179 
00182   static void Initialize();
00183 
00185   static void RegisterDefaults();
00186 
00188 //  static void LoadDynamicFactories();
00189 //
00190 
00192 //  static void LoadLibrariesInPath( const char*);
00193 //  
00194 
00196   static std::list<ObjectFactoryBase*>* m_RegisteredFactories; 
00197 
00200   void*         m_LibraryHandle;
00201   unsigned long m_LibraryDate;
00202   std::string   m_LibraryPath;
00203 };
00204 
00205 } // end namespace igtl
00206 
00207 #endif
00208 

Generated at Sat May 9 04:47:23 2009 for OpenIGTLink by doxygen 1.5.9 written by Dimitri van Heesch, © 1997-2000