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 "/cvmfs/nova.opensciencegrid.org/externals/genie/v3_00_06_p01/Linux64bit+2.6-2.12-e17-debug/GENIE-Generator/src/Framework/Registry/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 <costas.andreopoulos stfc.ac.uk> University of Liverpool & STFC Rutherford Appleton Lab

May 04, 2004

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

Definition at line 66 of file Registry.h.

Constructor & Destructor Documentation

Registry::Registry ( )

Definition at line 100 of file Registry.cxx.

References Init().

101 {
102  this->Init();
103 }
void Init(void)
initialize the registry
Definition: Registry.cxx:870
Registry::Registry ( string  name,
bool  isReadOnly = true 
)

Definition at line 105 of file Registry.cxx.

105  :
106 fName ( name ),
107 fIsReadOnly ( isReadOnly ),
108 fInhibitItemLocks ( false )
109 {
110 
111 }
const XML_Char * name
Definition: expat.h:151
bool fIsReadOnly
is read only?
Definition: Registry.h:182
bool fInhibitItemLocks
Definition: Registry.h:183
string fName
registry&#39;s name
Definition: Registry.h:181
Registry::Registry ( const Registry registry)

Definition at line 113 of file Registry.cxx.

References Copy().

113  :
114 fName("uninitialised"),
115 fIsReadOnly(false)
116 {
117  this->Copy(registry);
118 }
bool fIsReadOnly
is read only?
Definition: Registry.h:182
void Copy(const Registry &)
copy the input registry
Definition: Registry.cxx:737
string fName
registry&#39;s name
Definition: Registry.h:181
Registry::~Registry ( )
virtual

Definition at line 120 of file Registry.cxx.

References Clear().

121 {
122  this->Clear(true);
123 }
void Clear(bool force=false)
clear the registry
Definition: Registry.cxx:879

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 758 of file Registry.cxx.

References genie::RgType::AsString(), CloneRegistryItem(), fRegistry, InhibitItemLocks(), IsLocked(), LOG, Name(), pERROR, pINFO, pWARN, and moon_position_table_new3::second.

Referenced by Copy(), and operator+=().

759 {
760 // Appends the input registry entries (& their locks)
761 
762  LOG("Registry", pINFO)
763  << "Appending registry " << registry.Name() << " to " << this->Name();
764 
765  if(this->IsLocked()) {
766  LOG("Registry", pWARN) << "Registry is locked. Can't copy input entries!";
767  return;
768  }
769 
770  this->InhibitItemLocks();
771 
772  RgIMapConstIter reg_iter;
773  for(reg_iter = registry.fRegistry.begin();
774  reg_iter != registry.fRegistry.end(); reg_iter++) {
775 
776  RgKey name = reg_iter->first;
777  RgKey new_name = prefix + name;
778 
779  if ( fRegistry.count( new_name ) > 0 ) continue ;
780 
781  RgType_t type = reg_iter -> second -> TypeInfo();
782  string stype = RgType::AsString(type);
783 
784  LOG("Registry", pINFO)
785  << "Copying [" << stype << "] item named = "
786  << name << " as " << new_name;
787 
788  RegistryItemI * cri = registry.CloneRegistryItem( name ) ; // cloned registry item
789 
790  RgIMapPair reg_entry(new_name, cri);
791 
792  if ( ! fRegistry.insert(reg_entry).second ) {
793  // The registry already contained an entry with key new_name
794  // so the new registryItem has to be deleted or we leak memory.
795  // This should not happened as a check is performed
796  LOG("Registry", pERROR ) << "Failing to insert item " << new_name ;
797  delete cri ;
798  }
799  } // loop on the incoming registry items
800 }
const XML_Char * name
Definition: expat.h:151
static string AsString(RgType_t rt)
bool IsLocked(void) const
checks registry lock
Definition: Registry.cxx:173
#define pERROR
Definition: Messenger.h:60
void InhibitItemLocks(void)
override individual item locks
Definition: Registry.cxx:178
Registry item pABC.
Definition: RegistryItemI.h:30
string Name(void) const
get the registry name
Definition: Registry.cxx:612
enum genie::ERgType RgType_t
map< RgKey, RegistryItemI * >::const_iterator RgIMapConstIter
Definition: Registry.h:50
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
RgIMap fRegistry
&#39;key&#39; -> &#39;value&#39; map
Definition: Registry.h:184
#define pINFO
Definition: Messenger.h:63
pair< RgKey, RegistryItemI * > RgIMapPair
Definition: Registry.h:47
const XML_Char * prefix
Definition: expat.h:380
#define pWARN
Definition: Messenger.h:61
string RgKey
RegistryItemI * CloneRegistryItem(const RgKey &key) const
Properly clone a registry Item according to its type.
Definition: Registry.cxx:905
void Registry::AssertExistence ( RgKey  key0) const

Definition at line 617 of file Registry.cxx.

References Exists(), exit(), LOG, Name(), pERROR, and pFATAL.

Referenced by AssertExistence(), and GetItemMap().

618 {
619  if ( ! this->Exists(key0) ) {
620  LOG("Registry", pERROR) << (*this);
621  LOG("Registry", pFATAL)
622  << "*** Key: " << key0
623  << " does not exist in registry: " << this->Name();
624  exit(1);
625  }
626 }
#define pERROR
Definition: Messenger.h:60
#define pFATAL
Definition: Messenger.h:57
string Name(void) const
get the registry name
Definition: Registry.cxx:612
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
exit(0)
bool Exists(RgKey key) const
item with input key exists?
Definition: Registry.cxx:578
void Registry::AssertExistence ( RgKey  key0,
RgKey  key1 
) const

Definition at line 628 of file Registry.cxx.

References AssertExistence().

629 {
630  this->AssertExistence(key0);
631  this->AssertExistence(key1);
632 }
void AssertExistence(RgKey key0) const
Definition: Registry.cxx:617
void Registry::AssertExistence ( RgKey  key0,
RgKey  key1,
RgKey  key2 
) const

Definition at line 634 of file Registry.cxx.

References AssertExistence().

635 {
636  this->AssertExistence(key0);
637  this->AssertExistence(key1);
638  this->AssertExistence(key2);
639 }
void AssertExistence(RgKey key0) const
Definition: Registry.cxx:617
bool Registry::CanSetItem ( RgKey  key) const

can I set the specifed item?

Definition at line 271 of file Registry.cxx.

References IsLocked(), ItemIsLocked(), and ItemLocksAreActive().

Referenced by Set().

272 {
273  bool locked_item = this->ItemIsLocked(key);
274  bool active_item_locks = this->ItemLocksAreActive();
275  bool locked_registry = this->IsLocked();
276 
277  bool can_set = !locked_registry && ( !locked_item || !active_item_locks );
278 
279  return can_set;
280 }
bool IsLocked(void) const
checks registry lock
Definition: Registry.cxx:173
bool ItemLocksAreActive(void) const
check if item locks are active
Definition: Registry.cxx:188
bool ItemIsLocked(RgKey key) const
check item lock
Definition: Registry.cxx:233
void Registry::Clear ( bool  force = false)

clear the registry

Definition at line 879 of file Registry.cxx.

References fRegistry, IsLocked(), LOG, Name(), pINFO, and pWARN.

Referenced by Copy(), and ~Registry().

880 {
881 // clean all registry entries
882 
883  LOG("Registry", pINFO)
884  << "Cleaning-up [force unlock = " << ((force)?"true":"false")
885  << "] registry: " << this->Name();
886  if(!force) {
887  if(this->IsLocked()) {
888  LOG("Registry", pWARN) << "Registry is locked. Can't clear its entries";
889  return;
890  }
891  }
892  RgIMapIter rit;
893  for(rit = fRegistry.begin(); rit != fRegistry.end(); rit++) {
894  RgKey name = rit->first;
895  RegistryItemI * item = rit->second;
896  if(!item) {
897  LOG("Registry", pWARN) << "Item with key = " << name << " is null!";
898  }
899  delete item;
900  item = 0;
901  }
902  fRegistry.clear();
903 }
const XML_Char * name
Definition: expat.h:151
bool IsLocked(void) const
checks registry lock
Definition: Registry.cxx:173
Registry item pABC.
Definition: RegistryItemI.h:30
string Name(void) const
get the registry name
Definition: Registry.cxx:612
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
RgIMap fRegistry
&#39;key&#39; -> &#39;value&#39; map
Definition: Registry.h:184
#define pINFO
Definition: Messenger.h:63
#define pWARN
Definition: Messenger.h:61
string RgKey
map< RgKey, RegistryItemI * >::iterator RgIMapIter
Definition: Registry.h:49
RegistryItemI * Registry::CloneRegistryItem ( const RgKey key) const
private

Properly clone a registry Item according to its type.

Definition at line 905 of file Registry.cxx.

References genie::RgType::AsString(), exit(), fRegistry, GetAlg(), GetBool(), GetDouble(), GetH1F(), GetH2F(), GetInt(), GetString(), GetTree(), histo, genie::RegistryItemI::IsLocked(), it, genie::kRgAlg, genie::kRgBool, genie::kRgDbl, genie::kRgH1F, genie::kRgH2F, genie::kRgInt, genie::kRgStr, genie::kRgTree, LOG, Name(), pDEBUG, pERROR, pFATAL, moon_position_table_new3::second, compareCafs::tree, and genie::RegistryItemI::TypeInfo().

Referenced by Append(), GetItemMap(), and Merge().

905  {
906 
907  std::map<RgKey, RegistryItemI*>::const_iterator it = fRegistry.find( key ) ;
908 
909  if ( it == fRegistry.end() ) {
910  LOG("Registry", pFATAL) << "Item " << key << " not found while cloning for registry " << Name() ;
911  exit( 0 ) ;
912  }
913 
914  RegistryItemI * ri = it -> second ;
915 
916  bool ilk = ri->IsLocked();
917  RgType_t type = ri->TypeInfo();
918  string stype = RgType::AsString(type);
919 
920  RegistryItemI * cri = 0; // cloned registry item
921  if (type == kRgBool)
922  cri = new RegistryItem<RgBool>( GetBool(key), ilk);
923  else if (type == kRgDbl)
924  cri = new RegistryItem<RgDbl> ( GetDouble(key), ilk);
925  else if (type == kRgInt)
926  cri = new RegistryItem<RgInt> ( GetInt(key), ilk);
927  else if (type == kRgStr)
928  cri = new RegistryItem<RgStr> ( GetString(key), ilk);
929  else if (type == kRgAlg)
930  cri = new RegistryItem<RgAlg> ( GetAlg(key), ilk);
931  else if (type == kRgH1F) {
932  RgH1F histo = GetH1F(key);
933  if(histo) {
934  RgH1F chisto = new TH1F(*histo);
935  LOG("Registry", pDEBUG) << chisto->GetName();
936  cri = new RegistryItem<RgH1F>(chisto,ilk);
937  } else {
938  LOG("Registry", pERROR)
939  << "Null TH1F with key = " << key << " - not copied";
940  }
941  } else if (type == kRgH2F) {
942  RgH2F histo = GetH2F(key);
943  if(histo) {
944  RgH2F chisto = new TH2F(*histo);
945  LOG("Registry", pDEBUG) << chisto->GetName();
946  cri = new RegistryItem<RgH2F>(chisto,ilk);
947  } else {
948  LOG("Registry", pERROR)
949  << "Null TH2F with key = " << key << " - not copied";
950  }
951  } else if (type == kRgTree) {
952  RgTree tree = GetTree(key);
953  if(tree) {
954  //TTree * ctree = new TTree(*tree);
955  TTree * ctree = tree->CopyTree("1");
956  LOG("Registry", pDEBUG) << ctree->GetName();
957  cri = new RegistryItem<RgTree>(ctree,ilk);
958  } else {
959  LOG("Registry", pERROR)
960  << "Null TTree with key = " << key << " - not copied";
961  }
962  } else {
963 
964  LOG( "Registry", pFATAL ) << "Item " << key << " not cloned because its type is not implemented " ;
965  exit( 0 ) ;
966  }
967 
968  return cri ;
969 
970 }
static string AsString(RgType_t rt)
set< int >::iterator it
#define pERROR
Definition: Messenger.h:60
virtual bool IsLocked(void) const =0
#define pFATAL
Definition: Messenger.h:57
RgDbl GetDouble(RgKey key) const
Definition: Registry.cxx:489
RgInt GetInt(RgKey key) const
Definition: Registry.cxx:482
Registry item pABC.
Definition: RegistryItemI.h:30
TH2F * RgH2F
string Name(void) const
get the registry name
Definition: Registry.cxx:612
RgH1F GetH1F(RgKey key) const
Definition: Registry.cxx:510
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:97
RgIMap fRegistry
&#39;key&#39; -> &#39;value&#39; map
Definition: Registry.h:184
TH2D * histo
RgStr GetString(RgKey key) const
Definition: Registry.cxx:496
TH1F * RgH1F
RgBool GetBool(RgKey key) const
Definition: Registry.cxx:475
exit(0)
RgTree GetTree(RgKey key) const
Definition: Registry.cxx:530
A templated concrete implementation of the RegistryItemI interface. Provides an arbitrary basic type ...
Definition: RegistryItem.h:33
RgH2F GetH2F(RgKey key) const
Definition: Registry.cxx:520
RgAlg GetAlg(RgKey key) const
Definition: Registry.cxx:503
#define pDEBUG
Definition: Messenger.h:64
TTree * RgTree
void Registry::Copy ( const Registry registry)

copy the input registry

Definition at line 737 of file Registry.cxx.

References Append(), Clear(), fInhibitItemLocks, fIsReadOnly, fName, Init(), IsLocked(), LOG, Name(), pINFO, and pWARN.

Referenced by main(), operator=(), and Registry().

738 {
739 // Copies the input registry
740 //
741  LOG("Registry", pINFO)
742  << "Copying registry " << registry.Name() << " to " << this->Name();
743 
744  if(this->IsLocked()) {
745  LOG("Registry", pWARN) << "Registry is locked. Can't copy input entries!";
746  return;
747  }
748 
749  this->Init();
750  this->Clear();
751  this->Append(registry);
752 
753  fName = registry.fName;
754  fIsReadOnly = registry.fIsReadOnly;
756 }
bool fIsReadOnly
is read only?
Definition: Registry.h:182
bool IsLocked(void) const
checks registry lock
Definition: Registry.cxx:173
void Append(const Registry &, RgKey pfx="")
append the input registry. Entries already in the registry are not updated
Definition: Registry.cxx:758
string Name(void) const
get the registry name
Definition: Registry.cxx:612
void Init(void)
initialize the registry
Definition: Registry.cxx:870
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
#define pINFO
Definition: Messenger.h:63
bool fInhibitItemLocks
Definition: Registry.h:183
#define pWARN
Definition: Messenger.h:61
string fName
registry&#39;s name
Definition: Registry.h:181
void Clear(bool force=false)
clear the registry
Definition: Registry.cxx:879
void Registry::CopyToFolder ( TFolder *  folder) const

Definition at line 641 of file Registry.cxx.

References genie::RgType::AsString(), RgAlg::config, HTMLTools::entry(), fRegistry, GetAlg(), GetBool(), GetDouble(), GetInt(), GetString(), findDuplicateFiles::key, genie::kRgAlg, genie::kRgBool, genie::kRgDbl, genie::kRgH1F, genie::kRgH2F, genie::kRgInt, genie::kRgStr, genie::kRgTree, LOG, RgAlg::name, pINFO, and genie::RegistryItemI::TypeInfo().

Referenced by GetItemMap(), and genie::NtpMCJobConfig::Load().

