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 typedef parentClass Superclass; \
00118 \
00119 typedef Self* Pointer; \
00120 \
00121 typedef const Self* ConstPointer; \
00122 private: // everything that follows from here is private by default (like in the beginning of class)
00123
00124 #else
00125
00126 #define FEM_ABSTRACT_CLASS(thisClass,parentClass) \
00127 public: \
00128 \
00129 typedef thisClass Self; \
00130 \
00131 typedef parentClass Superclass; \
00132 \
00133 typedef SmartPointer<Self> Pointer; \
00134 \
00135 typedef SmartPointer<const Self> ConstPointer; \
00136 itkTypeMacro(thisClass,parentClass) \
00137 private: // everything that follows from here is private by default (like in the beginning of class)
00138
00139 #endif
00140
00141
00142
00143
00162 #ifndef FEM_USE_SMART_POINTERS
00163 #define FEM_CLASS(thisClass,parentClass) \
00164 \
00165 FEM_ABSTRACT_CLASS(thisClass,parentClass) \
00166 public: \
00167 \
00168 virtual Baseclass::Pointer Clone() const \
00169 { return new Self(*this); } \
00170 \
00171 static Pointer New() \
00172 { return new Self(); } \
00173 \
00174 static Baseclass::Pointer NewB() \
00175 { return New(); } \
00176 \
00177 static int CLID(void); \
00178 \
00179 virtual int ClassID() const \
00180 { return CLID(); } \
00181 private: // everything that follows from here is private by default (like in the beginning of class)
00182 #else
00183 #define FEM_CLASS(thisClass,parentClass) \
00184 \
00185 FEM_ABSTRACT_CLASS(thisClass,parentClass) \
00186 public: \
00187 \
00188 virtual Baseclass::Pointer Clone() const \
00189 { Pointer o=new Self(*this); \
00190 o->SetReferenceCount(1); \
00191 return o; } \
00192 \
00193 itkNewMacro(Self) \
00194 \
00195 static Baseclass::Pointer NewB() \
00196 { return New(); } \
00197 \
00198 static int CLID(void) \
00199 \
00200 virtual int ClassID() const \
00201 { return CLID(); } \
00202 private: // everything that follows from here is private by default (like in the beginning of class)
00203 #endif
00204
00205
00206
00226
00227 #define FEM_CLASS_REGISTER(thisClass) \
00228 int thisClass::CLID(void) \
00229 { static const int CLID_ = FEMObjectFactory<thisClass::Baseclass>::Register( thisClass::NewB, #thisClass); \
00230 return CLID_; }
00231
00232
00233
00234
00235 namespace itk {
00236 namespace fem {
00237
00242 struct INITClass {
00243 INITClass(int i) {
00244
00245
00246
00247
00248
00249
00250 volatile int Dummy=i;
00251 Dummy++;
00252 }
00253 };
00254
00255 }}
00256
00257
00258
00273 #define FEM_CLASS_INIT(thisClass) \
00274 static INITClass Initializer_##thisClass(thisClass::CLID());
00275
00276
00277
00278 #endif // #ifndef __itkFEMMacro_h