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

itkObjectFactoryBase.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkObjectFactoryBase.h,v $
00005   Language:  C++
00006   Date:      $Date: 2009-12-23 14:55:37 $
00007   Version:   $Revision: 1.38 $
00008 
00009   Copyright (c) Insight Software Consortium. All rights reserved.
00010   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
00011 
00012   Portions of this code are covered under the VTK copyright.
00013   See VTKCopyright.txt or http://www.kitware.com/VTKCopyright.htm for details.
00014 
00015      This software is distributed WITHOUT ANY WARRANTY; without even 
00016      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00017      PURPOSE.  See the above copyright notices for more information.
00018 
00019 =========================================================================*/
00020 #ifndef __itkObjectFactoryBase_h
00021 #define __itkObjectFactoryBase_h
00022 
00023 #include "itkObject.h"
00024 #include "itkCreateObjectFunction.h"
00025 #include <list>
00026 #include <vector>
00027 
00028 namespace itk
00029 {
00048 class OverRideMap;
00049 
00050 class ITKCommon_EXPORT ObjectFactoryBase : public Object
00051 {
00052 public:  
00054   typedef ObjectFactoryBase        Self;
00055   typedef Object                   Superclass;
00056   typedef SmartPointer<Self>       Pointer;
00057   typedef SmartPointer<const Self> ConstPointer;
00058 
00060   itkTypeMacro(ObjectFactoryBase, Object);
00061 
00066   static LightObject::Pointer CreateInstance(const char* itkclassname);
00067 
00072   static std::list<LightObject::Pointer>
00073   CreateAllInstance(const char* itkclassname);
00074 
00077   static void ReHash(); 
00078 
00080   static void RegisterFactory(ObjectFactoryBase* );
00081 
00083   static void UnRegisterFactory(ObjectFactoryBase*);
00084 
00086   static void UnRegisterAllFactories();
00087 
00090   static std::list<ObjectFactoryBase*> GetRegisteredFactories();
00091 
00097   virtual const char* GetITKSourceVersion(void) const = 0;
00098 
00100   virtual const char* GetDescription(void) const = 0;
00101 
00103   virtual std::list<std::string> GetClassOverrideNames();
00104 
00106   virtual std::list<std::string> GetClassOverrideWithNames();
00107 
00109   virtual std::list<std::string> GetClassOverrideDescriptions();
00110 
00112   virtual std::list<bool> GetEnableFlags();
00113 
00115   virtual void SetEnableFlag(bool flag,
00116            const char* className,
00117            const char* subclassName);
00118 
00120   virtual bool GetEnableFlag(const char* className,
00121                              const char* subclassName);
00122 
00126   virtual void Disable(const char* className);
00127 
00129   const char* GetLibraryPath();
00130 
00133   struct OverrideInformation
00134     {
00135     std::string m_Description;
00136     std::string m_OverrideWithName;
00137     bool m_EnabledFlag;
00138     CreateObjectFunctionBase::Pointer m_CreateObject;
00139     };
00140 
00141 protected:
00142   virtual void PrintSelf(std::ostream& os, Indent indent) const;
00143 
00145   void RegisterOverride(const char* classOverride,
00146       const char* overrideClassName,
00147       const char* description,
00148       bool enableFlag,
00149       CreateObjectFunctionBase* createFunction);
00150 
00154   virtual LightObject::Pointer CreateObject(const char* itkclassname );
00155 
00159   virtual std::list<LightObject::Pointer>
00160   CreateAllObject(const char* itkclassname);  
00161 
00162   ObjectFactoryBase();
00163   virtual ~ObjectFactoryBase();
00164 
00165 private:
00166   OverRideMap* m_OverrideMap;
00167 
00168   ObjectFactoryBase(const Self&); //purposely not implemented
00169   void operator=(const Self&); //purposely not implemented
00170 
00173   static void Initialize();
00174 
00176   static void RegisterDefaults();
00177 
00179   static void LoadDynamicFactories();
00180 
00182   static void LoadLibrariesInPath( const char*);
00183 
00185   static std::list<ObjectFactoryBase*>* m_RegisteredFactories; 
00186 
00189   void*         m_LibraryHandle;
00190   unsigned long m_LibraryDate;
00191   std::string   m_LibraryPath;
00192 };
00193 
00194 } // end namespace itk
00195 
00196 #endif
00197 

Generated at Fri Apr 16 19:12:06 2010 for ITK by doxygen 1.6.1 written by Dimitri van Heesch, © 1997-2000