00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkTransformFactoryBase.h,v $ 00005 Language: C++ 00006 Date: $Date: 2009-03-03 15:10:27 $ 00007 Version: $Revision: 1.3 $ 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 __itkTransformFactoryBase_h 00021 #define __itkTransformFactoryBase_h 00022 00023 #include "itkObjectFactoryBase.h" 00024 00025 namespace itk 00026 { 00031 class ITKCommon_EXPORT TransformFactoryBase : public ObjectFactoryBase 00032 { 00033 public: 00035 typedef TransformFactoryBase Self; 00036 typedef ObjectFactoryBase Superclass; 00037 typedef SmartPointer< Self > Pointer; 00038 typedef SmartPointer< const Self > ConstPointer; 00039 00041 virtual const char* GetITKSourceVersion(void) const; 00042 virtual const char* GetDescription(void) const; 00044 00046 itkTypeMacro(TransformFactoryBase, ObjectFactoryBase); 00047 00049 itkFactorylessNewMacro(Self); 00050 00052 static void RegisterDefaultTransforms(); 00053 00055 static TransformFactoryBase* GetFactory () 00056 { 00057 if ( m_Factory == 0 ) 00058 { 00059 // Make and register the factory 00060 TransformFactoryBase::Pointer p = TransformFactoryBase::New(); 00061 m_Factory = p.GetPointer(); 00062 ObjectFactoryBase::RegisterFactory ( p ); 00063 p->RegisterDefaultTransforms (); 00064 } 00065 return m_Factory; 00066 } 00068 00069 void RegisterTransform(const char* classOverride, 00070 const char* overrideClassName, 00071 const char* description, 00072 bool enableFlag, 00073 CreateObjectFunctionBase* createFunction) 00074 { 00075 this->RegisterOverride ( classOverride, overrideClassName, description, enableFlag, createFunction ); 00076 } 00077 00078 protected: 00079 TransformFactoryBase(); 00080 virtual ~TransformFactoryBase(); 00081 00082 private: 00083 TransformFactoryBase(const Self&); //purposely not implemented 00084 void operator=(const Self&); //purposely not implemented 00085 static TransformFactoryBase* m_Factory; 00086 }; 00087 } // end namespace itk 00088 00089 #endif 00090