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 #ifndef __itkFEMMacro_h
00019 #define __itkFEMMacro_h
00020
00036
00037
00053
00054
00061 #ifdef FEM_BUILD_VISUALIZATION
00062 #include <afxwin.h>
00063 #endif
00064
00065
00066 #include <fstream>
00067
00068 #include "itkFEMObjectFactory.h"
00069
00070
00071 #ifdef FEM_USE_SMART_POINTERS
00072 #include "itkMacro.h"
00073 #include "itkSmartPointer.h"
00074 #include "itkObjectFactory.h"
00075 #include "itkLightObject.h"
00076 #endif
00077
00095 #ifndef FEM_USE_SMART_POINTERS
00096
00097 #define FEM_ABSTRACT_CLASS(thisClass,parentClass) \
00098 public: \
00099 \
00100 typedef thisClass Self; \
00101
00102 \
00103 typedef parentClass Superclass; \
00104 \
00106 typedef Self* Pointer; \
00107 \
00109 typedef const Self* ConstPointer; \
00110 private:
00111
00112 #else
00113
00114 #define FEM_ABSTRACT_CLASS(thisClass,parentClass) \
00115 public: \
00116 \
00117 typedef thisClass Self; \
00118
00119 \
00120 typedef parentClass Superclass; \
00121 \
00123 typedef SmartPointer<Self> Pointer; \
00124 \
00126 typedef SmartPointer<const Self> ConstPointer; \
00127 itkTypeMacro(thisClass,parentClass) \
00128 private:
00129
00130 #endif
00131
00150 #ifndef FEM_USE_SMART_POINTERS
00151 #define FEM_CLASS(thisClass,parentClass) \
00152 \
00153 FEM_ABSTRACT_CLASS(thisClass,parentClass) \
00154 public: \
00155
00156 \
00157 virtual Baseclass::Pointer Clone() const \
00158 { return new Self(*this); } \
00159 \
00161 static Pointer New() \
00162 { return new Self(); } \
00163 \
00165 static Baseclass::Pointer NewB() \
00166 { return New(); } \
00167 \
00169 static int CLID(void); \
00170 \
00172 virtual int ClassID() const \
00173 { return CLID(); } \
00174 private:
00175 #else
00176 #define FEM_CLASS(thisClass,parentClass) \
00177 \
00178 FEM_ABSTRACT_CLASS(thisClass,parentClass) \
00179 public: \
00180
00181 \
00182 virtual Baseclass::Pointer Clone() const \
00183 { Pointer o=new Self(*this); \
00184 o->SetReferenceCount(1); \
00185 return o; } \
00186 \
00188 itkNewMacro(Self) \
00189 \
00191 static Baseclass::Pointer NewB() \
00192 { return New(); } \
00193 \
00195 static int CLID(void) \
00196 \
00198 virtual int ClassID() const \
00199 { return CLID(); } \
00200 private:
00201 #endif
00202
00222
00223 #define FEM_CLASS_REGISTER(thisClass) \
00224 int thisClass::CLID(void) \
00225 { static const int CLID_ = FEMObjectFactory<thisClass::Baseclass>::Register( thisClass::NewB, #thisClass); \
00226 return CLID_; }
00227
00228
00229 namespace itk {
00230 namespace fem {
00231
00236 struct INITClass {
00237 INITClass(int i) {
00238
00239
00240
00241
00242
00243
00244 volatile int Dummy=i;
00245 Dummy++;
00246 }
00247 };
00248
00249 }}
00250
00265 #define FEM_CLASS_INIT(thisClass) \
00266 static INITClass Initializer_##thisClass(thisClass::CLID());
00267
00268 #endif // #ifndef __itkFEMMacro_h
00269