Anaphe Home Page Reference Documentation

Main Page     Namespaces     Classes     Source Code    

T_macros.h

Go to the documentation of this file.
00001 #ifndef _H_T__LIFE_H_
00002 #define _H_T__LIFE_H_ 1
00003 
00004 #include "HTL/H_macros.h"
00005 
00006 //
00007 // ***************************************************************************
00008 //
00009 
00010 // Taken from HepODBMS.
00011 template< class T >
00012 class HepTransRef
00013 {
00014 public:
00015         HepTransRef(T* aRawPtr=0) { rawPtr = aRawPtr; }
00016 
00017         HepTransRef(const HepTransRef<T>& aRef)
00018         { if (this != &aRef) rawPtr = aRef.rawPtr; }
00019 
00020         ~HepTransRef() {}
00021 
00022         HepTransRef<T> & operator=(const HepTransRef<T> &aRef) {
00023                 if (this != &aRef) rawPtr = aRef.rawPtr;
00024                 return *this;
00025         }
00026 
00027         HepTransRef<T> & operator=(const T &aT) {
00028                 if (this->rawPtr != &aT) rawPtr = (T *) &aT;
00029                 return *this;
00030         }
00031 
00032         HepTransRef<T> & operator=(const T *aT) {
00033                 if (this->rawPtr != aT) rawPtr = (T *) aT;
00034                 return *this;
00035         }
00036 
00037         T* operator->() { return rawPtr; }
00038 
00039         T& operator*() { return *rawPtr; }
00040 
00041         int operator==(const HepTransRef<T> &aT) const
00042         { return (rawPtr == aT.rawPtr); }
00043 
00044         int operator!() { return (rawPtr == 0); }
00045 
00046         operator T*() { return rawPtr; }
00047 
00048         int isNull() { return (rawPtr == 0); }
00049 
00050 private:
00051         T *rawPtr;
00052 };
00053 
00054 
00055 //
00056 // ***************************************************************************
00057 //
00058 
00059 
00060 #define HTLname2(a,b) gEnErIc2(a,b)
00061 #define gEnErIc2(a,b) a ## b
00062 
00063 #define H_T__NAME(h)            HTLname2(T_,h)
00064         // For transient histograms:
00065         // eg. H_T__NAME(Histo_1D) --> H_T__Histo_1D
00066 
00067 #define H_T_DURABLE  
00068         // The transient version of I_Histo does not need a base class.
00069 
00070 #define H_T__REF(h)             HepTransRef< H_T__NAME(h) >
00071         // Handle to a transient histogram.
00072         // `h' must be a valid base histo name: I_Histo, Histo_1D...
00073         // eg. H_T__REF( I_Histo ) --> HepTransRef( T_I_Histo )
00074 
00075 #define H_T__NEW1(h)            new H_T__NAME(h)
00076 #define H_T__NEW2(location, h)  new (location) H_T__NAME(h)
00077         // Book a transient histogram in location `location'.
00078 
00079 
00080 #define H_T_REF(h)              h*
00081 
00082 
00083 //
00084 // Clustering directive:
00085 //
00086 
00087 // Allocate new transient object with no placement directive.
00088 #define H_T_NEW_CLUSTER0                new
00089 
00090 #define H_T_CLUSTER1(a_place)           void *a_place
00091 
00092 // Replaced by H_T_CLUSTER1
00093 // #define H_T_CLUSTER2(a_place)                void *a_place
00094 
00095 // Allocate new transient object with placement directive.
00096 #define H_T_NEW_CLUSTER1(a_place)       new (a_place)
00097         
00098 #define H_T_THIS                        this
00099 
00100 #ifdef H_BIN_UPDATE
00101 #undef H_BIN_UPDATE
00102 #endif
00103 // Nothing to update in transient mode.
00104 #define H_BIN_UPDATE                    
00105         
00106 #define T_HTL_STR_CONV(x) x.c_str()
00107 
00108 #endif
00109 


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