BALL 1.5.0
Loading...
Searching...
No Matches
create.h
Go to the documentation of this file.
1// -*- Mode: C++; tab-width: 2; -*-
2// vi: set ts=2:
3//
4
5#ifndef BALL_COMMON_CREATE_H
6#define BALL_COMMON_CREATE_H
7
9
26#define BALL_CREATE_DEEP(name)\
27\
28 virtual void* create(bool deep = true, bool empty = false) const\
29 {\
30 void* ptr;\
31 if (empty == true)\
32 {\
33 ptr = (void*)new name;\
34 }\
35 else\
36 {\
37 ptr = (void*)new name(*this, deep);\
38 }\
39 \
40 return ptr;\
41 }\
42 \
43 static void* createDefault()\
44 {\
45 return static_cast<void*>(new name);\
46 }
47
62#define BALL_CREATE(name)\
63\
64 virtual void* create(bool /* deep */ = true, bool empty = false) const\
65 {\
66 void* ptr;\
67 if (empty == true)\
68 {\
69 ptr = (void*)new name;\
70 }\
71 else\
72 {\
73 ptr = (void*)new name(*this);\
74 }\
75 \
76 return ptr;\
77 }\
78 \
79 static void* createDefault()\
80 {\
81 return static_cast<void*>(new name);\
82 }
83
93#define BALL_DEFINE_CREATE(name)\
94\
95 virtual void* create(bool deep = true, bool empty = false) const;\
96 static void* createDefault();
97
99
100#endif // BALL_COMMON_CREATE_H