00001 00002 // $Id: JobCRecord.cxx,v 1.2 2002/06/12 20:43:15 rhatcher Exp $ 00003 // 00004 // A class to hold the event data pointer and any information that 00005 // might go along with it. 00006 // 00007 // messier@huhepl.harvard.edu 00009 #include "JobControl/JobCRecord.h" 00010 #include <cassert> 00011 #include "MinosObjectMap/MomNavigator.h" 00012 00013 JobCRecord::JobCRecord() : 00014 fDataPtr(new MomNavigator()), 00015 fOwnData(true), 00016 fIsPhysics(true) 00017 { 00018 assert(fDataPtr); 00019 } 00020 00021 //...................................................................... 00022 00023 JobCRecord::JobCRecord(MomNavigator* mom) : 00024 fDataPtr(mom), 00025 fOwnData(false), 00026 fIsPhysics(true) 00027 { 00028 assert(fDataPtr); 00029 } 00030 00031 //...................................................................... 00032 00033 JobCRecord::~JobCRecord() 00034 { 00035 if (fOwnData) { 00036 delete fDataPtr; 00037 fDataPtr = 0; 00038 } 00039 } 00040 00041 //...................................................................... 00042 00043 MomNavigator* JobCRecord::GetDataPtr() const 00044 { 00045 return fDataPtr; 00046 } 00047 00048 //...................................................................... 00049 00050 bool JobCRecord::IsPhysics() const { return fIsPhysics; } 00051 00052 //...................................................................... 00053 00054 bool JobCRecord::IsNonPhysics() const { return !fIsPhysics; } 00055 00056 //...................................................................... 00057 00058 void JobCRecord::SetDataPtr(MomNavigator* mom) 00059 { 00060 //====================================================================== 00061 // Accecpt a pointer to data from external source. Ownership stays 00062 // with the external source. 00063 //====================================================================== 00064 if (fDataPtr && fOwnData) { 00065 delete fDataPtr; 00066 fDataPtr = 0; 00067 } 00068 fDataPtr = mom; 00069 fOwnData = false; 00070 } 00071 00072 //...................................................................... 00073 00074 void JobCRecord::SetIsPhysics(bool isphys) 00075 { 00076 fIsPhysics = isphys; 00077 } 00078 00079 //...................................................................... 00080 00081 void JobCRecord::Reset() 00082 { 00083 //====================================================================== 00084 // Reset the record to initial set of defaults 00085 //====================================================================== 00086 00087 if (fDataPtr) fDataPtr->Clear(); 00088 00089 fIsPhysics = true; // Assume records hold physics unless told otherwise 00090 } 00091
1.3.9.1