#include "ICOMETLog.hxx" #include "IMidasBank.hxx" #include "IMidasBankProxy.hxx" #include #include #include #include ClassImp(COMET::IMidasBankProxy); //_____________________________________________________________________________ COMET::IMidasBankProxy::IMidasBankProxy(const std::string name /* = "IMidasBankProxy" */, const std::string masks /* = "none" */) : fName(name) { // Default constructor // Split semi-colon separated list of names ito individual strings. TString str(masks); TObjArray* arr(str.Tokenize(";")); TIter itr(arr); while ( TObject* obj_str = itr() ) { fMidasBankMasks.push_back(obj_str->GetName()); } delete arr; arr = 0; COMETTrace("IMidasBankProxy: Default ctor for masks '" << masks << "' at:" << (void*) this); } //_____________________________________________________________________________ COMET::IMidasBankProxy::~IMidasBankProxy() { COMETTrace("COMET::IMidasBankProxy: dtor at:" << (void*) this); } //_____________________________________________________________________________ COMET::IMidasBank* COMET::IMidasBankProxy::CreateMidasBank( const ULong64_t *bank /* = NULL */, const char* title /* = TMIDAS_BANK_TITLE */) const { COMET::IMidasBank* rdb = new COMET::IMidasBank(bank,title); COMETTrace("COMET::IMidasBankProxy: Creating a raw IMidasBank named " << rdb->GetName() << " at:" << (void*) rdb); return rdb; } //_____________________________________________________________________________ std::string COMET::IMidasBankProxy::GetMidasBankMasks(Int_t index /*= -1 */) const { std::string masks; std::list::const_iterator itr(fMidasBankMasks.begin()), itrEnd(fMidasBankMasks.end()); Int_t entry = 0; while ( itr != itrEnd ) { if ( index < 0 || index == entry ) { if ( masks.size() ) masks += ";"; masks += *itr; } ++entry; ++itr; } return masks; } //_____________________________________________________________________________ Bool_t COMET::IMidasBankProxy::MatchesMidasBankName(const std::string name) const { std::list::const_iterator itr(fMidasBankMasks.begin()), itrEnd(fMidasBankMasks.end()); while ( itr != itrEnd ) { std::string mask = *(itr++); if ( mask.size() != name.size() ) continue; Bool_t matches = true; for (unsigned i_chr = 0; i_chr < mask.size(); ++i_chr) { if ( mask[i_chr] != '*' and mask[i_chr] != name[i_chr] ) matches = false; } if ( matches ) return true; } return false; }