642 {
643  LOG("Registry", pINFO) << "Converting Registry to TFolder";
644 
645  folder->SetOwner(true);
646 
647  RgIMapConstIter reg_iter;
648 
649  for(reg_iter = this->fRegistry.begin();
650  reg_iter != this->fRegistry.end(); reg_iter++) {
651 
652  ostringstream entry;
653  string key = reg_iter->first;
654  RegistryItemI * ritem = reg_iter->second;
655 
656  RgType_t type = ritem->TypeInfo();
657  string stype = RgType::AsString(type);
658 
659  entry << "key:" << key << ";type:" << stype;
660 
661  if(type == kRgBool) {
662  entry << ";value: " << this->GetBool(key);
663  LOG("Registry", pINFO) << "entry = " << entry.str();
664  folder->Add(new TObjString(entry.str().c_str()));
665  }
666  else if (type == kRgDbl) {
667  entry << ";value: " << this->GetDouble(key);
668  LOG("Registry", pINFO) << "entry = " << entry.str();
669  folder->Add(new TObjString(entry.str().c_str()));
670  }
671  else if (type == kRgInt) {
672  entry << ";value: " << this->GetInt(key);
673  LOG("Registry", pINFO) << "entry = " << entry.str();
674  folder->Add(new TObjString(entry.str().c_str()));
675  }
676  else if (type == kRgStr) {
677  entry << ";value: " << this->GetString(key);
678  LOG("Registry", pINFO) << "entry = " << entry.str();
679  folder->Add(new TObjString(entry.str().c_str()));
680  }
681  else if (type == kRgAlg) {
682  entry << ";value: " << this->GetAlg(key).name
683  << "/" << this->GetAlg(key).config;
684  LOG("Registry", pINFO) << "entry = " << entry.str();
685  folder->Add(new TObjString(entry.str().c_str()));
686 
687  } else if (type == kRgH1F) {
688  } else if (type == kRgH2F) {
689  } else if (type == kRgTree) {
690  } else {}
691  }// registry iterator
692 }
static string AsString(RgType_t rt)
RgDbl GetDouble(RgKey key) const
Definition: Registry.cxx:489
RgInt GetInt(RgKey key) const
Definition: Registry.cxx:482
Registry item pABC.
Definition: RegistryItemI.h:30
enum genie::ERgType RgType_t
virtual RgType_t TypeInfo(void) const =0
map< RgKey, RegistryItemI * >::const_iterator RgIMapConstIter
Definition: Registry.h:50
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
RgIMap fRegistry
&#39;key&#39; -> &#39;value&#39; map
Definition: Registry.h:184
#define pINFO
Definition: Messenger.h:63
RgStr GetString(RgKey key) const
Definition: Registry.cxx:496
RgBool GetBool(RgKey key) const
Definition: Registry.cxx:475
def entry(str)
Definition: HTMLTools.py:26
string config
RgAlg GetAlg(RgKey key) const
Definition: Registry.cxx:503
bool Registry::DeleteEntry ( RgKey  key)

delete the spcified item

Definition at line 584 of file Registry.cxx.

References HTMLTools::entry(), Exists(), fIsReadOnly, and fRegistry.

Referenced by Set().

585 {
586  if(!fIsReadOnly && Exists(key)) {
587  RgIMapIter entry = fRegistry.find(key);
588  RegistryItemI * item = entry->second;
589  delete item;
590  item = 0;
591  fRegistry.erase(entry);
592  return true;
593  }
594  return false;
595 }
bool fIsReadOnly
is read only?
Definition: Registry.h:182
Registry item pABC.
Definition: RegistryItemI.h:30
RgIMap fRegistry
&#39;key&#39; -> &#39;value&#39; map
Definition: Registry.h:184
map< RgKey, RegistryItemI * >::iterator RgIMapIter
Definition: Registry.h:49
bool Exists(RgKey key) const
item with input key exists?
Definition: Registry.cxx:578
def entry(str)
Definition: HTMLTools.py:26
bool Registry::Exists ( RgKey  key) const

item with input key exists?

Definition at line 578 of file Registry.cxx.

References HTMLTools::entry(), and fRegistry.

Referenced by AssertExistence(), DeleteEntry(), genie::utils::config::GetDoubleKeyPDG(), genie::utils::config::GetDoubleKeyRangeNucA(), genie::GetValueOrUseDefault(), ItemIsLocal(), ItemIsLocked(), LinkToGlobalDef(), LockItem(), OverrideGlobalDef(), and UnLockItem().

579 {
581  return (entry!=fRegistry.end());
582 }
map< RgKey, RegistryItemI * >::const_iterator RgIMapConstIter
Definition: Registry.h:50
RgIMap fRegistry
&#39;key&#39; -> &#39;value&#39; map
Definition: Registry.h:184
def entry(str)
Definition: HTMLTools.py:26
RgKeyList Registry::FindKeys ( RgKey  key_part) const

create list with all keys containing 'key_part'

Definition at line 855 of file Registry.cxx.

References fRegistry, and findDuplicateFiles::key.

Referenced by genie::Decayer::LoadConfig(), and main().

856 {
857  RgKeyList klist;
858 
859  RgIMapConstIter reg_iter = fRegistry.begin();
860  for( ; reg_iter != fRegistry.end(); reg_iter++) {
861  RgKey key = reg_iter->first;
862  if (key.find(key_part) != string::npos) {
863  klist.push_back(key);
864  }
865  }
866 
867  return klist;
868 }
map< RgKey, RegistryItemI * >::const_iterator RgIMapConstIter
Definition: Registry.h:50
RgIMap fRegistry
&#39;key&#39; -> &#39;value&#39; map
Definition: Registry.h:184
vector< RgKey > RgKeyList
Definition: Registry.h:51
string RgKey
void Registry::Get ( RgKey  key,
const RegistryItemI *&  item 
) const

Definition at line 340 of file Registry.cxx.

References HTMLTools::entry(), and SafeFind().

Referenced by CheckUnitarityLimit(), GetAlg(), GetBool(), GetDouble(), GetInt(), GetString(), genie::GetValueOrUseDefault(), and main().

341 {
343  item = entry->second;
344 }
map< RgKey, RegistryItemI * >::const_iterator RgIMapConstIter
Definition: Registry.h:50
RgIMapConstIter SafeFind(RgKey key) const
Definition: Registry.cxx:565
def entry(str)
Definition: HTMLTools.py:26
void Registry::Get ( RgKey  key,
RgBool item 
) const

Definition at line 346 of file Registry.cxx.

References genie::RegistryItem< T >::Data(), HTMLTools::entry(), findDuplicateFiles::key, LOG, pDEBUG, and SafeFind().

347 {
348 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
349  LOG("Registry", pDEBUG) << "Get an RgBool item with key: " << key;
350 #endif
351 
353  RegistryItemI * rib = entry->second;
354  RegistryItem<RgBool> * ri = dynamic_cast<RegistryItem<RgBool>*> (rib);
355 
356 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
357  LOG("Registry", pDEBUG) << "Item value = " << ri->Data();
358 #endif
359  item = ri->Data();
360 }
const T & Data(void) const
Definition: RegistryItem.h:47
Registry item pABC.
Definition: RegistryItemI.h:30
map< RgKey, RegistryItemI * >::const_iterator RgIMapConstIter
Definition: Registry.h:50
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
RgIMapConstIter SafeFind(RgKey key) const
Definition: Registry.cxx:565
A templated concrete implementation of the RegistryItemI interface. Provides an arbitrary basic type ...
Definition: RegistryItem.h:33
def entry(str)
Definition: HTMLTools.py:26
#define pDEBUG
Definition: Messenger.h:64
void Registry::Get ( RgKey  key,
RgInt item 
) const

Definition at line 362 of file Registry.cxx.

References genie::RegistryItem< T >::Data(), HTMLTools::entry(), findDuplicateFiles::key, LOG, pDEBUG, and SafeFind().

363 {
364 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
365  LOG("Registry", pDEBUG) << "Getting an RgInt item with key: " << key;
366 #endif
367 
369  RegistryItemI * rib = entry->second;
370  RegistryItem<RgInt> * ri = dynamic_cast< RegistryItem<RgInt> * > (rib);
371 
372 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
373  LOG("Registry", pDEBUG) << "Item value = " << ri->Data();
374 #endif
375  item = ri->Data();
376 }
const T & Data(void) const
Definition: RegistryItem.h:47
Registry item pABC.
Definition: RegistryItemI.h:30
map< RgKey, RegistryItemI * >::const_iterator RgIMapConstIter
Definition: Registry.h:50
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
RgIMapConstIter SafeFind(RgKey key) const
Definition: Registry.cxx:565
A templated concrete implementation of the RegistryItemI interface. Provides an arbitrary basic type ...
Definition: RegistryItem.h:33
def entry(str)
Definition: HTMLTools.py:26
#define pDEBUG
Definition: Messenger.h:64
void Registry::Get ( RgKey  key,
RgDbl item 
) const

