MAK Data Logger API Documentation for DIS
Home
Modules
Namespaces
Classes
Files
Examples
Libraries
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
include
lgrUtil
virtualConstructor.h
Go to the documentation of this file.
1
/******************************************************************************
2
** Copyright (c) 1992-2010 VT MAK
3
** All rights reserved.
4
******************************************************************************/
5
11
12
13
#ifndef virtualConstructor_H_
14
#define virtualConstructor_H_
15
16
#include <
lgrUtil/lgrExceptions.h
>
17
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);\
39
/*lint -e{1736}*/
\
40
protected:\
41
explicit CLASS_NAME ARG_TYPES_LIST;\
42
public:
43
44
45
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);\
68
/*lint -e{1736}*/
\
69
protected:\
70
explicit CLASS_NAME ARG_TYPES_LIST;\
71
public:
72
73
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);\
102
protected:\
103
explicit CLASS_NAME (const CLASS_NAME &);\
104
CLASS_NAME& operator=(const CLASS_NAME &);\
105
public:
106
118
#define DT_VIRTUAL_BASE_CTR( BASE_NAME , ARG_TYPES_LIST ) \
119
static BASE_NAME* createBase ARG_TYPES_LIST;\
120
121
138
#define DT_PURE_VIRTUAL_CTR( CLASS_NAME , ARG_TYPES_LIST )\
139
static CLASS_NAME* create ARG_TYPES_LIST;\
140
/*lint -e{1736}*/
\
141
public:\
142
typedef CLASS_NAME* (*creatorFunction)ARG_TYPES_LIST;\
143
static creatorFunction theCreator;\
144
static void setCreator(creatorFunction);\
145
protected:\
146
explicit CLASS_NAME ARG_TYPES_LIST;\
147
public:
148
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)\
180
{\
181
theCreator = aCreatorFunc;\
182
}\
183
CLASS_NAME* CLASS_NAME::create ARG_TYPES_AND_NAMES_LIST \
184
{\
185
if(theCreator)\
186
return theCreator ARG_NAMES_LIST;\
187
else\
188
return new CLASS_NAME ARG_NAMES_LIST;\
189
}
190
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)\
219
{\
220
theCopier = aCopierFunc;\
221
}\
222
void CLASS_NAME::setAssigner(CLASS_NAME::assignerFunction anAssignerFunc)\
223
{\
224
theAssigner = anAssignerFunc;\
225
}\
226
CLASS_NAME* CLASS_NAME::copy ( const CLASS_NAME & orig ) \
227
{\
228
if(theCopier)\
229
return theCopier (orig);\
230
else\
231
return new CLASS_NAME (orig);\
232
}\
233
CLASS_NAME& CLASS_NAME::assign(CLASS_NAME& toAssign,const CLASS_NAME& orig)\
234
{\
235
if(theAssigner)\
236
return theAssigner(toAssign,orig);\
237
else\
238
return toAssign = orig;\
239
}
240
241
242
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 \
246
{\
247
if(CLASS_NAME::theCreator)\
248
return CLASS_NAME::theCreator ARG_NAMES_LIST;\
249
else\
250
return new CLASS_NAME ARG_NAMES_LIST;\
251
}
252
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)\
288
{\
289
theCreator = aCreatorFunc;\
290
}\
291
CLASS_NAME* CLASS_NAME::create ARG_TYPES_AND_NAMES_LIST \
292
{\
293
if(theCreator)\
294
return theCreator ARG_NAMES_LIST;\
295
else\
296
throw DtAbstractInterfaceUndefined("Class " #CLASS_NAME " has not been defined\n");\
297
}
298
299
#endif
300
Document ID: Generated on Tue Aug 1 09:00:26 EDT 2017 from SVN revision 179128
Copyright © 2017 VT MÄK. All Rights Reserved (
www.mak.com
)