Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
genie::Registry Class Reference

A registry. Provides the container for algorithm configuration parameters. More...

#include <Registry.h>

Public Member Functions

 Registry ()
 
 Registry (string name, bool isReadOnly=true)
 
 Registry (const Registry &)
 
virtual ~Registry ()
 
Registryoperator= (const Registry &reg)
 
Registryoperator+= (const Registry &reg)
 
void operator() (RgKey key, int item)
 
void operator() (RgKey key, bool item)
 
void operator() (RgKey key, double item)
 
void operator() (RgKey key, const char *item)
 
void operator() (RgKey key, string item)
 
void Lock (void)
 locks the registry More...
 
void UnLock (void)
 unlocks the registry (doesn't unlock items) More...
 
bool IsLocked (void) const
 checks registry lock More...
 
void InhibitItemLocks (void)
 override individual item locks More...
 
void RestoreItemLocks (void)
 restore individual item locks More...
 
bool ItemLocksAreActive (void) const
 check if item locks are active More...
 
void LockItem (RgKey key)
 locks the registry item More...
 
void UnLockItem (RgKey key)
 unlocks the registry item More...
 
bool ItemIsLocked (RgKey key) const
 check item lock More...
 
bool ItemIsLocal (RgKey key) const
 local or global? More...
 
void OverrideGlobalDef (RgKey key)
 let item override global default (i.e. a 'local' item) More...
 
void LinkToGlobalDef (RgKey key)
 link its value to a global default (i.e. a 'global' item) More...
 
void Set (RgIMapPair entry)
 
void Set (RgKey key, RgBool item)
 
void Set (RgKey key, RgInt item)
 
void Set (RgKey key, RgDbl item)
 
void Set (RgKey key, RgStr item)
 
void Set (RgKey key, RgAlg item)
 
void Set (RgKey key, RgCChAr item)
 
void Set (RgKey key, RgH1F item)
 
void Set (RgKey key, RgH2F item)
 
void Set (RgKey key, RgTree item)
 
void Get (RgKey key, const RegistryItemI *&item) const
 
void Get (RgKey key, RgBool &item) const
 
void Get (RgKey key, RgInt &item) const
 
void Get (RgKey key, RgDbl &item) const
 
void Get (RgKey key, RgStr &item) const
 
void Get (RgKey key, RgAlg &item) const
 
void Get (RgKey key, RgH1F &item) const
 
void Get (RgKey key, RgH2F &item) const
 
void Get (RgKey key, RgTree &item) const
 
RgBool GetBool (RgKey key) const
 
RgInt GetInt (RgKey key) const
 
RgDbl GetDouble (RgKey key) const
 
RgStr GetString (RgKey key) const
 
RgAlg GetAlg (RgKey key) const
 
RgH1F GetH1F (RgKey key) const
 
RgH2F GetH2F (RgKey key) const
 
RgTree GetTree (RgKey key) const
 
RgBool GetBoolDef (RgKey key, RgBool def_opt, bool set_def=true)
 
RgInt GetIntDef (RgKey key, RgInt def_opt, bool set_def=true)
 
RgDbl GetDoubleDef (RgKey key, RgDbl def_opt, bool set_def=true)
 
RgStr GetStringDef (RgKey key, RgStr def_opt, bool set_def=true)
 
RgAlg GetAlgDef (RgKey key, RgAlg def_opt, bool set_def=true)
 
RgIMapConstIter SafeFind (RgKey key) const
 
int NEntries (void) const
 get number of items More...
 
bool Exists (RgKey key) const
 item with input key exists? More...
 
bool CanSetItem (RgKey key) const
 can I set the specifed item? More...
 
bool DeleteEntry (RgKey key)
 delete the spcified item More...
 
void SetName (string name)
 set the registry name More...
 
string Name (void) const
 get the registry name More...
 
void Print (ostream &stream) const
 print the registry to stream More...
 
void Copy (const Registry &)
 copy the input registry More...
 
void Append (const Registry &, RgKey pfx="")
 append the input registry. Entries already in the registry are not updated More...
 
void Merge (const Registry &, RgKey pfx="")
 append the input registry. Entries already in the registry are updated More...
 
void Clear (bool force=false)
 clear the registry More...
 
void Init (void)
 initialize the registry More...
 
RgType_t ItemType (RgKey key) const
 return item type More...
 
RgKeyList FindKeys (RgKey key_part) const
 create list with all keys containing 'key_part' More...
 
const RgIMapGetItemMap (void) const
 
void CopyToFolder (TFolder *folder) const
 
void AssertExistence (RgKey key0) const
 
void AssertExistence (RgKey key0, RgKey key1) const
 
void AssertExistence (RgKey key0, RgKey key1, RgKey key2) const
 

Private Member Functions

RegistryItemICloneRegistryItem (const RgKey &key) const
 Properly clone a registry Item according to its type. More...
 

Private Attributes

string fName
 registry's name More...
 
bool fIsReadOnly
 is read only? More...
 
bool fInhibitItemLocks
 
RgIMap fRegistry
 'key' -> 'value' map More...
 

Friends

ostream & operator<< (ostream &stream, const Registry &registry)
 

Detailed Description

A registry. Provides the container for algorithm configuration parameters.

Author
Costas Andreopoulos <constantinos.andreopoulos cern.ch> University of Liverpool & STFC Rutherford Appleton Laboratory

May 04, 2004

Copyright (c) 2003-2020, The GENIE Collaboration For the full text of the license visit http://copyright.genie-mc.org

Definition at line 65 of file Registry.h.

Constructor & Destructor Documentation

Registry::Registry ( )

Definition at line 85 of file Registry.cxx.

86 {
87  this->Init();
88 }
void Init(void)
initialize the registry
Definition: Registry.cxx:855
Registry::Registry ( string  name,
bool  isReadOnly = true 
)

Definition at line 90 of file Registry.cxx.

90  :
91 fName ( name ),
92 fIsReadOnly ( isReadOnly ),
93 fInhibitItemLocks ( false )
94 {
95 
96 }
static QCString name
Definition: declinfo.cpp:673
bool fIsReadOnly
is read only?
Definition: Registry.h:181
bool fInhibitItemLocks
Definition: Registry.h:182
string fName
registry&#39;s name
Definition: Registry.h:180
Registry::Registry ( const Registry registry)

Definition at line 98 of file Registry.cxx.

98  :
99 fName("uninitialised"),
100 fIsReadOnly(false)
101 {
102  this->Copy(registry);
103 }
bool fIsReadOnly
is read only?
Definition: Registry.h:181
void Copy(const Registry &)
copy the input registry
Definition: Registry.cxx:722
string fName
registry&#39;s name
Definition: Registry.h:180
Registry::~Registry ( )
virtual

Definition at line 105 of file Registry.cxx.

106 {
107  this->Clear(true);
108 }
void Clear(bool force=false)
clear the registry
Definition: Registry.cxx:864

Member Function Documentation

void Registry::Append ( const Registry registry,
RgKey  pfx = "" 
)

append the input registry. Entries already in the registry are not updated

Definition at line 743 of file Registry.cxx.

744 {
745 // Appends the input registry entries (& their locks)
746 
747  LOG("Registry", pINFO)
748  << "Appending registry " << registry.Name() << " to " << this->Name();
749 
750  if(this->IsLocked()) {
751  LOG("Registry", pWARN) << "Registry is locked. Can't copy input entries!";
752  return;
753  }
754 
755  this->InhibitItemLocks();
756 
757  RgIMapConstIter reg_iter;
758  for(reg_iter = registry.fRegistry.begin();
759  reg_iter != registry.fRegistry.end(); reg_iter++) {
760 
761  RgKey name = reg_iter->first;
762  RgKey new_name = prefix + name;
763 
764  if ( fRegistry.count( new_name ) > 0 ) continue ;
765 
766  RgType_t type = reg_iter -> second -> TypeInfo();
767  string stype = RgType::AsString(type);
768 
769  LOG("Registry", pINFO)
770  << "Copying [" << stype << "] item named = "
771  << name << " as " << new_name;
772 
773  RegistryItemI * cri = registry.CloneRegistryItem( name ) ; // cloned registry item
774 
775  RgIMapPair reg_entry(new_name, cri);
776 
777  if ( ! fRegistry.insert(reg_entry).second ) {
778  // The registry already contained an entry with key new_name
779  // so the new registryItem has to be deleted or we leak memory.
780  // This should not happened as a check is performed
781  LOG("Registry", pERROR ) << "Failing to insert item " << new_name ;
782  delete cri ;
783  }
784  } // loop on the incoming registry items
785 }
static QCString name
Definition: declinfo.cpp:673
static string AsString(RgType_t rt)
bool IsLocked(void) const
checks registry lock
Definition: Registry.cxx:158
#define pERROR
Definition: Messenger.h:59
void InhibitItemLocks(void)
override individual item locks
Definition: Registry.cxx:163
Registry item pABC.
Definition: RegistryItemI.h:29
string Name(void) const
get the registry name
Definition: Registry.cxx:597
enum genie::ERgType RgType_t
map< RgKey, RegistryItemI * >::const_iterator RgIMapConstIter
Definition: Registry.h:49
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
RgIMap fRegistry
&#39;key&#39; -> &#39;value&#39; map
Definition: Registry.h:183
#define pINFO
Definition: Messenger.h:62
pair< RgKey, RegistryItemI * > RgIMapPair
Definition: Registry.h:46
#define pWARN
Definition: Messenger.h:60
string RgKey
second_as<> second
Type of time stored in seconds, in double precision.
Definition: spacetime.h:85
RegistryItemI * CloneRegistryItem(const RgKey &key) const
Properly clone a registry Item according to its type.
Definition: Registry.cxx:890
void Registry::AssertExistence ( RgKey  key0) const

Definition at line 602 of file Registry.cxx.

603 {
604  if ( ! this->Exists(key0) ) {
605  LOG("Registry", pERROR) << (*this);
606  LOG("Registry", pFATAL)
607  << "*** Key: " << key0
608  << " does not exist in registry: " << this->Name();
609  exit(1);
610  }
611 }
#define pERROR
Definition: Messenger.h:59
#define pFATAL
Definition: Messenger.h:56
string Name(void) const
get the registry name
Definition: Registry.cxx:597
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
bool Exists(RgKey key) const
item with input key exists?
Definition: Registry.cxx:563
void Registry::AssertExistence ( RgKey  key0,
RgKey  key1 
) const

Definition at line 613 of file Registry.cxx.

614 {
615  this->AssertExistence(key0);
616  this->AssertExistence(key1);
617 }
void AssertExistence(RgKey key0) const
Definition: Registry.cxx:602
void Registry::AssertExistence ( RgKey  key0,
RgKey  key1,
RgKey  key2 
) const

Definition at line 619 of file Registry.cxx.

620 {
621  this->AssertExistence(key0);
622  this->AssertExistence(key1);
623  this->AssertExistence(key2);
624 }
void AssertExistence(RgKey key0) const
Definition: Registry.cxx:602
bool Registry::CanSetItem ( RgKey  key) const

can I set the specifed item?

Definition at line 256 of file Registry.cxx.

257 {
258  bool locked_item = this->ItemIsLocked(key);
259  bool active_item_locks = this->ItemLocksAreActive();
260  bool locked_registry = this->IsLocked();
261 
262  bool can_set = !locked_registry && ( !locked_item || !active_item_locks );
263 
264  return can_set;
265 }
bool IsLocked(void) const
checks registry lock
Definition: Registry.cxx:158
bool ItemLocksAreActive(void) const
check if item locks are active
Definition: Registry.cxx:173
def key(type, name=None)
Definition: graph.py:13
bool ItemIsLocked(RgKey key) const
check item lock
Definition: Registry.cxx:218
void Registry::Clear ( bool  force = false)

clear the registry

Definition at line 864 of file Registry.cxx.

865 {
866 // clean all registry entries
867 
868  LOG("Registry", pINFO)
869  << "Cleaning-up [force unlock = " << ((force)?"true":"false")
870  << "] registry: " << this->Name();
871  if(!force) {
872  if(this->IsLocked()) {
873  LOG("Registry", pWARN) << "Registry is locked. Can't clear its entries";
874  return;
875  }
876  }
877  RgIMapIter rit;
878  for(rit = fRegistry.begin(); rit != fRegistry.end(); rit++) {
879  RgKey name = rit->first;
880  RegistryItemI * item = rit->second;
881  if(!item) {
882  LOG("Registry", pWARN) << "Item with key = " << name << " is null!";
883  }
884  delete item;
885  item = 0;
886  }
887  fRegistry.clear();
888 }
static QCString name
Definition: declinfo.cpp:673
bool IsLocked(void) const
checks registry lock
Definition: Registry.cxx:158
Registry item pABC.
Definition: RegistryItemI.h:29
string Name(void) const
get the registry name
Definition: Registry.cxx:597
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
RgIMap fRegistry
&#39;key&#39; -> &#39;value&#39; map
Definition: Registry.h:183
#define pINFO
Definition: Messenger.h:62
#define pWARN
Definition: Messenger.h:60
string RgKey
map< RgKey, RegistryItemI * >::iterator RgIMapIter
Definition: Registry.h:48
RegistryItemI * Registry::CloneRegistryItem ( const RgKey key) const
private

Properly clone a registry Item according to its type.

Definition at line 890 of file Registry.cxx.

890  {
891 
893 
894  if ( it == fRegistry.end() ) {
895  LOG("Registry", pFATAL) << "Item " << key << " not found while cloning for registry " << Name() ;
896  exit( 0 ) ;
897  }
898 
899  RegistryItemI * ri = it -> second ;
900 
901  bool ilk = ri->IsLocked();
902  RgType_t type = ri->TypeInfo();
903  string stype = RgType::AsString(type);
904 
905  RegistryItemI * cri = 0; // cloned registry item
906  if (type == kRgBool)
907  cri = new RegistryItem<RgBool>( GetBool(key), ilk);
908  else if (type == kRgDbl)
909  cri = new RegistryItem<RgDbl> ( GetDouble(key), ilk);
910  else if (type == kRgInt)
911  cri = new RegistryItem<RgInt> ( GetInt(key), ilk);
912  else if (type == kRgStr)
913  cri = new RegistryItem<RgStr> ( GetString(key), ilk);
914  else if (type == kRgAlg)
915  cri = new RegistryItem<RgAlg> ( GetAlg(key), ilk);
916  else if (type == kRgH1F) {
917  RgH1F histo = GetH1F(key);
918  if(histo) {
919  RgH1F chisto = new TH1F(*histo);
920  LOG("Registry", pDEBUG) << chisto->GetName();
921  cri = new RegistryItem<RgH1F>(chisto,ilk);
922  } else {
923  LOG("Registry", pERROR)
924  << "Null TH1F with key = " << key << " - not copied";
925  }
926  } else if (type == kRgH2F) {
927  RgH2F histo = GetH2F(key);
928  if(histo) {
929  RgH2F chisto = new TH2F(*histo);
930  LOG("Registry", pDEBUG) << chisto->GetName();
931  cri = new RegistryItem<RgH2F>(chisto,ilk);
932  } else {
933  LOG("Registry", pERROR)
934  << "Null TH2F with key = " << key << " - not copied";
935  }
936  } else if (type == kRgTree) {
937  RgTree tree = GetTree(key);
938  if(tree) {
939  //TTree * ctree = new TTree(*tree);
940  TTree * ctree = tree->CopyTree("1");
941  LOG("Registry", pDEBUG) << ctree->GetName();
942  cri = new RegistryItem<RgTree>(ctree,ilk);
943  } else {
944  LOG("Registry", pERROR)
945  << "Null TTree with key = " << key << " - not copied";
946  }
947  } else {
948 
949  LOG( "Registry", pFATAL ) << "Item " << key << " not cloned because its type is not implemented " ;
950  exit( 0 ) ;
951  }
952 
953  return cri ;
954 
955 }
static string AsString(RgType_t rt)
#define pERROR
Definition: Messenger.h:59
virtual bool IsLocked(void) const =0
#define pFATAL
Definition: Messenger.h:56
intermediate_table::const_iterator const_iterator
RgDbl GetDouble(RgKey key) const
Definition: Registry.cxx:474
RgInt GetInt(RgKey key) const
Definition: Registry.cxx:467
Registry item pABC.
Definition: RegistryItemI.h:29
TH2F * RgH2F
string Name(void) const
get the registry name
Definition: Registry.cxx:597
RgH1F GetH1F(RgKey key) const
Definition: Registry.cxx:495
enum genie::ERgType RgType_t
virtual RgType_t TypeInfo(void) const =0
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
def key(type, name=None)
Definition: graph.py:13
RgIMap fRegistry
&#39;key&#39; -> &#39;value&#39; map
Definition: Registry.h:183
RgStr GetString(RgKey key) const
Definition: Registry.cxx:481
TH1F * RgH1F
RgBool GetBool(RgKey key) const
Definition: Registry.cxx:460
RgTree GetTree(RgKey key) const
Definition: Registry.cxx:515
A templated concrete implementation of the RegistryItemI interface. Provides an arbitrary basic type ...
Definition: RegistryItem.h:32
RgH2F GetH2F(RgKey key) const
Definition: Registry.cxx:505
second_as<> second
Type of time stored in seconds, in double precision.
Definition: spacetime.h:85
RgAlg GetAlg(RgKey key) const
Definition: Registry.cxx:488
#define pDEBUG
Definition: Messenger.h:63
TTree * RgTree
void Registry::Copy ( const Registry registry)

copy the input registry

Definition at line 722 of file Registry.cxx.

723 {
724 // Copies the input registry
725 //
726  LOG("Registry", pINFO)
727  << "Copying registry " << registry.Name() << " to " << this->Name();
728 
729  if(this->IsLocked()) {
730  LOG("Registry", pWARN) << "Registry is locked. Can't copy input entries!";
731  return;
732  }
733 
734  this->Init();
735  this->Clear();
736  this->Append(registry);
737 
738  fName = registry.fName;
739  fIsReadOnly = registry.fIsReadOnly;
741 }
bool fIsReadOnly
is read only?
Definition: Registry.h:181
bool IsLocked(void) const
checks registry lock
Definition: Registry.cxx:158
void Append(const Registry &, RgKey pfx="")
append the input registry. Entries already in the registry are not updated
Definition: Registry.cxx:743
string Name(void) const
get the registry name
Definition: Registry.cxx:597
void Init(void)
initialize the registry
Definition: Registry.cxx:855
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
#define pINFO
Definition: Messenger.h:62
bool fInhibitItemLocks
Definition: Registry.h:182
#define pWARN
Definition: Messenger.h:60
string fName
registry&#39;s name
Definition: Registry.h:180
void Clear(bool force=false)
clear the registry
Definition: Registry.cxx:864
void Registry::CopyToFolder ( TFolder *  folder) const

Definition at line 626 of file Registry.cxx.

627 {
628  LOG("Registry", pINFO) << "Converting Registry to TFolder";
629 
630  folder->SetOwner(true);
631 
632  RgIMapConstIter reg_iter;
633 
634  for(reg_iter = this->fRegistry.begin();
635  reg_iter != this->fRegistry.end(); reg_iter++) {
636 
637  ostringstream entry;
638  string key = reg_iter->first;
639  RegistryItemI * ritem = reg_iter->second;
640 
641  RgType_t type = ritem->TypeInfo();
642  string stype = RgType::AsString(type);
643 
644  entry << "key:" << key << ";type:" << stype;
645 
646  if(type == kRgBool) {
647  entry << ";value: " << this->GetBool(key);
648  LOG("Registry", pINFO) << "entry = " << entry.str();
649  folder->Add(new TObjString(entry.str().c_str()));
650  }
651  else if (type == kRgDbl) {
652  entry << ";value: " << this->GetDouble(key);
653  LOG("Registry", pINFO) << "entry = " << entry.str();
654  folder->Add(new TObjString(entry.str().c_str()));
655  }
656  else if (type == kRgInt) {
657  entry << ";value: " << this->GetInt(key);
658  LOG("Registry", pINFO) << "entry = " << entry.str();
659  folder->Add(new TObjString(entry.str().c_str()));
660  }
661  else if (type == kRgStr) {
662  entry << ";value: " << this->GetString(key);
663  LOG("Registry", pINFO) << "entry = " << entry.str();
664  folder->Add(new TObjString(entry.str().c_str()));
665  }
666  else if (type == kRgAlg) {
667  entry << ";value: " << this->GetAlg(key).name
668  << "/" << this->GetAlg(key).config;
669  LOG("Registry", pINFO) << "entry = " << entry.str();
670  folder->Add(new TObjString(entry.str().c_str()));
671 
672  } else if (type == kRgH1F) {
673  } else if (type == kRgH2F) {
674  } else if (type == kRgTree) {
675  } else {}
676  }// registry iterator
677 }
static string AsString(RgType_t rt)
QList< Entry > entry
RgDbl GetDouble(RgKey key) const
Definition: Registry.cxx:474
RgInt GetInt(RgKey key) const
Definition: Registry.cxx:467
Registry item pABC.
Definition: RegistryItemI.h:29
enum genie::ERgType RgType_t
virtual RgType_t TypeInfo(void) const =0
map< RgKey, RegistryItemI * >::const_iterator RgIMapConstIter
Definition: Registry.h:49
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
def key(type, name=None)
Definition: graph.py:13
RgIMap fRegistry
&#39;key&#39; -> &#39;value&#39; map
Definition: Registry.h:183
#define pINFO
Definition: Messenger.h:62
RgStr GetString(RgKey key) const
Definition: Registry.cxx:481
RgBool GetBool(RgKey key) const
Definition: Registry.cxx:460
string config
RgAlg GetAlg(RgKey key) const
Definition: Registry.cxx:488
bool Registry::DeleteEntry ( RgKey  key)

delete the spcified item

Definition at line 569 of file Registry.cxx.

570 {
571  if(!fIsReadOnly && Exists(key)) {
572  RgIMapIter entry = fRegistry.find(key);
573  RegistryItemI * item = entry->second;
574  delete item;
575  item = 0;
576  fRegistry.erase(entry);
577  return true;
578  }
579  return false;
580 }
bool fIsReadOnly
is read only?
Definition: Registry.h:181
QList< Entry > entry
Registry item pABC.
Definition: RegistryItemI.h:29
def key(type, name=None)
Definition: graph.py:13
RgIMap fRegistry
&#39;key&#39; -> &#39;value&#39; map
Definition: Registry.h:183
map< RgKey, RegistryItemI * >::iterator RgIMapIter
Definition: Registry.h:48
bool Exists(RgKey key) const
item with input key exists?
Definition: Registry.cxx:563
bool Registry::Exists ( RgKey  key) const

item with input key exists?

Definition at line 563 of file Registry.cxx.

564 {
566  return (entry!=fRegistry.end());
567 }
QList< Entry > entry
map< RgKey, RegistryItemI * >::const_iterator RgIMapConstIter
Definition: Registry.h:49
def key(type, name=None)
Definition: graph.py:13
RgIMap fRegistry
&#39;key&#39; -> &#39;value&#39; map
Definition: Registry.h:183
RgKeyList Registry::FindKeys ( RgKey  key_part) const

create list with all keys containing 'key_part'

Definition at line 840 of file Registry.cxx.

841 {
842  RgKeyList klist;
843 
844  RgIMapConstIter reg_iter = fRegistry.begin();
845  for( ; reg_iter != fRegistry.end(); reg_iter++) {
846  RgKey key = reg_iter->first;
847  if (key.find(key_part) != string::npos) {
848  klist.push_back(key);
849  }
850  }
851 
852  return klist;
853 }
map< RgKey, RegistryItemI * >::const_iterator RgIMapConstIter
Definition: Registry.h:49
def key(type, name=None)
Definition: graph.py:13
RgIMap fRegistry
&#39;key&#39; -> &#39;value&#39; map
Definition: Registry.h:183
vector< RgKey > RgKeyList
Definition: Registry.h:50
string RgKey
void Registry::Get ( RgKey  key,
const RegistryItemI *&  item 
) const

Definition at line 325 of file Registry.cxx.

326 {
328  item = entry->second;
329 }
QList< Entry > entry
map< RgKey, RegistryItemI * >::const_iterator RgIMapConstIter
Definition: Registry.h:49
def key(type, name=None)
Definition: graph.py:13
RgIMapConstIter SafeFind(RgKey key) const
Definition: Registry.cxx:550
void Registry::Get ( RgKey  key,
RgBool item 
) const

Definition at line 331 of file Registry.cxx.

332 {
333 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
334  LOG("Registry", pDEBUG) << "Get an RgBool item with key: " << key;
335 #endif
336 
338  RegistryItemI * rib = entry->second;
339  RegistryItem<RgBool> * ri = dynamic_cast<RegistryItem<RgBool>*> (rib);
340 
341 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
342  LOG("Registry", pDEBUG) << "Item value = " << ri->Data();
343 #endif
344  item = ri->Data();
345 }
QList< Entry > entry
const T & Data(void) const
Definition: RegistryItem.h:46
Registry item pABC.
Definition: RegistryItemI.h:29
map< RgKey, RegistryItemI * >::const_iterator RgIMapConstIter
Definition: Registry.h:49
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
def key(type, name=None)
Definition: graph.py:13
RgIMapConstIter SafeFind(RgKey key) const
Definition: Registry.cxx:550
A templated concrete implementation of the RegistryItemI interface. Provides an arbitrary basic type ...
Definition: RegistryItem.h:32
#define pDEBUG
Definition: Messenger.h:63
void genie::Registry::Get ( RgKey  key,
RgInt item 
) const
void Registry::Get ( RgKey  key,
RgDbl item 
) const

Definition at line 363 of file Registry.cxx.

364 {
365 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
366  LOG("Registry", pDEBUG) << "Getting an RgDbl item with key: " << key;
367 #endif
368 
370  RegistryItemI * rib = entry->second;
371  RegistryItem<RgDbl> * ri = dynamic_cast<RegistryItem<RgDbl>*> (rib);
372 
373 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
374  LOG("Registry", pDEBUG) << "Item value = " << ri->Data();
375 #endif
376  item = ri->Data();
377 }
QList< Entry > entry
const T & Data(void) const
Definition: RegistryItem.h:46
Registry item pABC.
Definition: RegistryItemI.h:29
map< RgKey, RegistryItemI * >::const_iterator RgIMapConstIter
Definition: Registry.h:49
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
def key(type, name=None)
Definition: graph.py:13
RgIMapConstIter SafeFind(RgKey key) const
Definition: Registry.cxx:550
A templated concrete implementation of the RegistryItemI interface. Provides an arbitrary basic type ...
Definition: RegistryItem.h:32
#define pDEBUG
Definition: Messenger.h:63
void Registry::Get ( RgKey  key,
RgStr item 
) const

Definition at line 379 of file Registry.cxx.

380 {
381 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
382  LOG("Registry", pDEBUG) << "Getting an RgStr item with key: " << key;
383 #endif
384 
386  RegistryItemI * rib = entry->second;
387  RegistryItem<RgStr> * ri = dynamic_cast<RegistryItem<RgStr>*> (rib);
388 
389 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
390  LOG("Registry", pDEBUG) << "Item value = " << ri->Data();
391 #endif
392  item = ri->Data();
393 }
QList< Entry > entry
const T & Data(void) const
Definition: RegistryItem.h:46
Registry item pABC.
Definition: RegistryItemI.h:29
map< RgKey, RegistryItemI * >::const_iterator RgIMapConstIter
Definition: Registry.h:49
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
def key(type, name=None)
Definition: graph.py:13
RgIMapConstIter SafeFind(RgKey key) const
Definition: Registry.cxx:550
A templated concrete implementation of the RegistryItemI interface. Provides an arbitrary basic type ...
Definition: RegistryItem.h:32
#define pDEBUG
Definition: Messenger.h:63
void Registry::Get ( RgKey  key,
RgAlg item 
) const

Definition at line 395 of file Registry.cxx.

396 {
397 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
398  LOG("Registry", pDEBUG) << "Getting an RgAlg item with key: " << key;
399 #endif
400 
402  RegistryItemI * rib = entry->second;
403  RegistryItem<RgAlg> * ri = dynamic_cast<RegistryItem<RgAlg>*> (rib);
404 
405 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
406  LOG("Registry", pDEBUG) << "Item value = " << ri->Data();
407 #endif
408 
409  item = ri->Data();
410 }
QList< Entry > entry
const T & Data(void) const
Definition: RegistryItem.h:46
Registry item pABC.
Definition: RegistryItemI.h:29
map< RgKey, RegistryItemI * >::const_iterator RgIMapConstIter
Definition: Registry.h:49
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
def key(type, name=None)
Definition: graph.py:13
RgIMapConstIter SafeFind(RgKey key) const
Definition: Registry.cxx:550
A templated concrete implementation of the RegistryItemI interface. Provides an arbitrary basic type ...
Definition: RegistryItem.h:32
#define pDEBUG
Definition: Messenger.h:63
void Registry::Get ( RgKey  key,
RgH1F item 
) const

Definition at line 412 of file Registry.cxx.

413 {
414 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
415  LOG("Registry", pDEBUG) << "Getting an RgH1F item with key: " << key;
416 #endif
417 
419  RegistryItemI * rib = entry->second;
420  RegistryItem<RgH1F> *ri = dynamic_cast<RegistryItem<RgH1F>*> (rib);
421  item = ri->Data();
422 
423  if(!item) {
424  LOG("Registry", pWARN) << "Returned NULL ptr for TH1F param = " << key;
425  }
426 }
QList< Entry > entry
const T & Data(void) const
Definition: RegistryItem.h:46
Registry item pABC.
Definition: RegistryItemI.h:29
map< RgKey, RegistryItemI * >::const_iterator RgIMapConstIter
Definition: Registry.h:49
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
def key(type, name=None)
Definition: graph.py:13
RgIMapConstIter SafeFind(RgKey key) const
Definition: Registry.cxx:550
#define pWARN
Definition: Messenger.h:60
A templated concrete implementation of the RegistryItemI interface. Provides an arbitrary basic type ...
Definition: RegistryItem.h:32
#define pDEBUG
Definition: Messenger.h:63
void Registry::Get ( RgKey  key,
RgH2F item 
) const

Definition at line 428 of file Registry.cxx.

429 {
430 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
431  LOG("Registry", pDEBUG) << "Getting an RgH2F item with key: " << key;
432 #endif
433 
435  RegistryItemI * rib = entry->second;
436  RegistryItem<RgH2F> *ri = dynamic_cast<RegistryItem<RgH2F>*> (rib);
437  item = ri->Data();
438 
439  if(!item) {
440  LOG("Registry", pWARN) << "Returned NULL ptr for TH2F param = " << key;
441  }
442 }
QList< Entry > entry
const T & Data(void) const
Definition: RegistryItem.h:46
Registry item pABC.
Definition: RegistryItemI.h:29
map< RgKey, RegistryItemI * >::const_iterator RgIMapConstIter
Definition: Registry.h:49
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
def key(type, name=None)
Definition: graph.py:13
RgIMapConstIter SafeFind(RgKey key) const
Definition: Registry.cxx:550
#define pWARN
Definition: Messenger.h:60
A templated concrete implementation of the RegistryItemI interface. Provides an arbitrary basic type ...
Definition: RegistryItem.h:32
#define pDEBUG
Definition: Messenger.h:63
void Registry::Get ( RgKey  key,
RgTree item 
) const

Definition at line 444 of file Registry.cxx.

445 {
446 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
447  LOG("Registry", pDEBUG) << "Getting an RgTree item with key: " << key;
448 #endif
449 
451  RegistryItemI * rib = entry->second;
452  RegistryItem<RgTree> *ri = dynamic_cast<RegistryItem<RgTree>*> (rib);
453  item = ri->Data();
454 
455  if(!item) {
456  LOG("Registry", pWARN) << "Returned NULL ptr for TTree param = " << key;
457  }
458 }
QList< Entry > entry
const T & Data(void) const
Definition: RegistryItem.h:46
Registry item pABC.
Definition: RegistryItemI.h:29
map< RgKey, RegistryItemI * >::const_iterator RgIMapConstIter
Definition: Registry.h:49
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
def key(type, name=None)
Definition: graph.py:13
RgIMapConstIter SafeFind(RgKey key) const
Definition: Registry.cxx:550
#define pWARN
Definition: Messenger.h:60
A templated concrete implementation of the RegistryItemI interface. Provides an arbitrary basic type ...
Definition: RegistryItem.h:32
#define pDEBUG
Definition: Messenger.h:63
RgAlg Registry::GetAlg ( RgKey  key) const

Definition at line 488 of file Registry.cxx.

489 {
490  RgAlg value;
491  this->Get(key, value);
492  return value;
493 }
void Get(RgKey key, const RegistryItemI *&item) const
Definition: Registry.cxx:325
def key(type, name=None)
Definition: graph.py:13
RgAlg Registry::GetAlgDef ( RgKey  key,
RgAlg  def_opt,
bool  set_def = true 
)

Definition at line 545 of file Registry.cxx.

546 {
547  return GetValueOrUseDefault(this, key, def_opt, set_def);
548 }
T GetValueOrUseDefault(Registry *r, RgKey key, T def, bool set_def)
Definition: Registry.cxx:51
def key(type, name=None)
Definition: graph.py:13
RgBool Registry::GetBool ( RgKey  key) const

Definition at line 460 of file Registry.cxx.

461 {
462  RgBool value;
463  this->Get(key, value);
464  return value;
465 }
bool RgBool
void Get(RgKey key, const RegistryItemI *&item) const
Definition: Registry.cxx:325
def key(type, name=None)
Definition: graph.py:13
RgBool Registry::GetBoolDef ( RgKey  key,
RgBool  def_opt,
bool  set_def = true 
)

Definition at line 525 of file Registry.cxx.

526 {
527  return GetValueOrUseDefault(this, key, def_opt, set_def);
528 }
T GetValueOrUseDefault(Registry *r, RgKey key, T def, bool set_def)
Definition: Registry.cxx:51
def key(type, name=None)
Definition: graph.py:13
RgDbl Registry::GetDouble ( RgKey  key) const

Definition at line 474 of file Registry.cxx.

475 {
476  RgDbl value;
477  this->Get(key, value);
478  return value;
479 }
void Get(RgKey key, const RegistryItemI *&item) const
Definition: Registry.cxx:325
def key(type, name=None)
Definition: graph.py:13
double RgDbl
double Registry::GetDoubleDef ( RgKey  key,
RgDbl  def_opt,
bool  set_def = true 
)

Definition at line 535 of file Registry.cxx.

536 {
537  return GetValueOrUseDefault(this, key, def_opt, set_def);
538 }
T GetValueOrUseDefault(Registry *r, RgKey key, T def, bool set_def)
Definition: Registry.cxx:51
def key(type, name=None)
Definition: graph.py:13
RgH1F Registry::GetH1F ( RgKey  key) const

Definition at line 495 of file Registry.cxx.

496 {
498  RegistryItemI * rib = entry->second;
499  RegistryItem<RgH1F> *ri = dynamic_cast<RegistryItem<RgH1F>*> (rib);
500 
501  RgH1F item = ri->Data();
502  return item;
503 }
QList< Entry > entry
const T & Data(void) const
Definition: RegistryItem.h:46
Registry item pABC.
Definition: RegistryItemI.h:29
map< RgKey, RegistryItemI * >::const_iterator RgIMapConstIter
Definition: Registry.h:49
def key(type, name=None)
Definition: graph.py:13
RgIMap fRegistry
&#39;key&#39; -> &#39;value&#39; map
Definition: Registry.h:183
TH1F * RgH1F
A templated concrete implementation of the RegistryItemI interface. Provides an arbitrary basic type ...
Definition: RegistryItem.h:32
RgH2F Registry::GetH2F ( RgKey  key) const

Definition at line 505 of file Registry.cxx.

506 {
508  RegistryItemI * rib = entry->second;
509  RegistryItem<RgH2F> *ri = dynamic_cast<RegistryItem<RgH2F>*> (rib);
510 
511  RgH2F item = ri->Data();
512  return item;
513 }
QList< Entry > entry
const T & Data(void) const
Definition: RegistryItem.h:46
Registry item pABC.
Definition: RegistryItemI.h:29
TH2F * RgH2F
map< RgKey, RegistryItemI * >::const_iterator RgIMapConstIter
Definition: Registry.h:49
def key(type, name=None)
Definition: graph.py:13
RgIMap fRegistry
&#39;key&#39; -> &#39;value&#39; map
Definition: Registry.h:183
A templated concrete implementation of the RegistryItemI interface. Provides an arbitrary basic type ...
Definition: RegistryItem.h:32
RgInt Registry::GetInt ( RgKey  key) const

Definition at line 467 of file Registry.cxx.

468 {
469  RgInt value;
470  this->Get(key, value);
471  return value;
472 }
int RgInt
void Get(RgKey key, const RegistryItemI *&item) const
Definition: Registry.cxx:325
def key(type, name=None)
Definition: graph.py:13
int Registry::GetIntDef ( RgKey  key,
RgInt  def_opt,
bool  set_def = true 
)

Definition at line 530 of file Registry.cxx.

531 {
532  return GetValueOrUseDefault(this, key, def_opt, set_def);
533 }
T GetValueOrUseDefault(Registry *r, RgKey key, T def, bool set_def)
Definition: Registry.cxx:51
def key(type, name=None)
Definition: graph.py:13
const RgIMap& genie::Registry::GetItemMap ( void  ) const
inline

Definition at line 161 of file Registry.h.

161 { return fRegistry; }
RgIMap fRegistry
&#39;key&#39; -> &#39;value&#39; map
Definition: Registry.h:183
RgStr Registry::GetString ( RgKey  key) const

Definition at line 481 of file Registry.cxx.

482 {
483  RgStr value;
484  this->Get(key, value);
485  return value;
486 }
void Get(RgKey key, const RegistryItemI *&item) const
Definition: Registry.cxx:325
def key(type, name=None)
Definition: graph.py:13
string RgStr
string Registry::GetStringDef ( RgKey  key,
RgStr  def_opt,
bool  set_def = true 
)

Definition at line 540 of file Registry.cxx.

541 {
542  return GetValueOrUseDefault(this, key, def_opt, set_def);
543 }
T GetValueOrUseDefault(Registry *r, RgKey key, T def, bool set_def)
Definition: Registry.cxx:51
def key(type, name=None)
Definition: graph.py:13
RgTree Registry::GetTree ( RgKey  key) const

Definition at line 515 of file Registry.cxx.

516 {
518  RegistryItemI * rib = entry->second;
519  RegistryItem<RgTree> *ri = dynamic_cast<RegistryItem<RgTree>*> (rib);
520 
521  RgTree item = ri->Data();
522  return item;
523 }
QList< Entry > entry
const T & Data(void) const
Definition: RegistryItem.h:46
Registry item pABC.
Definition: RegistryItemI.h:29
map< RgKey, RegistryItemI * >::const_iterator RgIMapConstIter
Definition: Registry.h:49
def key(type, name=None)
Definition: graph.py:13
RgIMap fRegistry
&#39;key&#39; -> &#39;value&#39; map
Definition: Registry.h:183
A templated concrete implementation of the RegistryItemI interface. Provides an arbitrary basic type ...
Definition: RegistryItem.h:32
TTree * RgTree
void Registry::InhibitItemLocks ( void  )

override individual item locks

Definition at line 163 of file Registry.cxx.

164 {
165  fInhibitItemLocks = true;
166 }
bool fInhibitItemLocks
Definition: Registry.h:182
void Registry::Init ( void  )

initialize the registry

Definition at line 855 of file Registry.cxx.

856 {
857 // initialize registry properties
858 
859  fName = "NoName";
860  fIsReadOnly = false;
861  fInhibitItemLocks = false;
862 }
bool fIsReadOnly
is read only?
Definition: Registry.h:181
bool fInhibitItemLocks
Definition: Registry.h:182
string fName
registry&#39;s name
Definition: Registry.h:180
bool Registry::IsLocked ( void  ) const

checks registry lock

Definition at line 158 of file Registry.cxx.

159 {
160  return fIsReadOnly;
161 }
bool fIsReadOnly
is read only?
Definition: Registry.h:181
bool Registry::ItemIsLocal ( RgKey  key) const

local or global?

Definition at line 178 of file Registry.cxx.

179 {
180  if( this->Exists(key) ) {
182  bool is_local = entry->second->IsLocal();
183  return is_local;
184  } else {
185 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
186  LOG("Registry", pDEBUG)
187  << "*** Was asked to check 'local' flag on non-existing item: ["
188  << key << "]";
189 #endif
190  }
191  return false;
192 }
QList< Entry > entry
map< RgKey, RegistryItemI * >::const_iterator RgIMapConstIter
Definition: Registry.h:49
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
def key(type, name=None)
Definition: graph.py:13
RgIMap fRegistry
&#39;key&#39; -> &#39;value&#39; map
Definition: Registry.h:183
bool Exists(RgKey key) const
item with input key exists?
Definition: Registry.cxx:563
#define pDEBUG
Definition: Messenger.h:63
bool Registry::ItemIsLocked ( RgKey  key) const

check item lock

Definition at line 218 of file Registry.cxx.

219 {
220  if( this->Exists(key) ) {
222  bool is_locked = entry->second->IsLocked();
223  return is_locked;
224  } else {
225 /*
226  LOG("Registry", pDEBUG)
227  << "*** Was asked to check lock on non-existing item: ["
228  << key << "]";
229 */
230  }
231  return false;
232 }
QList< Entry > entry
map< RgKey, RegistryItemI * >::const_iterator RgIMapConstIter
Definition: Registry.h:49
def key(type, name=None)
Definition: graph.py:13
RgIMap fRegistry
&#39;key&#39; -> &#39;value&#39; map
Definition: Registry.h:183
bool Exists(RgKey key) const
item with input key exists?
Definition: Registry.cxx:563
bool Registry::ItemLocksAreActive ( void  ) const

check if item locks are active

Definition at line 173 of file Registry.cxx.

174 {
175  return !fInhibitItemLocks;
176 }
bool fInhibitItemLocks
Definition: Registry.h:182
RgType_t Registry::ItemType ( RgKey  key) const

return item type

Definition at line 829 of file Registry.cxx.

830 {
831  RgIMapConstIter reg_iter = fRegistry.find(key);
832  if(reg_iter != fRegistry.end()) {
833  RegistryItemI * ri = reg_iter->second;
834  RgType_t type = ri->TypeInfo();
835  return type;
836  }
837  return kRgUndefined;
838 }
Registry item pABC.
Definition: RegistryItemI.h:29
enum genie::ERgType RgType_t
virtual RgType_t TypeInfo(void) const =0
map< RgKey, RegistryItemI * >::const_iterator RgIMapConstIter
Definition: Registry.h:49
def key(type, name=None)
Definition: graph.py:13
RgIMap fRegistry
&#39;key&#39; -> &#39;value&#39; map
Definition: Registry.h:183
static QCString type
Definition: declinfo.cpp:672
void Registry::LinkToGlobalDef ( RgKey  key)

link its value to a global default (i.e. a 'global' item)

Definition at line 206 of file Registry.cxx.

207 {
208  if( this->Exists(key) ) {
210  entry->second->SetLocal(false);
211  } else {
212  LOG("Registry", pWARN)
213  << "*** Can't give 'global' status to non-existem item ["
214  << key << "]";
215  }
216 }
QList< Entry > entry
map< RgKey, RegistryItemI * >::const_iterator RgIMapConstIter
Definition: Registry.h:49
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
def key(type, name=None)
Definition: graph.py:13
RgIMap fRegistry
&#39;key&#39; -> &#39;value&#39; map
Definition: Registry.h:183
#define pWARN
Definition: Messenger.h:60
bool Exists(RgKey key) const
item with input key exists?
Definition: Registry.cxx:563
void Registry::Lock ( void  )

locks the registry

Definition at line 148 of file Registry.cxx.

149 {
150  fIsReadOnly = true;
151 }
bool fIsReadOnly
is read only?
Definition: Registry.h:181
void Registry::LockItem ( RgKey  key)

locks the registry item

Definition at line 234 of file Registry.cxx.

235 {
236  if( this->Exists(key) ) {
238  entry->second->Lock();
239  } else {
240  LOG("Registry", pWARN)
241  << "*** Can't lock non-existem item [" << key << "]";
242  }
243 }
QList< Entry > entry
map< RgKey, RegistryItemI * >::const_iterator RgIMapConstIter
Definition: Registry.h:49
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
def key(type, name=None)
Definition: graph.py:13
RgIMap fRegistry
&#39;key&#39; -> &#39;value&#39; map
Definition: Registry.h:183
#define pWARN
Definition: Messenger.h:60
bool Exists(RgKey key) const
item with input key exists?
Definition: Registry.cxx:563
void Registry::Merge ( const Registry registry,
RgKey  pfx = "" 
)

append the input registry. Entries already in the registry are updated

Definition at line 787 of file Registry.cxx.

788 {
789 // Add the input registry entries (& their locks)
790 // and updated entries already present
791 
792  LOG("Registry", pINFO)
793  << "Appending registry " << registry.Name() << " to " << this->Name();
794 
795  if(this->IsLocked()) {
796  LOG("Registry", pWARN) << "Registry is locked. Can't copy input entries!";
797  return;
798  }
799 
800  this->InhibitItemLocks();
801 
802  RgIMapConstIter reg_iter;
803  for(reg_iter = registry.fRegistry.begin();
804  reg_iter != registry.fRegistry.end(); reg_iter++) {
805 
806  RgKey name = reg_iter->first;
807  RgKey new_name = prefix + name;
808 
809  RgType_t type = reg_iter -> second -> TypeInfo();
810  string stype = RgType::AsString(type);
811 
812  LOG("Registry", pINFO)
813  << "Copying [" << stype << "] item named = "
814  << name << " as " << new_name;
815 
816  RegistryItemI * cri = registry.CloneRegistryItem( name ) ; // cloned registry item
817 
818  if ( fRegistry.count( new_name ) > 0 ) {
819 
820  RegistryItemI * old_ri = fRegistry[new_name] ;
821  delete old_ri ;
822  }
823 
824  fRegistry[new_name] = cri ;
825 
826  } // loop on the incoming registry items
827 
828 }//____________________________________________________________________________
static QCString name
Definition: declinfo.cpp:673
static string AsString(RgType_t rt)
bool IsLocked(void) const
checks registry lock
Definition: Registry.cxx:158
void InhibitItemLocks(void)
override individual item locks
Definition: Registry.cxx:163
Registry item pABC.
Definition: RegistryItemI.h:29
string Name(void) const
get the registry name
Definition: Registry.cxx:597
enum genie::ERgType RgType_t
map< RgKey, RegistryItemI * >::const_iterator RgIMapConstIter
Definition: Registry.h:49
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
RgIMap fRegistry
&#39;key&#39; -> &#39;value&#39; map
Definition: Registry.h:183
#define pINFO
Definition: Messenger.h:62
#define pWARN
Definition: Messenger.h:60
string RgKey
second_as<> second
Type of time stored in seconds, in double precision.
Definition: spacetime.h:85
RegistryItemI * CloneRegistryItem(const RgKey &key) const
Properly clone a registry Item according to its type.
Definition: Registry.cxx:890
string Registry::Name ( void  ) const

get the registry name

Definition at line 597 of file Registry.cxx.

598 {
599  return fName;
600 }
string fName
registry&#39;s name
Definition: Registry.h:180
int Registry::NEntries ( void  ) const

get number of items

Definition at line 582 of file Registry.cxx.

583 {
584  RgIMapSizeType reg_size = fRegistry.size();
585  return (const int) reg_size;
586 }
RgIMap fRegistry
&#39;key&#39; -> &#39;value&#39; map
Definition: Registry.h:183
map< RgKey, RegistryItemI * >::size_type RgIMapSizeType
Definition: Registry.h:47
void Registry::operator() ( RgKey  key,
int  item 
)

Definition at line 110 of file Registry.cxx.

111 {
112  this->Set(key, item);
113 }
def key(type, name=None)
Definition: graph.py:13
void Set(RgIMapPair entry)
Definition: Registry.cxx:267
void genie::Registry::operator() ( RgKey  key,
bool  item 
)
void Registry::operator() ( RgKey  key,
double  item 
)

Definition at line 120 of file Registry.cxx.

121 {
122  this->Set(key, item);
123 }
def key(type, name=None)
Definition: graph.py:13
void Set(RgIMapPair entry)
Definition: Registry.cxx:267
void genie::Registry::operator() ( RgKey  key,
const char *  item 
)
void Registry::operator() ( RgKey  key,
string  item 
)

Definition at line 131 of file Registry.cxx.

132 {
133  this->Set(key, item);
134 }
def key(type, name=None)
Definition: graph.py:13
void Set(RgIMapPair entry)
Definition: Registry.cxx:267
Registry & Registry::operator+= ( const Registry reg)

Definition at line 142 of file Registry.cxx.

143 {
144  this->Append(reg);
145  return (*this);
146 }
void Append(const Registry &, RgKey pfx="")
append the input registry. Entries already in the registry are not updated
Definition: Registry.cxx:743
Registry & Registry::operator= ( const Registry reg)

Definition at line 136 of file Registry.cxx.

137 {
138  this->Copy(reg);
139  return (*this);
140 }
void Copy(const Registry &)
copy the input registry
Definition: Registry.cxx:722
void Registry::OverrideGlobalDef ( RgKey  key)

let item override global default (i.e. a 'local' item)

Definition at line 194 of file Registry.cxx.

195 {
196  if( this->Exists(key) ) {
198  entry->second->SetLocal(true);
199  } else {
200  LOG("Registry", pWARN)
201  << "*** Can't give 'local' status to non-existem item ["
202  << key << "]";
203  }
204 }
QList< Entry > entry
map< RgKey, RegistryItemI * >::const_iterator RgIMapConstIter
Definition: Registry.h:49
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
def key(type, name=None)
Definition: graph.py:13
RgIMap fRegistry
&#39;key&#39; -> &#39;value&#39; map
Definition: Registry.h:183
#define pWARN
Definition: Messenger.h:60
bool Exists(RgKey key) const
item with input key exists?
Definition: Registry.cxx:563
void Registry::Print ( ostream &  stream) const

print the registry to stream

Definition at line 679 of file Registry.cxx.

680 {
681 // Prints the registry to the specified stream
682 //
683  stream << endl;
684  stream << "[-] Registry name: [" << Name() << "]";
685 
686  stream << " - Write Status: ";
687  if(fIsReadOnly) { stream << "[locked]"; }
688  else { stream << "[unlocked]"; }
689 
690  stream << " - Inhibited Item Locking: ";
691  if(fInhibitItemLocks) { stream << "[on]"; }
692  else { stream << "[off]"; }
693 
694  stream << " - # entries: " << setfill(' ') << setw(3) << fRegistry.size()
695  << endl;
696 
697  RgIMapConstIter rcit = fRegistry.begin();
698  for( ; rcit != fRegistry.end(); rcit++) {
699 
700  RgKey key = rcit->first;
701  RegistryItemI * ritem = rcit->second;
702  if(ritem) {
703  RgType_t type = ritem->TypeInfo();
704  string stype = RgType::AsString(type);
705 
706  string key_lbl = string("> ") + key;
707  string type_lbl = string("[") + stype + string("] ");
708 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
709  LOG("Registry", pDEBUG)
710  << "Printing [" << stype << "] item named = " << key;
711 #endif
712  stream << " |" << setfill('-') << setw(50) << key_lbl
713  << setfill(' ') << setw(10) << type_lbl;
714  ritem->Print(stream);
715  stream << endl;
716  } else {
717  LOG("Registry", pERROR) << "Null RegistryItemI with key = " << key;
718  }
719  }// registry iterator
720 }
bool fIsReadOnly
is read only?
Definition: Registry.h:181
static string AsString(RgType_t rt)
#define pERROR
Definition: Messenger.h:59
std::string string
Definition: nybbler.cc:12
Registry item pABC.
Definition: RegistryItemI.h:29
string Name(void) const
get the registry name
Definition: Registry.cxx:597
enum genie::ERgType RgType_t
virtual RgType_t TypeInfo(void) const =0
map< RgKey, RegistryItemI * >::const_iterator RgIMapConstIter
Definition: Registry.h:49
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
def key(type, name=None)
Definition: graph.py:13
RgIMap fRegistry
&#39;key&#39; -> &#39;value&#39; map
Definition: Registry.h:183
bool fInhibitItemLocks
Definition: Registry.h:182
Q_EXPORT QTSManip setw(int w)
Definition: qtextstream.h:331
string RgKey
virtual void Print(ostream &) const =0
Q_EXPORT QTSManip setfill(int f)
Definition: qtextstream.h:337
QTextStream & endl(QTextStream &s)
#define pDEBUG
Definition: Messenger.h:63
void Registry::RestoreItemLocks ( void  )

restore individual item locks

Definition at line 168 of file Registry.cxx.

169 {
170  fInhibitItemLocks = false;
171 }
bool fInhibitItemLocks
Definition: Registry.h:182
RgIMapConstIter Registry::SafeFind ( RgKey  key) const

Definition at line 550 of file Registry.cxx.

551 {
553  if (entry!=fRegistry.end()) {
554  return entry;
555  }
556  LOG("Registry/SafeFind", pFATAL)
557  << "*** Key: " << key
558  << " does not exist in registry: " << this->Name();
559  gAbortingInErr = true;
560  exit(1);
561 }
QList< Entry > entry
#define pFATAL
Definition: Messenger.h:56
string Name(void) const
get the registry name
Definition: Registry.cxx:597
map< RgKey, RegistryItemI * >::const_iterator RgIMapConstIter
Definition: Registry.h:49
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
def key(type, name=None)
Definition: graph.py:13
RgIMap fRegistry
&#39;key&#39; -> &#39;value&#39; map
Definition: Registry.h:183
bool gAbortingInErr
Definition: Messenger.cxx:34
void Registry::Set ( RgIMapPair  entry)

Definition at line 267 of file Registry.cxx.

268 {
269  RgKey key = entry.first;
270  if( this->CanSetItem(key) ) {
271  this->DeleteEntry(key);
272  fRegistry.insert(entry);
273  } else {
274  LOG("Registry", pWARN)
275  << "*** Registry item [" << key << "] can not be set";
276  }
277 }
QList< Entry > entry
bool DeleteEntry(RgKey key)
delete the spcified item
Definition: Registry.cxx:569
QCollection::Item first()
Definition: qglist.cpp:807
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
def key(type, name=None)
Definition: graph.py:13
RgIMap fRegistry
&#39;key&#39; -> &#39;value&#39; map
Definition: Registry.h:183
#define pWARN
Definition: Messenger.h:60
string RgKey
bool CanSetItem(RgKey key) const
can I set the specifed item?
Definition: Registry.cxx:256
void Registry::Set ( RgKey  key,
RgBool  item 
)

Definition at line 279 of file Registry.cxx.

280 {
281  SetRegistryItem(this, key, item); // call templated set method
282 }
void SetRegistryItem(Registry *r, RgKey key, T item)
Definition: Registry.cxx:39
def key(type, name=None)
Definition: graph.py:13
void genie::Registry::Set ( RgKey  key,
RgInt  item 
)
void Registry::Set ( RgKey  key,
RgDbl  item 
)

Definition at line 289 of file Registry.cxx.

290 {
291  SetRegistryItem(this, key, item); // call templated set method
292 }
void SetRegistryItem(Registry *r, RgKey key, T item)
Definition: Registry.cxx:39
def key(type, name=None)
Definition: graph.py:13
void Registry::Set ( RgKey  key,
RgStr  item 
)

Definition at line 300 of file Registry.cxx.

301 {
302  SetRegistryItem(this, key, item); // call templated set method
303 }
void SetRegistryItem(Registry *r, RgKey key, T item)
Definition: Registry.cxx:39
def key(type, name=None)
Definition: graph.py:13
void Registry::Set ( RgKey  key,
RgAlg  item 
)

Definition at line 305 of file Registry.cxx.

306 {
307  SetRegistryItem(this, key, item); // call templated set method
308 }
void SetRegistryItem(Registry *r, RgKey key, T item)
Definition: Registry.cxx:39
def key(type, name=None)
Definition: graph.py:13
void Registry::Set ( RgKey  key,
RgCChAr  item 
)

Definition at line 294 of file Registry.cxx.

295 {
296  RgStr item2 = RgStr(item); // "const char *" -> "string"
297  this->Set(key, item2);
298 }
def key(type, name=None)
Definition: graph.py:13
string RgStr
void Set(RgIMapPair entry)
Definition: Registry.cxx:267
void Registry::Set ( RgKey  key,
RgH1F  item 
)

Definition at line 310 of file Registry.cxx.

311 {
312  SetRegistryItem(this, key, item); // call templated set method
313 }
void SetRegistryItem(Registry *r, RgKey key, T item)
Definition: Registry.cxx:39
def key(type, name=None)
Definition: graph.py:13
void Registry::Set ( RgKey  key,
RgH2F  item 
)

Definition at line 315 of file Registry.cxx.

316 {
317  SetRegistryItem(this, key, item); // call templated set method
318 }
void SetRegistryItem(Registry *r, RgKey key, T item)
Definition: Registry.cxx:39
def key(type, name=None)
Definition: graph.py:13
void Registry::Set ( RgKey  key,
RgTree  item 
)

Definition at line 320 of file Registry.cxx.

321 {
322  SetRegistryItem(this, key, item); // call templated set method
323 }
void SetRegistryItem(Registry *r, RgKey key, T item)
Definition: Registry.cxx:39
def key(type, name=None)
Definition: graph.py:13
void Registry::SetName ( string  name)

set the registry name

Definition at line 588 of file Registry.cxx.

589 {
590  if(! fIsReadOnly) fName = name;
591  else {
592  LOG("Registry", pWARN)
593  << "*** Registry is locked - Can not change its name";
594  }
595 }
static QCString name
Definition: declinfo.cpp:673
bool fIsReadOnly
is read only?
Definition: Registry.h:181
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
#define pWARN
Definition: Messenger.h:60
string fName
registry&#39;s name
Definition: Registry.h:180
void Registry::UnLock ( void  )

unlocks the registry (doesn't unlock items)

Definition at line 153 of file Registry.cxx.

154 {
155  fIsReadOnly = false;
156 }
bool fIsReadOnly
is read only?
Definition: Registry.h:181
void Registry::UnLockItem ( RgKey  key)

unlocks the registry item

Definition at line 245 of file Registry.cxx.

246 {
247  if( this->Exists(key) ) {
249  entry->second->UnLock();
250  } else {
251  LOG("Registry", pWARN)
252  << "*** Can't unlock non-existem item [" << key << "]";
253  }
254 }
QList< Entry > entry
map< RgKey, RegistryItemI * >::const_iterator RgIMapConstIter
Definition: Registry.h:49
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
def key(type, name=None)
Definition: graph.py:13
RgIMap fRegistry
&#39;key&#39; -> &#39;value&#39; map
Definition: Registry.h:183
#define pWARN
Definition: Messenger.h:60
bool Exists(RgKey key) const
item with input key exists?
Definition: Registry.cxx:563

Friends And Related Function Documentation

ostream& operator<< ( ostream &  stream,
const Registry registry 
)
friend

Definition at line 77 of file Registry.cxx.

78  {
79  registry.Print(stream);
80  return stream;
81  }
void Print(ostream &stream) const
print the registry to stream
Definition: Registry.cxx:679

Member Data Documentation

bool genie::Registry::fInhibitItemLocks
private

Definition at line 182 of file Registry.h.

bool genie::Registry::fIsReadOnly
private

is read only?

Definition at line 181 of file Registry.h.

string genie::Registry::fName
private

registry's name

Definition at line 180 of file Registry.h.

RgIMap genie::Registry::fRegistry
private

'key' -> 'value' map

Definition at line 183 of file Registry.h.


The documentation for this class was generated from the following files: