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
00021
00022
00023
00039
00040
00041
00042
00043
00059
00060
00061
00062
00063
00070 #ifdef FEM_BUILD_VISUALIZATION
00071 #include <afxwin.h>
00072 #endif
00073
00074
00075 #include <fstream>
00076
00077 #include "itkFEMObjectFactory.h"
00078
00079
00080
00081
00082
00083 #ifdef FEM_USE_SMART_POINTERS
00084 #include "itkMacro.h"
00085 #include "itkSmartPointer.h"
00086 #include "itkObjectFactory.h"
00087 #include "itkLightObject.h"
00088 #endif
00089
00090
00091
00092
00110 #ifndef FEM_USE_SMART_POINTERS
00111
00112 #define FEM_ABSTRACT_CLASS(thisClass,parentClass) \
00113 public: \
00114 \
00115 typedef thisClass Self; \
00116
00117 \
00118 typedef parentClass Superclass; \
00119 \
00121 typedef Self* Pointer; \
00122 \
00124 typedef const Self* ConstPointer; \
00125 private:
00126
00127 #else
00128
00129 #define FEM_ABSTRACT_CLASS(thisClass,parentClass) \
00130 public: \
00131 \
00132 typedef thisClass Self; \
00133
00134 \
00135 typedef parentClass Superclass; \
00136 \
00138 typedef SmartPointer<Self> Pointer; \
00139 \
00141 typedef SmartPointer<const Self> ConstPointer; \
00142 itkTypeMacro(thisClass,parentClass) \
00143 private:
00144
00145 #endif
00146
00147
00148
00149
00168 #ifndef FEM_USE_SMART_POINTERS
00169 #define FEM_CLASS(thisClass,parentClass) \
00170 \
00171 FEM_ABSTRACT_CLASS(thisClass,parentClass) \
00172 public: \
00173
00174 \
00175 virtual Baseclass::Pointer Clone() const \
00176 { return new Self(*this); } \
00177 \
00179 static Pointer New() \
00180 { return new Self(); } \
00181 \
00183 static Baseclass::Pointer NewB() \
00184 { return New(); } \
00185 \
00187 static int CLID(void); \
00188 \
00190 virtual int ClassID() const \
00191 { return CLID(); } \
00192 private:
00193 #else
00194 #define FEM_CLASS(thisClass,parentClass) \
00195 \
00196 FEM_ABSTRACT_CLASS(thisClass,parentClass) \
00197 public: \
00198
00199 \
00200 virtual Baseclass::Pointer Clone() const \
00201 { Pointer o=new Self(*this); \
00202 o->SetReferenceCount(1); \
00203 return o; } \
00204 \
00206 itkNewMacro(Self) \
00207 \
00209 static Baseclass::Pointer NewB() \
00210 { return New(); } \
00211 \
00213 static int CLID(void) \
00214 \
00216 virtual int ClassID() const \
00217 { return CLID(); } \
00218 private:
00219 #endif
00220
00221
00222
00242
00243 #define FEM_CLASS_REGISTER(thisClass) \
00244 int thisClass::CLID(void) \
00245 { static const int CLID_ = FEMObjectFactory<thisClass::Baseclass>::Register( thisClass::NewB, #thisClass); \
00246 return CLID_; }
00247
00248
00249
00250
00251
00252 namespace itk {
00253 namespace fem {
00254
00259 struct INITClass {
00260 INITClass(int i) {
00261
00262
00263
00264
00265
00266
00267 volatile int Dummy=i;
00268 Dummy++;
00269 }
00270 };
00271
00272 }}
00273
00274
00275
00290 #define FEM_CLASS_INIT(thisClass) \
00291 static INITClass Initializer_##thisClass(thisClass::CLID());
00292
00293
00294
00295 #endif // #ifndef __itkFEMMacro_h
00296