// ---------------------------------------------------------------------- // // HepObj.cc - implementation of class HepObj // // // History: // 28-Jul-1997 Walter Brown Factored out from HepHist.cc // 14-Aug-1997 Walter Brown Handled explicit destruction of embedded // pointer objects // // ---------------------------------------------------------------------- #ifndef HEPOBJ_H #include "HepTuple/HepObj.h" #endif #ifndef HEPTRACE_H #include "HepTuple/HepTrace.h" #endif #include USING( std::string ) #define BADCALL(fctnName) \ ZMthrow(ZMxHepUnsupported("your object class does not support the "\ #fctnName " call.")); ZM_BEGIN_NAMESPACE( zmht ) /* namespace zmht { */ // control deallocation void HepObj::operator delete( void * me ) { HEP_DEBUG( "HepObj::delete( " << ((HepObj *) me)->id_ << " )" ); if ( ((HepObj *) me)->mayDelete() ) { delete ((HepObj *)me)->dir_; delete ((HepObj *)me)->title_; delete ((HepObj *)me)->id_; ::delete( (HepObj *)me ); } else HEP_DEBUG(" not deleted; this object is still in use or still managed" ); } HepObj & HepObj::makeClone( const string& title, const int id ) const { BADCALL(makeClone()); return *HepFileManager::deadHepObj(); } HepObj & HepObj::makeClone( HepFileManager *manager, const string& title, const int id ) const { BADCALL(makeClone()); return *HepFileManager::deadHepObj(); } HepObj & HepObj::makeEmpty( const string& title, const int id ) const { BADCALL(makeEmpty()); return *HepFileManager::deadHepObj(); } HepObj & HepObj::makeEmpty( HepFileManager *manager, const string& title, const int id ) const { BADCALL(makeEmpty()); return *HepFileManager::deadHepObj(); } ZM_END_NAMESPACE( zmht ) /* } // namespace zmht */