Go to the documentation of this file.00001 #ifndef rgrl_macros_h
00002 #define rgrl_macros_h
00003
00004
00005
00006 #include <vcl_typeinfo.h>
00007 #include <vcl_iostream.h>
00008
00009 #if defined(VCL_VC_DOTNET) || defined(VCL_GCC)
00010 # define RGRL_HERE __FUNCTION__
00011 #else
00012 # define RGRL_HERE __FILE__
00013 #endif
00014
00015
00016 #define DebugMacro(level, x) do \
00017 { if (level == 0 || this->debug_flag() >= level) { \
00018 vcl_cout<< "Debug: "<< RGRL_HERE << " ( line " \
00019 << __LINE__ <<" )\n" << " "<<x; } \
00020 } while (false)
00021
00022
00023 #define DebugMacro_abv(level, x) do \
00024 { if (level == 0 || this->debug_flag() >= level) { vcl_cout<<" "<<x; } \
00025 } while (false)
00026
00027
00028 #define WarningMacro(x) do \
00029 { if ( this->warning() ) { \
00030 vcl_cout<< "WARNING: "<< RGRL_HERE <<" ( line " \
00031 << __LINE__ <<" )\n" \
00032 << " "<<x; } \
00033 } while (false)
00034
00035
00036 #define WarningMacro_abv(x) do \
00037 { if ( this->warning() ) { \
00038 vcl_cout<<<"WARNING: "<<x; } \
00039 } while (false)
00040
00041
00042 #define DebugFuncMacro(flag, level, x) do \
00043 { if (flag >= level) { \
00044 vcl_cout<< "Debug: " << RGRL_HERE << " ( line " \
00045 << __LINE__ <<" )\n" << " "<<x; } \
00046 } while (false)
00047
00048
00049 #define DebugFuncMacro_abv(flag, level, x) do \
00050 { if (flag >= level) { vcl_cout<<" "<<x; } \
00051 } while (false)
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063 #define rgrl_type_macro( classname, superclassname) \
00064 typedef classname self; \
00065 typedef superclassname superclass; \
00066 static const vcl_type_info& type_id() \
00067 { return typeid(self); } \
00068 virtual bool is_type( const vcl_type_info& type ) const\
00069 { return (typeid(self) == type)!=0 || this->superclass::is_type(type); }
00070
00071 #if 0
00072
00073
00074
00075
00076
00077
00078 #define rgrl_type_macro( classname ) \
00079 static const vcl_type_info& type_id() \
00080 { return typeid(classname); }
00081
00082
00083 #define IsTypeMacro( classname ) \
00084 virtual bool is_type( const vcl_type_info& type ) \
00085 { return typeid(classname) == type || this->superclass::is_type(type); }
00086 #endif // 0
00087
00088 #endif // end of rgrl_macros.h