13 #ifndef virtualConstructor_H_
14 #define virtualConstructor_H_
34 #define DT_VIRTUAL_CTR( CLASS_NAME , ARG_TYPES_LIST ) \
35 typedef CLASS_NAME* (*creatorFunction)ARG_TYPES_LIST;\
36 static CLASS_NAME* create ARG_TYPES_LIST;\
37 static creatorFunction theCreator;\
38 static void setCreator(creatorFunction);\
41 explicit CLASS_NAME ARG_TYPES_LIST;\
63 #define DT_VIRTUAL_CTR_DEFAULTS( CLASS_NAME , ARG_TYPES_LIST , ARG_DEFAULTS_LIST ) \
64 typedef CLASS_NAME* (*creatorFunction)ARG_TYPES_LIST;\
65 static CLASS_NAME* create ARG_DEFAULTS_LIST;\
66 static creatorFunction theCreator;\
67 static void setCreator(creatorFunction);\
70 explicit CLASS_NAME ARG_TYPES_LIST;\
93 #define DT_VIRTUAL_COPY_ASSIGN( CLASS_NAME ) \
94 typedef CLASS_NAME* (*copierFunction)(const CLASS_NAME &);\
95 typedef CLASS_NAME& (*assignerFunction)(CLASS_NAME&,const CLASS_NAME &);\
96 static CLASS_NAME* copy (const CLASS_NAME &);\
97 static CLASS_NAME& assign(CLASS_NAME&,const CLASS_NAME &);\
98 static copierFunction theCopier;\
99 static assignerFunction theAssigner;\
100 static void setCopier (copierFunction);\
101 static void setAssigner(assignerFunction);\
103 explicit CLASS_NAME (const CLASS_NAME &);\
104 CLASS_NAME& operator=(const CLASS_NAME &);\
118 #define DT_VIRTUAL_BASE_CTR( BASE_NAME , ARG_TYPES_LIST ) \
119 static BASE_NAME* createBase ARG_TYPES_LIST;\
138 #define DT_PURE_VIRTUAL_CTR( CLASS_NAME , ARG_TYPES_LIST )\
139 static CLASS_NAME* create ARG_TYPES_LIST;\
142 typedef CLASS_NAME* (*creatorFunction)ARG_TYPES_LIST;\
143 static creatorFunction theCreator;\
144 static void setCreator(creatorFunction);\
146 explicit CLASS_NAME ARG_TYPES_LIST;\
177 #define DT_VIRTUAL_CTR_DEFINE(CLASS_NAME,ARG_TYPES_AND_NAMES_LIST,ARG_NAMES_LIST)\
178 CLASS_NAME::creatorFunction CLASS_NAME::theCreator = 0;\
179 void CLASS_NAME::setCreator(CLASS_NAME::creatorFunction aCreatorFunc)\
181 theCreator = aCreatorFunc;\
183 CLASS_NAME* CLASS_NAME::create ARG_TYPES_AND_NAMES_LIST \
186 return theCreator ARG_NAMES_LIST;\
188 return new CLASS_NAME ARG_NAMES_LIST;\
215 #define DT_VIRTUAL_COPY_ASSIGN_DEFINE(CLASS_NAME)\
216 CLASS_NAME::copierFunction CLASS_NAME::theCopier = 0;\
217 CLASS_NAME::assignerFunction CLASS_NAME::theAssigner = 0;\
218 void CLASS_NAME::setCopier(CLASS_NAME::copierFunction aCopierFunc)\
220 theCopier = aCopierFunc;\
222 void CLASS_NAME::setAssigner(CLASS_NAME::assignerFunction anAssignerFunc)\
224 theAssigner = anAssignerFunc;\
226 CLASS_NAME* CLASS_NAME::copy ( const CLASS_NAME & orig ) \
229 return theCopier (orig);\
231 return new CLASS_NAME (orig);\
233 CLASS_NAME& CLASS_NAME::assign(CLASS_NAME& toAssign,const CLASS_NAME& orig)\
236 return theAssigner(toAssign,orig);\
238 return toAssign = orig;\
244 #define DT_VIRTUAL_BASE_CTR_DEFINE(CLASS_NAME,BASE_NAME,ARG_TYPES_AND_NAMES_LIST,ARG_NAMES_LIST)\
245 BASE_NAME* CLASS_NAME::createBase ARG_TYPES_AND_NAMES_LIST \
247 if(CLASS_NAME::theCreator)\
248 return CLASS_NAME::theCreator ARG_NAMES_LIST;\
250 return new CLASS_NAME ARG_NAMES_LIST;\
285 #define DT_PURE_VIRTUAL_CTR_DEFINE(CLASS_NAME,ARG_TYPES_AND_NAMES_LIST,ARG_NAMES_LIST)\
286 CLASS_NAME::creatorFunction CLASS_NAME::theCreator = 0;\
287 void CLASS_NAME::setCreator(CLASS_NAME::creatorFunction aCreatorFunc)\
289 theCreator = aCreatorFunc;\
291 CLASS_NAME* CLASS_NAME::create ARG_TYPES_AND_NAMES_LIST \
294 return theCreator ARG_NAMES_LIST;\
296 throw DtAbstractInterfaceUndefined("Class " #CLASS_NAME " has not been defined\n");\
Contains Logger exceptions.