119 while(
TObject* obj = next() ) {
148 while(
auto* dataloc =
dynamic_cast<BdataLoc*
>( next() ) ) {
149 if( dataloc->DefineVariables(
mode ) !=
kOK )
156 {
"evtype",
"CODA event type",
"evtype" },
157 {
"evtypebits",
"event type bit pattern",
"evtypebits" },
165 const TString& configstr,
bool re_init )
169 const char*
const here =
"DefineLocType";
175 unique_ptr<TObjArray> config( configstr.
Tokenize(
", \t") );
176 if( !config->IsEmpty() ) {
177 Int_t nparams = config->GetLast()+1;
178 assert( nparams > 0 );
180 if( nparams % loctype.
fNparams != 0 ) {
181 Error(
Here(
here),
"Incorrect number of parameters in database key "
182 "%s%s. Have %d, but must be a multiple of %d. Fix database.",
190 TString& bname = GetObjArrayString( params, ip );
193 Bool_t already_defined = ( item != nullptr );
194 if( already_defined ) {
199 Error(
Here(
here),
"Attempt to redefine existing variable %s "
200 "with different type.\nOld = %s, new = %s. Fix database.",
201 item->GetName(), item->IsA()->GetName(),
209 Error(
Here(
here),
"Duplicate variable name %s. Fix database.",
219 Error(
Here(
here),
"Failed to create variable of type %s. Should "
227 err = item->Configure( params, ip );
228 if( !err && loctype.
fOptptr !=
nullptr ) {
230 err = item->OptionPtr( loctype.
fOptptr );
235 "index = %d, value = %s. Fix database.",
236 GetObjArrayString(params,in).Data(), ip,
237 GetObjArrayString(params,ip).Data() );
238 if( !already_defined )
241 }
else if( !already_defined ) {
261 const TString identifier(
"Version:");
263 const size_t bufsiz = 82;
264 char* buf =
new char[bufsiz];
266 const char* s = fgets(buf,bufsiz,
file);
273 Ssiz_t pos =
line.Index(identifier,0,TString::kIgnoreCase);
276 pos += identifier.
Length();
277 while( pos <
line.Length() && isspace(
line(pos)) ) pos++;
278 if( pos >=
line.Length() )
290 if( db_version == 1 ) {
291 Warning(
Here(
"ReadDatabase"),
"Unsupported database format found. "
305 return LoadDBvalue(
file, date, dbkey, configstr );
313 static const char*
const here =
"ReadDatabase";
338 Error(
Here(
here),
"No class defined for data type \"%s\". Programming "
345 Error(
Here(
here),
"Class %s is not a BdataLoc. Programming error. "
398 while(
auto* dataloc =
static_cast<BdataLoc*
>(next()) ) {
399 dataloc->Load( evdata );
415 cout <<
" event types, CODA = " <<
evtype
416 <<
" bit pattern = 0x" << hex <<
evtypebits << dec
420 cout <<
" trigger bits set = ";
424 if( cont ) cout <<
", ";
435 while(
TObject* obj = next() ) {
static const Int_t kRehashLevel
static const Int_t kInitHashCapacity
const ULong_t kBitsPerByte
Option_t Option_t TPoint TPoint const char mode
static const char *const here
static TypeSet_t & fgBdataLocTypes()
virtual Int_t ReadDatabase(const TDatime &date)
virtual Int_t GetConfigstr(FILE *file, const TDatime &date, Int_t db_version, const BdataLoc::BdataLocType &loctype, TString &configstr)
virtual Int_t SetupDBVersion(FILE *file, Int_t db_version)
virtual void Reset(Option_t *opt="")
Int_t DefineLocType(const BdataLoc::BdataLocType &loctype, const TString &configstr, bool re_init)
virtual void Print(Option_t *opt="") const
virtual Int_t Decode(const THaEvData &)
DecData(const char *name="D", const char *description="Raw decoder data")
virtual void Clear(Option_t *opt="")
virtual Int_t DefineVariables(EMode mode=kDefine)
void * New(ENewType defConstructor=kClassNew, Bool_t quiet=kFALSE) const
Bool_t InheritsFrom(const char *cl) const override
TClass * IsA() const override
virtual void SetOwner(Bool_t enable=kTRUE)
virtual Int_t GetSize() const
static Int_t DefineVarsFromList(const void *list, EType type, EMode mode, const char *def_prefix, const TObject *obj, const char *prefix, const char *here, const char *comment_subst="")
virtual const char * Here(const char *) const
const char * GetPrefix() const
virtual FILE * OpenFile(const TDatime &date)
virtual void Print(Option_t *opt="") const
virtual void Clear(Option_t *opt="")
void Clear(Option_t *option="") override
TObject * FindObject(const char *name) const override
void Add(TObject *obj) override
const char * GetName() const override
virtual void Warning(const char *method, const char *msgfmt,...) const
virtual void Error(const char *method, const char *msgfmt,...) const
virtual void Info(const char *method, const char *msgfmt,...) const
const char * Data() const
TObjArray * Tokenize(const TString &delim) const
TString & Prepend(char c, Ssiz_t rep=1)
static Int_t CheckDBVersion(FILE *file)