Definition at line 378 of file Registry.cxx.

References genie::RegistryItem< T >::Data(), HTMLTools::entry(), findDuplicateFiles::key, LOG, pDEBUG, and SafeFind().

379 {
380 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
381  LOG("Registry", pDEBUG) << "Getting an RgDbl item with key: " << key;
382 #endif
383 
385  RegistryItemI * rib = entry->second;
386  RegistryItem<RgDbl> * ri = dynamic_cast<RegistryItem<RgDbl>*> (rib);
387 
388 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
389  LOG("Registry", pDEBUG) << "Item value = " << ri->Data();
390 #endif
391  item = ri->Data();
392 }
const T & Data(void) const
Definition: RegistryItem.h:47
Registry item pABC.
Definition: RegistryItemI.h:30
map< RgKey, RegistryItemI * >::const_iterator RgIMapConstIter
Definition: Registry.h:50
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
RgIMapConstIter SafeFind(RgKey key) const
Definition: Registry.cxx:565
A templated concrete implementation of the RegistryItemI interface. Provides an arbitrary basic type ...
Definition: RegistryItem.h:33
def entry(str)
Definition: HTMLTools.py:26
#define pDEBUG
Definition: Messenger.h:64
void Registry::Get ( RgKey  key,
RgStr item 
) const

Definition at line 394 of file Registry.cxx.

References genie::RegistryItem< T >::Data(), HTMLTools::entry(), findDuplicateFiles::key, LOG, pDEBUG, and SafeFind().

395 {
396 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
397  LOG("Registry", pDEBUG) << "Getting an RgStr item with key: " << key;
398 #endif
399 
401  RegistryItemI * rib = entry->second;
402  RegistryItem<RgStr> * ri = dynamic_cast<RegistryItem<RgStr>*> (rib);
403 
404 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
405  LOG("Registry", pDEBUG) << "Item value = " << ri->Data();
406 #endif
407  item = ri->Data();
408 }
const T & Data(void) const
Definition: RegistryItem.h:47
Registry item pABC.
Definition: RegistryItemI.h:30
map< RgKey, RegistryItemI * >::const_iterator RgIMapConstIter
Definition: Registry.h:50
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
RgIMapConstIter SafeFind(RgKey key) const
Definition: Registry.cxx:565
A templated concrete implementation of the RegistryItemI interface. Provides an arbitrary basic type ...
Definition: RegistryItem.h:33
def entry(str)
Definition: HTMLTools.py:26
#define pDEBUG
Definition: Messenger.h:64
void Registry::Get ( RgKey  key,
RgAlg item 
) const

Definition at line 410 of file Registry.cxx.

References genie::RegistryItem< T >::Data(), HTMLTools::entry(), findDuplicateFiles::key, LOG, pDEBUG, and SafeFind().

411 {
412 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
413  LOG("Registry", pDEBUG) << "Getting an RgAlg item with key: " << key;
414 #endif
415 
417  RegistryItemI * rib = entry->second;
418  RegistryItem<RgAlg> * ri = dynamic_cast<RegistryItem<RgAlg>*> (rib);
419 
420 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
421  LOG("Registry", pDEBUG) << "Item value = " << ri->Data();
422 #endif
423 
424  item = ri->Data();
425 }
const T & Data(void) const
Definition: RegistryItem.h:47
Registry item pABC.
Definition: RegistryItemI.h:30
map< RgKey, RegistryItemI * >::const_iterator RgIMapConstIter
Definition: Registry.h:50
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
RgIMapConstIter SafeFind(RgKey key) const
Definition: Registry.cxx:565
A templated concrete implementation of the RegistryItemI interface. Provides an arbitrary basic type ...
Definition: RegistryItem.h:33
def entry(str)
Definition: HTMLTools.py:26
#define pDEBUG
Definition: Messenger.h:64
void Registry::Get ( RgKey  key,
RgH1F item 
) const

Definition at line 427 of file Registry.cxx.

References genie::RegistryItem< T >::Data(), HTMLTools::entry(), findDuplicateFiles::key, LOG, pDEBUG, pWARN, and SafeFind().

428 {
429 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
430  LOG("Registry", pDEBUG) << "Getting an RgH1F item with key: " << key;
431 #endif
432 
434  RegistryItemI * rib = entry->second;
435  RegistryItem<RgH1F> *ri = dynamic_cast<RegistryItem<RgH1F>*> (rib);
436  item = ri->Data();
437 
438  if(!item) {
439  LOG("Registry", pWARN) << "Returned NULL ptr for TH1F param = " << key;
440  }
441 }
const T & Data(void) const
Definition: RegistryItem.h:47
Registry item pABC.
Definition: RegistryItemI.h:30
map< RgKey, RegistryItemI * >::const_iterator RgIMapConstIter
Definition: Registry.h:50
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
RgIMapConstIter SafeFind(RgKey key) const
Definition: Registry.cxx:565
#define pWARN
Definition: Messenger.h:61
A templated concrete implementation of the RegistryItemI interface. Provides an arbitrary basic type ...
Definition: RegistryItem.h:33
def entry(str)
Definition: HTMLTools.py:26
#define pDEBUG
Definition: Messenger.h:64
void Registry::Get ( RgKey  key,
RgH2F item 
) const

Definition at line 443 of file Registry.cxx.

References genie::RegistryItem< T >::Data(), HTMLTools::entry(), findDuplicateFiles::key, LOG, pDEBUG, pWARN, and SafeFind().

444 {
445 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
446  LOG("Registry", pDEBUG) << "Getting an RgH2F item with key: " << key;
447 #endif
448 
450  RegistryItemI * rib = entry->second;
451  RegistryItem<RgH2F> *ri = dynamic_cast<RegistryItem<RgH2F>*> (rib);
452  item = ri->Data();
453 
454  if(!item) {
455  LOG("Registry", pWARN) << "Returned NULL ptr for TH2F param = " << key;
456  }
457 }
const T & Data(void) const
Definition: RegistryItem.h:47
Registry item pABC.
Definition: RegistryItemI.h:30
map< RgKey, RegistryItemI * >::const_iterator RgIMapConstIter
Definition: Registry.h:50
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
RgIMapConstIter SafeFind(RgKey key) const
Definition: Registry.cxx:565
#define pWARN
Definition: Messenger.h:61
A templated concrete implementation of the RegistryItemI interface. Provides an arbitrary basic type ...
Definition: RegistryItem.h:33
def entry(str)
Definition: HTMLTools.py:26
#define pDEBUG
Definition: Messenger.h:64
void Registry::Get ( RgKey  key,
RgTree item 
) const

Definition at line 459 of file Registry.cxx.

References genie::RegistryItem< T >::Data(), HTMLTools::entry(), findDuplicateFiles::key, LOG, pDEBUG, pWARN, and SafeFind().

460 {
461 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
462  LOG("Registry", pDEBUG) << "Getting an RgTree item with key: " << key;
463 #endif
464 
466  RegistryItemI * rib = entry->second;
467  RegistryItem<RgTree> *ri = dynamic_cast<RegistryItem<RgTree>*> (rib);
468  item = ri->Data();
469 
470  if(!item) {
471  LOG("Registry", pWARN) << "Returned NULL ptr for TTree param = " << key;
472  }
473 }
const T & Data(void) const
Definition: RegistryItem.h:47
Registry item pABC.
Definition: RegistryItemI.h:30
map< RgKey, RegistryItemI * >::const_iterator RgIMapConstIter
Definition: Registry.h:50
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
RgIMapConstIter SafeFind(RgKey key) const
Definition: Registry.cxx:565
#define pWARN
Definition: Messenger.h:61
A templated concrete implementation of the RegistryItemI interface. Provides an arbitrary basic type ...
Definition: RegistryItem.h:33
def entry(str)
Definition: HTMLTools.py:26
#define pDEBUG
Definition: Messenger.h:64
RgAlg Registry::GetAlg ( RgKey  key) const

