Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #include <itkObjectFactoryBase.h>
00019 #include <itkVersion.h>
00020
00021 #define MITK_REGISTER_SERIALIZER(classname) \
00022 \
00023 namespace mitk \
00024 { \
00025 \
00026 class classname ## Factory : public ::itk::ObjectFactoryBase \
00027 { \
00028 public: \
00029 \
00030 \
00031 typedef classname ## Factory Self; \
00032 typedef itk::ObjectFactoryBase Superclass; \
00033 typedef itk::SmartPointer<Self> Pointer; \
00034 typedef itk::SmartPointer<const Self> ConstPointer; \
00035 \
00036 \
00037 virtual const char* GetITKSourceVersion() const \
00038 { \
00039 return ITK_SOURCE_VERSION; \
00040 } \
00041 \
00042 virtual const char* GetDescription() const \
00043 { \
00044 return "Generated factory for " #classname; \
00045 } \
00046 \
00047 \
00048 itkFactorylessNewMacro(Self); \
00049 \
00050 \
00051 itkTypeMacro(classname ## Factory, itkObjectFactoryBase); \
00052 \
00053 \
00054 static void RegisterOneFactory() \
00055 { \
00056 classname ## Factory::Pointer factory = classname ## Factory::New(); \
00057 itk::ObjectFactoryBase::RegisterFactory(factory); \
00058 } \
00059 \
00060 protected: \
00061 \
00062 classname ## Factory() \
00063 { \
00064 itk::ObjectFactoryBase::RegisterOverride(#classname, \
00065 #classname, \
00066 "Generated factory for " #classname, \
00067 1, \
00068 itk::CreateObjectFunction<classname>::New()); \
00069 } \
00070 \
00071 ~classname ## Factory() \
00072 { \
00073 } \
00074 \
00075 private: \
00076 \
00077 classname ## Factory(const Self&); \
00078 void operator=(const Self&); \
00079 \
00080 }; \
00081 \
00082 \
00083 \
00084 class classname ## RegistrationMethod \
00085 { \
00086 public: \
00087 \
00088 classname ## RegistrationMethod() \
00089 { \
00090 itk::ObjectFactoryBase::RegisterFactory( classname ## Factory::New() ); \
00091 } \
00092 }; \
00093 } \
00094 \
00095 static mitk::classname ## RegistrationMethod somestaticinitializer_ ## classname ;
00096