Anaphe Home Page Reference Documentation

Main Page     Namespaces     Classes     Source Code    

H_iid.h

Go to the documentation of this file.
00001 #ifndef _H_IID_H_
00002 #define _H_IID_H_ 1
00003 
00004 
00005 #include <string.h>
00006 
00007 //
00008 // Very simple class *introspection*-like metadata.
00009 //
00010 // If you want to know if 2 partitions p1 and p2 are of same type, i.e.
00011 // either Even_Partition or H_?__Uneven_Partition, just use:
00012 //      H_IID_IS_EQUAL( p1, p2 )
00013 //
00014 // If you want to know if 2 histos (handles) h1 and h2 are of same type, i.e.
00015 // either Histo_1D or Histo_2D for instance, just use:
00016 //      H_IID_IS_EQUAL( *h1, *h2 )
00017 // 
00018 // Note: the test is done polymorphically taking into account the effective
00019 // type of the histo.
00020 //
00021 
00022 #ifdef H_NO_IID
00023 
00024         #define H_IID_IMPLEMENT( an_iid_name ) 
00025         #define H_IID_IS_EQUAL( x, y )  1
00026         #define H_IID_IS_EQUAL0( x, y ) 1
00027 
00028 #else
00029 
00030         typedef const char * H_IID;
00031 
00032         #define H_IID_IMPLEMENT( an_iid_name )          \
00033                 virtual H_IID _class_name() const { return #an_iid_name; }
00034 
00035         #define H_IID_IS_EQUAL( x, y )  \
00036                 ( strcmp( x._class_name(), y._class_name() ) == 0 )
00037 
00038         #define H_IID_IS_EQUAL0( x, y ) \
00039                 ( strcmp( x, y ) == 0 )
00040 
00041 #endif // H_NO_IID
00042 
00043 #endif // _H_IID_H_
00044 


Anaphe documentation generated by Doxygen (www.doxygen.org)