Definition at line 503 of file Registry.cxx.

References Get().

Referenced by CloneRegistryItem(), CopyToFolder(), genie::IBDXSecMap::LoadConfig(), genie::NuclearModelMap::LoadConfig(), genie::PauliBlocker::LoadModelType(), and genie::utils::nuclear::NuclQELXSecSuppression().

504 {
505  RgAlg value;
506  this->Get(key, value);
507  return value;
508 }
void Get(RgKey key, const RegistryItemI *&item) const
Definition: Registry.cxx:340
const XML_Char int const XML_Char * value
Definition: expat.h:331
RgAlg Registry::GetAlgDef ( RgKey  key,
RgAlg  def_opt,
bool  set_def = true 
)

Definition at line 560 of file Registry.cxx.

References genie::GetValueOrUseDefault().

561 {
562  return GetValueOrUseDefault(this, key, def_opt, set_def);
563 }
T GetValueOrUseDefault(Registry *r, RgKey key, T def, bool set_def)
Definition: Registry.cxx:66
RgBool Registry::GetBool ( RgKey  key) const

Definition at line 475 of file Registry.cxx.

References Get().

Referenced by CloneRegistryItem(), CopyToFolder(), genie::utils::gsl::d2XSecRESFast_dWQ2_E::d2XSecRESFast_dWQ2_E(), genie::Decayer::LoadConfig(), and main().

476 {
477  RgBool value;
478  this->Get(key, value);
479  return value;
480 }
bool RgBool
void Get(RgKey key, const RegistryItemI *&item) const
Definition: Registry.cxx:340
const XML_Char int const XML_Char * value
Definition: expat.h:331
RgBool Registry::GetBoolDef ( RgKey  key,
RgBool  def_opt,
bool  set_def = true 
)

Definition at line 540 of file Registry.cxx.

References genie::GetValueOrUseDefault().

Referenced by genie::utils::gsl::d2XSecRESFast_dWQ2_E::d2XSecRESFast_dWQ2_E(), and main().

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:66
RgDbl Registry::GetDouble ( RgKey  key) const

Definition at line 489 of file Registry.cxx.

References Get().

Referenced by CloneRegistryItem(), CopyToFolder(), genie::utils::gsl::d2XSecRESFast_dWQ2_E::d2XSecRESFast_dWQ2_E(), genie::GVldContext::Decode(), genie::KPhaseSpace::GetTMaxDFR(), genie::NewQELXSec::Integrate(), and main().

490 {
491  RgDbl value;
492  this->Get(key, value);
493  return value;
494 }
void Get(RgKey key, const RegistryItemI *&item) const
Definition: Registry.cxx:340
const XML_Char int const XML_Char * value
Definition: expat.h:331
double RgDbl
double Registry::GetDoubleDef ( RgKey  key,
RgDbl  def_opt,
bool  set_def = true 
)

Definition at line 550 of file Registry.cxx.

References genie::GetValueOrUseDefault().

Referenced by genie::utils::gsl::d2XSecRESFast_dWQ2_E::d2XSecRESFast_dWQ2_E(), genie::utils::config::GetDoubleKeyPDG(), genie::utils::config::GetDoubleKeyRangeNucA(), and main().

551 {
552  return GetValueOrUseDefault(this, key, def_opt, set_def);
553 }
T GetValueOrUseDefault(Registry *r, RgKey key, T def, bool set_def)
Definition: Registry.cxx:66
RgH1F Registry::GetH1F ( RgKey  key) const

Definition at line 510 of file Registry.cxx.

References genie::RegistryItem< T >::Data(), HTMLTools::entry(), and fRegistry.

Referenced by CloneRegistryItem().

511 {
513  RegistryItemI * rib = entry->second;
514  RegistryItem<RgH1F> *ri = dynamic_cast<RegistryItem<RgH1F>*> (rib);
515 
516  RgH1F item = ri->Data();
517  return item;
518 }
const T & Data(void) const
Definition: RegistryItem.h:47
Registry item pABC.
Definition: RegistryItemI.h:30
map< RgKey, RegistryItemI * >::const_iterator RgIMapConstIter
Definition: Registry.h:50
RgIMap fRegistry
&#39;key&#39; -> &#39;value&#39; map
Definition: Registry.h:184
TH1F * RgH1F
A templated concrete implementation of the RegistryItemI interface. Provides an arbitrary basic type ...
Definition: RegistryItem.h:33
def entry(str)
Definition: HTMLTools.py:26
RgH2F Registry::GetH2F ( RgKey  key) const

Definition at line 520 of file Registry.cxx.

References genie::RegistryItem< T >::Data(), HTMLTools::entry(), and fRegistry.

Referenced by CloneRegistryItem().

521 {
523  RegistryItemI * rib = entry->second;
524  RegistryItem<RgH2F> *ri = dynamic_cast<RegistryItem<RgH2F>*> (rib);
525 
526  RgH2F item = ri->Data();
527  return item;
528 }
const T & Data(void) const
Definition: RegistryItem.h:47
Registry item pABC.
Definition: RegistryItemI.h:30
TH2F * RgH2F
map< RgKey, RegistryItemI * >::const_iterator RgIMapConstIter
Definition: Registry.h:50
RgIMap fRegistry
&#39;key&#39; -> &#39;value&#39; map
Definition: Registry.h:184
A templated concrete implementation of the RegistryItemI interface. Provides an arbitrary basic type ...
Definition: RegistryItem.h:33
def entry(str)
Definition: HTMLTools.py:26
RgInt Registry::GetInt ( RgKey  key) const

Definition at line 482 of file Registry.cxx.

References Get().

Referenced by genie::EventGeneratorListAssembler::AssembleGeneratorList(), CloneRegistryItem(), CopyToFolder(), and main().

483 {
484  RgInt value;
485  this->Get(key, value);
486  return value;
487 }
int RgInt
void Get(RgKey key, const RegistryItemI *&item) const
Definition: Registry.cxx:340
const XML_Char int const XML_Char * value
Definition: expat.h:331
int Registry::GetIntDef ( RgKey  key,
RgInt  def_opt,
bool  set_def = true 
)

Definition at line 545 of file Registry.cxx.

References genie::GetValueOrUseDefault().

Referenced by main().

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:66
const RgIMap& genie::Registry::GetItemMap ( void  ) const
inline
RgStr Registry::GetString ( RgKey  key) const

Definition at line 496 of file Registry.cxx.

References Get().

Referenced by CloneRegistryItem(), CopyToFolder(), genie::Algorithm::FindConfig(), genie::NewQELXSec::Integrate(), and genie::P33PaschosLalakulichPXSec::XSec().

497 {
498  RgStr value;
499  this->Get(key, value);
500  return value;
501 }
void Get(RgKey key, const RegistryItemI *&item) const
Definition: Registry.cxx:340
const XML_Char int const XML_Char * value
Definition: expat.h:331
string RgStr
string Registry::GetStringDef ( RgKey  key,
RgStr  def_opt,
bool  set_def = true 
)

Definition at line 555 of file Registry.cxx.

References genie::GetValueOrUseDefault().

556 {
557  return GetValueOrUseDefault(this, key, def_opt, set_def);
558 }
T GetValueOrUseDefault(Registry *r, RgKey key, T def, bool set_def)
Definition: Registry.cxx:66
RgTree Registry::GetTree ( RgKey  key) const

Definition at line 530 of file Registry.cxx.

References genie::RegistryItem< T >::Data(), HTMLTools::entry(), and fRegistry.

Referenced by CloneRegistryItem().

531 {
533  RegistryItemI * rib = entry->second;
534  RegistryItem<RgTree> *ri = dynamic_cast<RegistryItem<RgTree>*> (rib);
535 
536  RgTree item = ri->Data();
537  return item;
538 }
const T & Data(void) const
Definition: RegistryItem.h:47
Registry item pABC.
Definition: RegistryItemI.h:30
map< RgKey, RegistryItemI * >::const_iterator RgIMapConstIter
Definition: Registry.h:50
RgIMap fRegistry
&#39;key&#39; -> &#39;value&#39; map
Definition: Registry.h:184
A templated concrete implementation of the RegistryItemI interface. Provides an arbitrary basic type ...
Definition: RegistryItem.h:33
def entry(str)
Definition: HTMLTools.py:26
TTree * RgTree
void Registry::InhibitItemLocks ( void  )

