// $Id: IData.cxx,v 1.7 2010/01/14 01:48:57 mcgrew Exp $ // // Implement the COMET::IData class. This is a very simple class so almost // all of the methods are implemented in line. However the ClassImp // macro must be in a separate file and the virtual distructor is also // implemented here. #include "IData.hxx" // The default destructor. COMET::IData::~IData() { } void COMET::IData::AddDatum(COMET::IDatum* val, const char* name) { if (!val) { COMETSevere("Datum pointer has null value"); throw EBadInsertion(); } if (name) val->SetName(name); val->SetBit(kCanDelete,false); InsertDatum(val); } void COMET::IData::AddDatum(COMET::IHandle<COMET::IDatum> handle, const char* name) { // Make sure the handle is valid; if (!handle) throw EBadInsertion(); // Make sure that handle isn't holding an object that already belongs // in the event. if (handle->GetParentDatum()) { COMETSevere("Datum appears to have already been inserted"); throw EBadInsertion(); } handle.Release(); IDatum* val = GetPointer(handle); AddDatum(val,name); } // The default RemoveDatum. This always aborts since it must have // been implemented by the derived class. COMET::IDatum* COMET::IData::RemoveDatum(COMET::IDatum*) { AbstractMethod("IData::RemoveDatum"); return NULL; } // The default FindDatum never finds the object since there is never // an object to find. COMET::IDatum* COMET::IData::FindDatum(const char*) { AbstractMethod("IData::FindDatum"); return NULL; } // The default InsertDatum cannot really add data since there is no // container in the base COMET::IData. void COMET::IData::InsertDatum(COMET::IDatum *) { AbstractMethod("IData::InsertDatum"); }