#include "IMidasBankProxyRegistry.hxx" #include "IDemo2Bank.hxx" #include "IMidasItr.cxx" template class COMET::IMidasItr; /// The ficticious banks named Z2** map to IDemo2Bank. /// The IMidasBankProxy::MatchesMidasBankName(const std::string name) method /// uses '*' as the wildcard character, so the mask is Z2** REGISTER_MIDAS_BANK(IDemo2Bank,Z2**) /// Typically the class constructors do nothing beyond passing their arguments to /// to the IMidasBank base class and the destructor does nothing. //_____________________________________________________________________________ COMET::IDemo2Bank::IDemo2Bank() : IMidasBank(0,TDEMO2_BANK_TITLE), fNumSubBlocks(0), fFirst(0), fLast(0) { // Default constructor COMETTrace("IDemo2Bank: Default ctor at:" << (void*) this); } //_____________________________________________________________________________ COMET::IDemo2Bank::IDemo2Bank(const ULong64_t *bank, const char* title /* = TDEMO2_BANK_TITLE */) : IMidasBank(bank,title) , fNumSubBlocks(0), fFirst(0), fLast(0) { // Normal constructor this->Init(); COMETTrace("COMET::IDemo2Bank: Normal ctor at:" << (void*) this << "\n Name:'" << this->GetName() << "'; Title:" << title << "; Bank size:" << this->GetBankSize() << "; starts at:" << (void*) this->GetBank()); } //_____________________________________________________________________________ COMET::IDemo2Bank::~IDemo2Bank() { COMETTrace("COMET::IDemo2Bank: dtor at:" << (void*) this); } //_____________________________________________________________________________ void COMET::IDemo2Bank::Init() { // Loop over sub-blocks counting them and setting up pointers. if ( ! this->GetBankSize() ) return; const UInt_t* start = this->GetData32(); //First word of data const UInt_t* end = start + this->GetSize32(); //First word after end of data fFirst = fLast = start; while ( start < end ) { fLast = start; start += *start + 1; ++fNumSubBlocks; } if ( start > end ) COMETWarn("COMET::IDemo2Bank: The sub-block that starts at " << (void*) fLast << " with ID " << *(fLast+1) << " extends beyond the end of the MIDAS bank! The last " << start - end << " words will be junk!"); } //_____________________________________________________________________________ void COMET::IDemo2Bank::Print(const Option_t* opt /* = "" */) const { COMETLog("COMET::IDemo2Bank:" << this->GetName() << " at: " << (void*) this << " data:" << this->GetSize() << " Long64_t words at: " << (void*) this->GetData() << " containing " << this->GetNumSubBlocks() << " sub-blocks"); // If option string isn't empty, print list of sub-blocks if ( strlen(opt) ) { COMETLog(" Summary of sub-blocks:-"); this->GetMidasDemo2BlockItr().Print(opt); } }