override individual item locks

Definition at line 178 of file Registry.cxx.

References fInhibitItemLocks.

Referenced by Append(), main(), and Merge().

179 {
180  fInhibitItemLocks = true;
181 }
bool fInhibitItemLocks
Definition: Registry.h:183
void Registry::Init ( void  )

initialize the registry

Definition at line 870 of file Registry.cxx.

References fInhibitItemLocks, fIsReadOnly, and fName.

Referenced by Copy(), and Registry().

871 {
872 // initialize registry properties
873 
874  fName = "NoName";
875  fIsReadOnly = false;
876  fInhibitItemLocks = false;
877 }
bool fIsReadOnly
is read only?
Definition: Registry.h:182
bool fInhibitItemLocks
Definition: Registry.h:183
string fName
registry&#39;s name
Definition: Registry.h:181
bool Registry::IsLocked ( void  ) const

checks registry lock

Definition at line 173 of file Registry.cxx.

References fIsReadOnly.

Referenced by Append(), CanSetItem(), Clear(), Copy(), genie::GetValueOrUseDefault(), and Merge().

174 {
175  return fIsReadOnly;
176 }
bool fIsReadOnly
is read only?
Definition: Registry.h:182
bool Registry::ItemIsLocal ( RgKey  key) const

local or global?

Definition at line 193 of file Registry.cxx.

References HTMLTools::entry(), Exists(), fRegistry, LOG, and pDEBUG.

Referenced by genie::Algorithm::FindConfig(), and genie::GetValueOrUseDefault().

194 {
195  if( this->Exists(key) ) {
197  bool is_local = entry->second->IsLocal();
198  return is_local;
199  } else {
200 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
201  LOG("Registry", pDEBUG)
202  << "*** Was asked to check 'local' flag on non-existing item: ["
203  << key << "]";
204 #endif
205  }
206  return false;
207 }
map< RgKey, RegistryItemI * >::const_iterator RgIMapConstIter
Definition: Registry.h:50
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
RgIMap fRegistry
&#39;key&#39; -> &#39;value&#39; map
Definition: Registry.h:184
bool Exists(RgKey key) const
item with input key exists?
Definition: Registry.cxx:578
def entry(str)
Definition: HTMLTools.py:26
#define pDEBUG
Definition: Messenger.h:64
bool Registry::ItemIsLocked ( RgKey  key) const

check item lock

Definition at line 233 of file Registry.cxx.

References HTMLTools::entry(), Exists(), and fRegistry.

Referenced by CanSetItem(), and genie::SetRegistryItem().

234 {
235  if( this->Exists(key) ) {
237  bool is_locked = entry->second->IsLocked();
238  return is_locked;
239  } else {
240 /*
241  LOG("Registry", pDEBUG)
242  << "*** Was asked to check lock on non-existing item: ["
243  << key << "]";
244 */
245  }
246  return false;
247 }
map< RgKey, RegistryItemI * >::const_iterator RgIMapConstIter
Definition: Registry.h:50
RgIMap fRegistry
&#39;key&#39; -> &#39;value&#39; map
Definition: Registry.h:184
bool Exists(RgKey key) const
item with input key exists?
Definition: Registry.cxx:578
def entry(str)
Definition: HTMLTools.py:26
bool Registry::ItemLocksAreActive ( void  ) const

check if item locks are active

Definition at line 188 of file Registry.cxx.

References fInhibitItemLocks.

Referenced by CanSetItem().

189 {
190  return !fInhibitItemLocks;
191 }
bool fInhibitItemLocks
Definition: Registry.h:183
RgType_t Registry::ItemType ( RgKey  key) const

return item type

Definition at line 844 of file Registry.cxx.

References fRegistry, genie::kRgUndefined, and genie::RegistryItemI::TypeInfo().

Referenced by main().

845 {
846  RgIMapConstIter reg_iter = fRegistry.find(key);
847  if(reg_iter != fRegistry.end()) {
848  RegistryItemI * ri = reg_iter->second;
849  RgType_t type = ri->TypeInfo();
850  return type;
851  }
852  return kRgUndefined;
853 }
Registry item pABC.
Definition: RegistryItemI.h:30
enum genie::ERgType RgType_t
virtual RgType_t TypeInfo(void) const =0
map< RgKey, RegistryItemI * >::const_iterator RgIMapConstIter
Definition: Registry.h:50
RgIMap fRegistry
&#39;key&#39; -> &#39;value&#39; map
Definition: Registry.h:184
void Registry::LinkToGlobalDef ( RgKey  key)

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

Definition at line 221 of file Registry.cxx.

References HTMLTools::entry(), Exists(), fRegistry, LOG, and pWARN.

Referenced by genie::GetValueOrUseDefault().

222 {
223  if( this->Exists(key) ) {
225  entry->second->SetLocal(false);
226  } else {
227  LOG("Registry", pWARN)
228  << "*** Can't give 'global' status to non-existem item ["
229  << key << "]";
230  }
231 }
map< RgKey, RegistryItemI * >::const_iterator RgIMapConstIter
Definition: Registry.h:50
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
RgIMap fRegistry
&#39;key&#39; -> &#39;value&#39; map
Definition: Registry.h:184
#define pWARN
Definition: Messenger.h:61
bool Exists(RgKey key) const
item with input key exists?
Definition: Registry.cxx:578
def entry(str)
Definition: HTMLTools.py:26
void Registry::Lock ( void  )

locks the registry

Definition at line 163 of file Registry.cxx.

References fIsReadOnly.

Referenced by genie::GetValueOrUseDefault(), genie::AlgConfigPool::LoadRegistries(), and main().

164 {
165  fIsReadOnly = true;
166 }
bool fIsReadOnly
is read only?
Definition: Registry.h:182
void Registry::LockItem ( RgKey  key)

locks the registry item

Definition at line 249 of file Registry.cxx.

References HTMLTools::entry(), Exists(), fRegistry, LOG, and pWARN.

Referenced by main().

250 {
251  if( this->Exists(key) ) {
253  entry->second->Lock();
254  } else {
255  LOG("Registry", pWARN)
256  << "*** Can't lock non-existem item [" << key << "]";
257  }
258 }
map< RgKey, RegistryItemI * >::const_iterator RgIMapConstIter
Definition: Registry.h:50
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
RgIMap fRegistry
&#39;key&#39; -> &#39;value&#39; map
Definition: Registry.h:184
#define pWARN
Definition: Messenger.h:61
bool Exists(RgKey key) const
item with input key exists?
Definition: Registry.cxx:578
def entry(str)
Definition: HTMLTools.py:26
void Registry::Merge ( const Registry registry,
RgKey  pfx = "" 
)

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

Definition at line 802 of file Registry.cxx.

References genie::RgType::AsString(), CloneRegistryItem(), fRegistry, InhibitItemLocks(), IsLocked(), LOG, Name(), pINFO, pWARN, and moon_position_table_new3::second.

