8 #ifndef G_CLASS_DEFINE_HH
9 #define G_CLASS_DEFINE_HH
22 size_t pos = 0, i = 0;
23 const char * impl_name =
typeid(T).name();
24 while ( i < strlen(impl_name) )
25 {
if ( isdigit(impl_name[i]) ) { pos++; } ++i; }
26 return ( & impl_name[pos] );
34 #define G_CLASS_NAME_FCT \
35 inline virtual const char * ClassName ( ) const { return StaticClassName(); }
39 #define G_STATIC_CLASS_NAME_FCT(T) \
40 inline static const char * StaticClassName ( ) \
41 { return ( G_StaticClassName<T>( ) ); }
46 #define G_CLONE_FCT(T) \
47 virtual T * Clone ( ) const { return ( new T(*this) ); }
50 #define G_CLONE_ABSTRACT_FCT(T) \
51 virtual T * Clone ( ) const = 0;
55 #define G_TEMP_IS_INSTANCE_OF \
56 template <class Q> bool IsInstanceOf ( ) const \
57 { return (dynamic_cast<const Q*>(this) != NULL); } \
58 template <class Q> bool IsInstanceOf ( ) \
59 { return (dynamic_cast<Q*>(this) != NULL); }
67 G_TEMP_IS_INSTANCE_OF \
70 G_STATIC_CLASS_NAME_FCT(T)
79 G_TEMP_IS_INSTANCE_OF \
80 G_CLONE_ABSTRACT_FCT(T) \
82 G_STATIC_CLASS_NAME_FCT(T)
const char * G_StaticClassName()
Definition: GClassDefine.hh:18