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
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
00065
00066
00067 #define H_T_DURABLE
00068
00069
00070 #define H_T__REF(h) HepTransRef< H_T__NAME(h) >
00071
00072
00073
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
00078
00079
00080 #define H_T_REF(h) h*
00081
00082
00083
00084
00085
00086
00087
00088 #define H_T_NEW_CLUSTER0 new
00089
00090 #define H_T_CLUSTER1(a_place) void *a_place
00091
00092
00093
00094
00095
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
00104 #define H_BIN_UPDATE
00105
00106 #define T_HTL_STR_CONV(x) x.c_str()
00107
00108 #endif
00109