803 {
804 // Add the input registry entries (& their locks)
805 // and updated entries already present
806 
807  LOG("Registry", pINFO)
808  << "Appending registry " << registry.Name() << " to " << this->Name();
809 
810  if(this->IsLocked()) {
811  LOG("Registry", pWARN) << "Registry is locked. Can't copy input entries!";
812  return;
813  }
814 
815  this->InhibitItemLocks();
816 
817  RgIMapConstIter reg_iter;
818  for(reg_iter = registry.fRegistry.begin();
819  reg_iter != registry.fRegistry.end(); reg_iter++) {
820 
821  RgKey name = reg_iter->first;
822  RgKey new_name = prefix + name;
823 
824  RgType_t type = reg_iter -> second -> TypeInfo();
825  string stype = RgType::AsString(type);
826 
827  LOG("Registry", pINFO)
828  << "Copying [" << stype << "] item named = "
829  << name << " as " << new_name;
830 
831  RegistryItemI * cri = registry.CloneRegistryItem( name ) ; // cloned registry item
832 
833  if ( fRegistry.count( new_name ) > 0 ) {
834 
835  RegistryItemI * old_ri = fRegistry[new_name] ;
836  delete old_ri ;
837  }
838 
839  fRegistry[new_name] = cri ;
840 
841  } // loop on the incoming registry items
842 
843 }//____________________________________________________________________________
const XML_Char * name
Definition: expat.h:151
static string AsString(RgType_t rt)
bool IsLocked(void) const
checks registry lock
Definition: Registry.cxx:173
void InhibitItemLocks(void)
override individual item locks
Definition: Registry.cxx:178
Registry item pABC.
Definition: RegistryItemI.h:30
string Name(void) const
get the registry name
Definition: Registry.cxx:612
enum genie::ERgType RgType_t
map< RgKey, RegistryItemI * >::const_iterator RgIMapConstIter
Definition: Registry.h:50
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
RgIMap fRegistry
&#39;key&#39; -> &#39;value&#39; map
Definition: Registry.h:184
#define pINFO
Definition: Messenger.h:63
const XML_Char * prefix
Definition: expat.h:380
#define pWARN
Definition: Messenger.h:61
string RgKey
RegistryItemI * CloneRegistryItem(const RgKey &key) const
Properly clone a registry Item according to its type.
Definition: Registry.cxx:905
string Registry::Name ( void  ) const

get the registry name

Definition at line 612 of file Registry.cxx.

References fName.

Referenced by Append(), AssertExistence(), Clear(), CloneRegistryItem(), genie::Algorithm::Configure(), Copy(), genie::Algorithm::ExtractLocalConfig(), genie::Algorithm::ExtractLowerConfig(), Merge(), Print(), and SafeFind().

613 {
614  return fName;
615 }
string fName
registry&#39;s name
Definition: Registry.h:181
int Registry::NEntries ( void  ) const

get number of items

Definition at line 597 of file Registry.cxx.

References fRegistry.

Referenced by genie::Algorithm::Configure().

598 {
599  RgIMapSizeType reg_size = fRegistry.size();
600  return (const int) reg_size;
601 }
RgIMap fRegistry
&#39;key&#39; -> &#39;value&#39; map
Definition: Registry.h:184
map< RgKey, RegistryItemI * >::size_type RgIMapSizeType
Definition: Registry.h:48
void Registry::operator() ( RgKey  key,
int  item 
)

Definition at line 125 of file Registry.cxx.

References Set().

Referenced by operator()().

126 {
127  this->Set(key, item);
128 }
void Set(RgIMapPair entry)
Definition: Registry.cxx:282
void Registry::operator() ( RgKey  key,
bool  item 
)

Definition at line 130 of file Registry.cxx.

References Set().

131 {
132  this->Set(key, item);
133 }
void Set(RgIMapPair entry)
Definition: Registry.cxx:282
void Registry::operator() ( RgKey  key,
double  item 
)

Definition at line 135 of file Registry.cxx.

References findDuplicateFiles::key, operator()(), and Set().

136 {
137  this->Set(key, item);
138 }
void Set(RgIMapPair entry)
Definition: Registry.cxx:282
void genie::Registry::operator() ( RgKey  key,
const char *  item 
)
void Registry::operator() ( RgKey  key,
string  item 
)

Definition at line 146 of file Registry.cxx.

References Set().

147 {
148  this->Set(key, item);
149 }
void Set(RgIMapPair entry)
Definition: Registry.cxx:282
Registry & Registry::operator+= ( const Registry reg)

Definition at line 157 of file Registry.cxx.

References Append().

158 {
159  this->Append(reg);
160  return (*this);
161 }
void Append(const Registry &, RgKey pfx="")
append the input registry. Entries already in the registry are not updated
Definition: Registry.cxx:758
Registry & Registry::operator= ( const Registry reg)

Definition at line 151 of file Registry.cxx.

References Copy().

152 {
153  this->Copy(reg);
154  return (*this);
155 }
void Copy(const Registry &)
copy the input registry
Definition: Registry.cxx:737
void Registry::OverrideGlobalDef ( RgKey  key)

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

Definition at line 209 of file Registry.cxx.

References HTMLTools::entry(), Exists(), fRegistry, LOG, and pWARN.

210 {
211  if( this->Exists(key) ) {
213  entry->second->SetLocal(true);
214  } else {
215  LOG("Registry", pWARN)
216  << "*** Can't give 'local' status to non-existem item ["
217  << key << "]";
218  }
219 }
map< RgKey, RegistryItemI * >::const_iterator RgIMapConstIter
Definition: Registry.h:50
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
RgIMap fRegistry
&#39;key&#39; -> &#39;value&#39; map
Definition: Registry.h:184
#define pWARN
Definition: Messenger.h:61
bool Exists(RgKey key) const
item with input key exists?
Definition: Registry.cxx:578
def entry(str)
Definition: HTMLTools.py:26
void Registry::Print ( ostream &  stream) const

print the registry to stream

Definition at line 694 of file Registry.cxx.

References genie::RgType::AsString(), allTimeWatchdog::endl, fInhibitItemLocks, fIsReadOnly, fRegistry, findDuplicateFiles::key, LOG, Name(), pDEBUG, pERROR, genie::RegistryItemI::Print(), string, and genie::RegistryItemI::TypeInfo().

Referenced by genie::operator<<().

695 {
696 // Prints the registry to the specified stream
697 //
698  stream << endl;
699  stream << "[-] Registry name: [" << Name() << "]";
700 
701  stream << " - Write Status: ";
702  if(fIsReadOnly) { stream << "[locked]"; }
703  else { stream << "[unlocked]"; }
704 
705  stream << " - Inhibited Item Locking: ";
706  if(fInhibitItemLocks) { stream << "[on]"; }
707  else { stream << "[off]"; }
708 
709  stream << " - # entries: " << setfill(' ') << setw(3) << fRegistry.size()
710  << endl;
711 
712  RgIMapConstIter rcit = fRegistry.begin();
713  for( ; rcit != fRegistry.end(); rcit++) {
714 
715  RgKey key = rcit->first;
716  RegistryItemI * ritem = rcit->second;
717  if(ritem) {
718  RgType_t type = ritem->TypeInfo();
719  string stype = RgType::AsString(type);
720 
721  string key_lbl = string("> ") + key;
722  string type_lbl = string("[") + stype + string("] ");
723 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
724  LOG("Registry", pDEBUG)
725  << "Printing [" << stype << "] item named = " << key;
726 #endif
727  stream << " |" << setfill('-') << setw(50) << key_lbl
728  << setfill(' ') << setw(10) << type_lbl;
729  ritem->Print(stream);
730  stream << endl;
731  } else {
732  LOG("Registry", pERROR) << "Null RegistryItemI with key = " << key;
733  }
734  }// registry iterator
735 }
bool fIsReadOnly
is read only?
Definition: Registry.h:182
static string AsString(RgType_t rt)
#define pERROR
Definition: Messenger.h:60
Registry item pABC.
Definition: RegistryItemI.h:30
string Name(void) const
get the registry name
Definition: Registry.cxx:612
enum genie::ERgType RgType_t
virtual RgType_t TypeInfo(void) const =0
map< RgKey, RegistryItemI * >::const_iterator RgIMapConstIter
Definition: Registry.h:50
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
RgIMap fRegistry
&#39;key&#39; -> &#39;value&#39; map
Definition: Registry.h:184
bool fInhibitItemLocks
Definition: Registry.h:183
string RgKey
virtual void Print(ostream &) const =0
#define pDEBUG
Definition: Messenger.h:64
enum BeamMode string
void Registry::RestoreItemLocks ( void  )

restore individual item locks

Definition at line 183 of file Registry.cxx.

References fInhibitItemLocks.

184 {
185  fInhibitItemLocks = false;
186 }
bool fInhibitItemLocks
Definition: Registry.h:183
RgIMapConstIter Registry::SafeFind ( RgKey  key) const

Definition at line 565 of file Registry.cxx.

References HTMLTools::entry(), exit(), fRegistry, genie::gAbortingInErr, LOG, Name(), and pFATAL.

Referenced by Get().

566 {
568  if (entry!=fRegistry.end()) {
569  return entry;
570  }
571  LOG("Registry/SafeFind", pFATAL)
572  << "*** Key: " << key
573  << " does not exist in registry: " << this->Name();
574  gAbortingInErr = true;
575  exit(1);
576 }
#define pFATAL
Definition: Messenger.h:57
string Name(void) const
get the registry name
Definition: Registry.cxx:612
map< RgKey, RegistryItemI * >::const_iterator RgIMapConstIter
Definition: Registry.h:50
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
RgIMap fRegistry
&#39;key&#39; -> &#39;value&#39; map
Definition: Registry.h:184
exit(0)
bool gAbortingInErr
Definition: Messenger.cxx:56
def entry(str)
Definition: HTMLTools.py:26
void Registry::Set ( RgIMapPair  entry)

Definition at line 282 of file Registry.cxx.

References CanSetItem(), DeleteEntry(), fRegistry, findDuplicateFiles::key, LOG, and pWARN.

Referenced by genie::AlgConfigPool::AddBasicParameter(), genie::AlgConfigPool::AddRootObjParameter(), genie::HadronTransporter::Configure(), genie::EmpiricalMECPXSec2015::Configure(), genie::QPMDISPXSec::Configure(), genie::QPMDMDISPXSec::Configure(), genie::SmithMonizQELCCXSec::Configure(), genie::QELEventGeneratorSM::Configure(), genie::SmithMonizQELCCPXSec::Configure(), genie::NuclearModelMap::Configure(), genie::GetValueOrUseDefault(), IncrementCoefficients(), main(), operator()(), Set(), genie::SetRegistryItem(), and testReconfigInCommonPool().

283 {
284  RgKey key = entry.first;
285  if( this->CanSetItem(key) ) {
286  this->DeleteEntry(key);
287  fRegistry.insert(entry);
288  } else {
289  LOG("Registry", pWARN)
290  << "*** Registry item [" << key << "] can not be set";
291  }
292 }
bool DeleteEntry(RgKey key)
delete the spcified item
Definition: Registry.cxx:584
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
RgIMap fRegistry
&#39;key&#39; -> &#39;value&#39; map
Definition: Registry.h:184
#define pWARN
Definition: Messenger.h:61
string RgKey
bool CanSetItem(RgKey key) const
can I set the specifed item?
Definition: Registry.cxx:271
def entry(str)
Definition: HTMLTools.py:26
void Registry::Set ( RgKey  key,
RgBool  item 
)

Definition at line 294 of file Registry.cxx.

References genie::SetRegistryItem().

295 {
296  SetRegistryItem(this, key, item); // call templated set method
297 }
void SetRegistryItem(Registry *r, RgKey key, T item)
Definition: Registry.cxx:54
void Registry::Set ( RgKey  key,
RgInt  item 
)

Definition at line 299 of file Registry.cxx.

References genie::SetRegistryItem().

300 {
301  SetRegistryItem(this, key, item); // call templated set method
302 }
void SetRegistryItem(Registry *r, RgKey key, T item)
Definition: Registry.cxx:54
void Registry::Set ( RgKey  key,
RgDbl  item 
)

Definition at line 304 of file Registry.cxx.

References genie::SetRegistryItem().

305 {
306  SetRegistryItem(this, key, item); // call templated set method
307 }
void SetRegistryItem(Registry *r, RgKey key, T item)
Definition: Registry.cxx:54
void Registry::Set ( RgKey  key,
RgStr  item 
)

Definition at line 315 of file Registry.cxx.

References genie::SetRegistryItem().

316 {
317  SetRegistryItem(this, key, item); // call templated set method
318 }
void SetRegistryItem(Registry *r, RgKey key, T item)
Definition: Registry.cxx:54
void Registry::Set ( RgKey  key,
RgAlg  item 
)

Definition at line 320 of file Registry.cxx.

References genie::SetRegistryItem().

321 {
322  SetRegistryItem(this, key, item); // call templated set method
323 }
void SetRegistryItem(Registry *r, RgKey key, T item)
Definition: Registry.cxx:54
void Registry::Set ( RgKey  key,
RgCChAr  item 
)

Definition at line 309 of file Registry.cxx.

References Set().

310 {
311  RgStr item2 = RgStr(item); // "const char *" -> "string"
312  this->Set(key, item2);
313 }
string RgStr
void Set(RgIMapPair entry)
Definition: Registry.cxx:282
void Registry::Set ( RgKey  key,
RgH1F  item 
)

Definition at line 325 of file Registry.cxx.

References genie::SetRegistryItem().

326 {
327  SetRegistryItem(this, key, item); // call templated set method
328 }
void SetRegistryItem(Registry *r, RgKey key, T item)
Definition: Registry.cxx:54
void Registry::Set ( RgKey  key,
RgH2F  item 
)

Definition at line 330 of file Registry.cxx.

References genie::SetRegistryItem().

331 {
332  SetRegistryItem(this, key, item); // call templated set method
333 }
void SetRegistryItem(Registry *r, RgKey key, T item)
Definition: Registry.cxx:54
void Registry::Set ( RgKey  key,
RgTree  item 
)

Definition at line 335 of file Registry.cxx.

References genie::SetRegistryItem().

336 {
337  SetRegistryItem(this, key, item); // call templated set method
338 }
void SetRegistryItem(Registry *r, RgKey key, T item)
Definition: Registry.cxx:54
void Registry::SetName ( string  name)

set the registry name

Definition at line 603 of file Registry.cxx.

References fIsReadOnly, fName, LOG, and pWARN.

Referenced by genie::AlgConfigPool::LoadRegistries().

604 {
605  if(! fIsReadOnly) fName = name;
606  else {
607  LOG("Registry", pWARN)
608  << "*** Registry is locked - Can not change its name";
609  }
610 }
const XML_Char * name
Definition: expat.h:151
bool fIsReadOnly
is read only?
Definition: Registry.h:182
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
#define pWARN
Definition: Messenger.h:61
string fName
registry&#39;s name
Definition: Registry.h:181
void Registry::UnLock ( void  )

unlocks the registry (doesn't unlock items)

Definition at line 168 of file Registry.cxx.

References fIsReadOnly.

Referenced by genie::GetValueOrUseDefault(), main(), and testReconfigInCommonPool().

169 {
170  fIsReadOnly = false;
171 }
bool fIsReadOnly
is read only?
Definition: Registry.h:182
void Registry::UnLockItem ( RgKey  key)

unlocks the registry item

Definition at line 260 of file Registry.cxx.

References HTMLTools::entry(), Exists(), fRegistry, LOG, and pWARN.

261 {
262  if( this->Exists(key) ) {
264  entry->second->UnLock();
265  } else {
266  LOG("Registry", pWARN)
267  << "*** Can't unlock non-existem item [" << key << "]";
268  }
269 }
map< RgKey, RegistryItemI * >::const_iterator RgIMapConstIter
Definition: Registry.h:50
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
RgIMap fRegistry
&#39;key&#39; -> &#39;value&#39; map
Definition: Registry.h:184
#define pWARN
Definition: Messenger.h:61
bool Exists(RgKey key) const
item with input key exists?
Definition: Registry.cxx:578
def entry(str)
Definition: HTMLTools.py:26

Friends And Related Function Documentation

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

Definition at line 92 of file Registry.cxx.

93  {
94  registry.Print(stream);
95  return stream;
96  }
void Print(ostream &stream) const
print the registry to stream
Definition: Registry.cxx:694

Member Data Documentation

bool genie::Registry::fInhibitItemLocks
private

Definition at line 183 of file Registry.h.

Referenced by Copy(), InhibitItemLocks(), Init(), ItemLocksAreActive(), Print(), and RestoreItemLocks().

bool genie::Registry::fIsReadOnly
private

is read only?

Definition at line 182 of file Registry.h.

Referenced by Copy(), DeleteEntry(), Init(), IsLocked(), Lock(), Print(), SetName(), and UnLock().

string genie::Registry::fName
private

registry's name

Definition at line 181 of file Registry.h.

Referenced by Copy(), Init(), Name(), and SetName().

RgIMap genie::Registry::fRegistry
private

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