GENIEGenerator
|
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 () |
Registry & | operator= (const Registry ®) |
Registry & | operator+= (const Registry ®) |
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 RgIMap & | GetItemMap (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 | |
RegistryItemI * | CloneRegistryItem (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 ®istry) |
A registry. Provides the container for algorithm configuration parameters.
Definition at line 65 of file Registry.h.
Registry::Registry | ( | ) |
Registry::Registry | ( | string | name, |
bool | isReadOnly = true |
||
) |
Definition at line 90 of file Registry.cxx.
Registry::Registry | ( | const Registry & | registry | ) |
Definition at line 98 of file Registry.cxx.
References Copy().
|
virtual |
append the input registry. Entries already in the registry are not updated
Definition at line 743 of file Registry.cxx.
References genie::RgType::AsString(), CloneRegistryItem(), fRegistry, InhibitItemLocks(), IsLocked(), LOG, Name(), pERROR, pINFO, pWARN, and genie::units::second.
Referenced by Copy(), and operator+=().
void Registry::AssertExistence | ( | RgKey | key0 | ) | const |
Definition at line 602 of file Registry.cxx.
References Exists(), LOG, Name(), pERROR, and pFATAL.
Referenced by AssertExistence().
bool Registry::CanSetItem | ( | RgKey | key | ) | const |
can I set the specifed item?
Definition at line 256 of file Registry.cxx.
References IsLocked(), ItemIsLocked(), and ItemLocksAreActive().
Referenced by Set().
void Registry::Clear | ( | bool | force = false | ) |
clear the registry
Definition at line 864 of file Registry.cxx.
References fRegistry, IsLocked(), LOG, Name(), pINFO, and pWARN.
Referenced by Copy(), and ~Registry().
|
private |
Properly clone a registry Item according to its type.
Definition at line 890 of file Registry.cxx.
References genie::RgType::AsString(), fRegistry, GetAlg(), GetBool(), GetDouble(), GetH1F(), GetH2F(), GetInt(), GetString(), GetTree(), genie::RegistryItemI::IsLocked(), genie::kRgAlg, genie::kRgBool, genie::kRgDbl, genie::kRgH1F, genie::kRgH2F, genie::kRgInt, genie::kRgStr, genie::kRgTree, LOG, Name(), pDEBUG, pERROR, pFATAL, genie::units::second, and genie::RegistryItemI::TypeInfo().
Referenced by Append(), and Merge().
void Registry::Copy | ( | const Registry & | registry | ) |
copy the input registry
Definition at line 722 of file Registry.cxx.
References Append(), Clear(), fInhibitItemLocks, fIsReadOnly, fName, Init(), IsLocked(), LOG, Name(), pINFO, and pWARN.
Referenced by main(), operator=(), and Registry().
void Registry::CopyToFolder | ( | TFolder * | folder | ) | const |
Definition at line 626 of file Registry.cxx.
References genie::RgType::AsString(), RgAlg::config, fRegistry, GetAlg(), GetBool(), GetDouble(), GetInt(), GetString(), 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 genie::NtpMCJobConfig::Load().
bool Registry::DeleteEntry | ( | RgKey | key | ) |
delete the spcified item
Definition at line 569 of file Registry.cxx.
References Exists(), fIsReadOnly, and fRegistry.
Referenced by Set().
bool Registry::Exists | ( | RgKey | key | ) | const |
item with input key exists?
Definition at line 563 of file Registry.cxx.
References fRegistry.
Referenced by AssertExistence(), genie::HybridXSecAlgorithm::ChooseXSecAlg(), genie::HadronTransporter::Configure(), DeleteEntry(), genie::utils::config::GetDoubleKeyPDG(), genie::utils::config::GetDoubleKeyRangeNucA(), genie::GetValueOrUseDefault(), ItemIsLocal(), ItemIsLocked(), LinkToGlobalDef(), genie::HybridXSecAlgorithm::LoadConfig(), LockItem(), OverrideGlobalDef(), and UnLockItem().
create list with all keys containing 'key_part'
Definition at line 840 of file Registry.cxx.
References fRegistry.
Referenced by genie::XSecScaleMap::LoadConfig(), genie::CascadeReweight::LoadConfig(), genie::QvalueShifter::LoadConfig(), genie::Decayer::LoadConfig(), and main().
void Registry::Get | ( | RgKey | key, |
const RegistryItemI *& | item | ||
) | const |
Definition at line 325 of file Registry.cxx.
References SafeFind().
Referenced by CheckUnitarityLimit(), GetAlg(), GetBool(), GetDouble(), GetInt(), GetString(), genie::GetValueOrUseDefault(), and main().
Definition at line 331 of file Registry.cxx.
References genie::RegistryItem< T >::Data(), LOG, pDEBUG, and SafeFind().
Definition at line 347 of file Registry.cxx.
References genie::RegistryItem< T >::Data(), LOG, pDEBUG, and SafeFind().
Definition at line 363 of file Registry.cxx.
References genie::RegistryItem< T >::Data(), LOG, pDEBUG, and SafeFind().
Definition at line 379 of file Registry.cxx.
References genie::RegistryItem< T >::Data(), LOG, pDEBUG, and SafeFind().
Definition at line 395 of file Registry.cxx.
References genie::RegistryItem< T >::Data(), LOG, pDEBUG, and SafeFind().
Definition at line 412 of file Registry.cxx.
References genie::RegistryItem< T >::Data(), LOG, pDEBUG, pWARN, and SafeFind().
Definition at line 428 of file Registry.cxx.
References genie::RegistryItem< T >::Data(), LOG, pDEBUG, pWARN, and SafeFind().
Definition at line 444 of file Registry.cxx.
References genie::RegistryItem< T >::Data(), LOG, pDEBUG, pWARN, and SafeFind().
Definition at line 488 of file Registry.cxx.
References Get().
Referenced by CloneRegistryItem(), CopyToFolder(), genie::XSecScaleMap::LoadConfig(), genie::IBDXSecMap::LoadConfig(), genie::NuclearModelMap::LoadConfig(), genie::PauliBlocker::LoadModelType(), and genie::utils::nuclear::NuclQELXSecSuppression().
Definition at line 545 of file Registry.cxx.
References genie::GetValueOrUseDefault().
Definition at line 460 of file Registry.cxx.
References Get().
Referenced by CloneRegistryItem(), CopyToFolder(), genie::utils::gsl::d2XSecRESFast_dWQ2_E::d2XSecRESFast_dWQ2_E(), genie::Decayer::LoadConfig(), and main().
Definition at line 525 of file Registry.cxx.
References genie::GetValueOrUseDefault().
Referenced by genie::utils::gsl::d2XSecRESFast_dWQ2_E::d2XSecRESFast_dWQ2_E(), and main().
Definition at line 474 of file Registry.cxx.
References Get().
Referenced by genie::PDGLibrary::AddDarkSector(), genie::PDGLibrary::AddHNL(), CloneRegistryItem(), CopyToFolder(), genie::utils::gsl::d2XSecRESFast_dWQ2_E::d2XSecRESFast_dWQ2_E(), genie::GVldContext::Decode(), genie::TabulatedLabFrameHadronTensor::dSigma_dT_dCosTheta_rosenbluth(), genie::KPhaseSpace::GetTMaxDFR(), genie::NewQELXSec::Integrate(), and main().
Definition at line 535 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().
Definition at line 495 of file Registry.cxx.
References genie::RegistryItem< T >::Data(), and fRegistry.
Referenced by CloneRegistryItem().
Definition at line 505 of file Registry.cxx.
References genie::RegistryItem< T >::Data(), and fRegistry.
Referenced by CloneRegistryItem().
Definition at line 467 of file Registry.cxx.
References Get().
Referenced by genie::EventGeneratorListAssembler::AssembleGeneratorList(), CloneRegistryItem(), CopyToFolder(), and main().
Definition at line 530 of file Registry.cxx.
References genie::GetValueOrUseDefault().
Referenced by main().
|
inline |
Definition at line 161 of file Registry.h.
References fRegistry.
Referenced by genie::Algorithm::ExtractLocalConfig(), genie::Algorithm::ExtractLowerConfig(), genie::Algorithm::FindConfig(), genie::FGMBodekRitchie::LoadConfig(), genie::BostedChristyEMPXSec::LoadConfig(), genie::NuclearModelMap::LoadConfig(), and genie::SmithMonizUtils::LoadConfig().
Definition at line 481 of file Registry.cxx.
References Get().
Referenced by CloneRegistryItem(), CopyToFolder(), genie::Algorithm::FindConfig(), genie::NewQELXSec::Integrate(), and genie::P33PaschosLalakulichPXSec::XSec().
Definition at line 540 of file Registry.cxx.
References genie::GetValueOrUseDefault().
Referenced by main().
Definition at line 515 of file Registry.cxx.
References genie::RegistryItem< T >::Data(), and fRegistry.
Referenced by CloneRegistryItem().
void Registry::InhibitItemLocks | ( | void | ) |
override individual item locks
Definition at line 163 of file Registry.cxx.
References fInhibitItemLocks.
Referenced by Append(), main(), and Merge().
void Registry::Init | ( | void | ) |
initialize the registry
Definition at line 855 of file Registry.cxx.
References fInhibitItemLocks, fIsReadOnly, and fName.
Referenced by Copy(), and Registry().
bool Registry::IsLocked | ( | void | ) | const |
checks registry lock
Definition at line 158 of file Registry.cxx.
References fIsReadOnly.
Referenced by Append(), CanSetItem(), Clear(), Copy(), genie::GetValueOrUseDefault(), and Merge().
bool Registry::ItemIsLocal | ( | RgKey | key | ) | const |
local or global?
Definition at line 178 of file Registry.cxx.
References Exists(), fRegistry, LOG, and pDEBUG.
Referenced by genie::Algorithm::FindConfig(), and genie::GetValueOrUseDefault().
bool Registry::ItemIsLocked | ( | RgKey | key | ) | const |
check item lock
Definition at line 218 of file Registry.cxx.
References Exists(), and fRegistry.
Referenced by CanSetItem(), and genie::SetRegistryItem().
bool Registry::ItemLocksAreActive | ( | void | ) | const |
check if item locks are active
Definition at line 173 of file Registry.cxx.
References fInhibitItemLocks.
Referenced by CanSetItem().
return item type
Definition at line 829 of file Registry.cxx.
References fRegistry, genie::kRgUndefined, and genie::RegistryItemI::TypeInfo().
Referenced by main().
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.
References Exists(), fRegistry, LOG, and pWARN.
Referenced by genie::GetValueOrUseDefault().
void Registry::Lock | ( | void | ) |
locks the registry
Definition at line 148 of file Registry.cxx.
References fIsReadOnly.
Referenced by genie::GetValueOrUseDefault(), genie::AlgConfigPool::LoadRegistries(), and main().
void Registry::LockItem | ( | RgKey | key | ) |
locks the registry item
Definition at line 234 of file Registry.cxx.
References Exists(), fRegistry, LOG, and pWARN.
Referenced by main().
append the input registry. Entries already in the registry are updated
Definition at line 787 of file Registry.cxx.
References genie::RgType::AsString(), CloneRegistryItem(), fRegistry, InhibitItemLocks(), IsLocked(), LOG, Name(), pINFO, pWARN, and genie::units::second.
string Registry::Name | ( | void | ) | const |
get the registry name
Definition at line 597 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().
int Registry::NEntries | ( | void | ) | const |
get number of items
Definition at line 582 of file Registry.cxx.
References fRegistry.
Referenced by genie::Algorithm::Configure().
void Registry::operator() | ( | RgKey | key, |
int | item | ||
) |
void Registry::operator() | ( | RgKey | key, |
bool | item | ||
) |
void Registry::operator() | ( | RgKey | key, |
double | item | ||
) |
void Registry::operator() | ( | RgKey | key, |
const char * | item | ||
) |
void Registry::operator() | ( | RgKey | key, |
string | item | ||
) |
Definition at line 142 of file Registry.cxx.
References Append().
Definition at line 136 of file Registry.cxx.
References Copy().
void Registry::OverrideGlobalDef | ( | RgKey | key | ) |
let item override global default (i.e. a 'local' item)
Definition at line 194 of file Registry.cxx.
References Exists(), fRegistry, LOG, and pWARN.
void Registry::Print | ( | ostream & | stream | ) | const |
print the registry to stream
Definition at line 679 of file Registry.cxx.
References genie::RgType::AsString(), fInhibitItemLocks, fIsReadOnly, fRegistry, LOG, Name(), pDEBUG, pERROR, genie::RegistryItemI::Print(), and genie::RegistryItemI::TypeInfo().
Referenced by genie::operator<<().
void Registry::RestoreItemLocks | ( | void | ) |
restore individual item locks
Definition at line 168 of file Registry.cxx.
References fInhibitItemLocks.
RgIMapConstIter Registry::SafeFind | ( | RgKey | key | ) | const |
Definition at line 550 of file Registry.cxx.
References fRegistry, genie::gAbortingInErr, LOG, Name(), and pFATAL.
Referenced by Get().
void Registry::Set | ( | RgIMapPair | entry | ) |
Definition at line 267 of file Registry.cxx.
References CanSetItem(), DeleteEntry(), fRegistry, 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::NuclearModelMap::Configure(), genie::SmithMonizQELCCPXSec::Configure(), genie::GetValueOrUseDefault(), IncrementCoefficients(), main(), operator()(), Set(), genie::SetRegistryItem(), and testReconfigInCommonPool().
Definition at line 279 of file Registry.cxx.
References genie::SetRegistryItem().
Definition at line 284 of file Registry.cxx.
References genie::SetRegistryItem().
Definition at line 289 of file Registry.cxx.
References genie::SetRegistryItem().
Definition at line 300 of file Registry.cxx.
References genie::SetRegistryItem().
Definition at line 305 of file Registry.cxx.
References genie::SetRegistryItem().
Definition at line 310 of file Registry.cxx.
References genie::SetRegistryItem().
Definition at line 315 of file Registry.cxx.
References genie::SetRegistryItem().
Definition at line 320 of file Registry.cxx.
References genie::SetRegistryItem().
void Registry::SetName | ( | string | name | ) |
set the registry name
Definition at line 588 of file Registry.cxx.
References fIsReadOnly, fName, LOG, and pWARN.
Referenced by genie::AlgConfigPool::LoadRegistries().
void Registry::UnLock | ( | void | ) |
unlocks the registry (doesn't unlock items)
Definition at line 153 of file Registry.cxx.
References fIsReadOnly.
Referenced by genie::GetValueOrUseDefault(), main(), and testReconfigInCommonPool().
void Registry::UnLockItem | ( | RgKey | key | ) |
unlocks the registry item
Definition at line 245 of file Registry.cxx.
References Exists(), fRegistry, LOG, and pWARN.
|
friend |
Definition at line 77 of file Registry.cxx.
|
private |
Definition at line 182 of file Registry.h.
Referenced by Copy(), InhibitItemLocks(), Init(), ItemLocksAreActive(), Print(), and RestoreItemLocks().
|
private |
is read only?
Definition at line 181 of file Registry.h.
Referenced by Copy(), DeleteEntry(), Init(), IsLocked(), Lock(), Print(), SetName(), and UnLock().
|
private |
|
private |
'key' -> 'value' map
Definition at line 183 of file Registry.h.
Referenced by Append(), Clear(), CloneRegistryItem(), CopyToFolder(), DeleteEntry(), Exists(), FindKeys(), GetH1F(), GetH2F(), GetItemMap(), GetTree(), ItemIsLocal(), ItemIsLocked(), ItemType(), LinkToGlobalDef(), LockItem(), Merge(), NEntries(), OverrideGlobalDef(), Print(), SafeFind(), Set(), and UnLockItem().