BALL  1.4.1
create.h
Go to the documentation of this file.
00001 // -*- Mode: C++; tab-width: 2; -*-
00002 // vi: set ts=2:
00003 //
00004 
00005 #ifndef BALL_COMMON_CREATE_H
00006 #define BALL_COMMON_CREATE_H
00007 
00009 
00026 #define BALL_CREATE_DEEP(name)\
00027 \
00028   virtual void* create(bool deep = true, bool empty = false) const\
00029   {\
00030     void* ptr;\
00031     if (empty == true)\
00032     {\
00033       ptr = (void*)new name;\
00034     }\
00035     else\
00036     {\
00037       ptr = (void*)new name(*this, deep);\
00038     }\
00039     \
00040     return ptr;\
00041   }\
00042   \
00043   static void* createDefault()\
00044   {\
00045     return static_cast<void*>(new name);\
00046   }
00047 
00062 #define BALL_CREATE(name)\
00063 \
00064   virtual void* create(bool /* deep */ = true, bool empty = false) const\
00065   {\
00066     void* ptr;\
00067     if (empty == true)\
00068     {\
00069       ptr = (void*)new name;\
00070     }\
00071     else\
00072     {\
00073       ptr = (void*)new name(*this);\
00074     }\
00075     \
00076     return ptr;\
00077   }\
00078   \
00079   static void* createDefault()\
00080   {\
00081     return static_cast<void*>(new name);\
00082   }
00083 
00093 #define BALL_DEFINE_CREATE(name)\
00094 \
00095   virtual void* create(bool deep = true, bool empty = false) const;\
00096   static void* createDefault();
00097 
00099 
00100 #endif // BALL_COMMON_CREATE_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines