Public Member Functions | |
std::string | getEnvVar (std::string name) |
int | getEnvVarAsLong (std::string name, long defaultValue) |
double | getEnvVarAsDouble (std::string name, double defaultValue) |
void | flush () |
Static Public Member Functions | |
static EnvVarCache & | getInstance () |
Protected Member Functions | |
std::string | _doGetEnvVar (std::string name) |
void | _loadDataIntoCache () |
void | _clearCachedData () |
void | _reloadIfNeeded () |
Protected Attributes | |
CachePolicy | _policy |
bool | _cacheIsEmpty |
boost::mutex | _cacheMutex |
Private Member Functions | |
EnvVarCache (novadaq::CachePolicy policy) | |
EnvVarCache (EnvVarCache const &) | |
void | operator= (EnvVarCache const &) |
Private Attributes | |
std::map< std::string, std::string > | _envVarMap |
A singleton class that serves as a cache of environmental variable values.
Definition at line 18 of file EnvVarCache.h.
|
explicitprivate |
Default constructor (private)
Definition at line 21 of file EnvVarCache.cpp.
References novadaq::CacheManager::getInstance(), and novadaq::CacheManager::registerCache().
|
private |
|
protectedvirtual |
Clears the data in the cache.
Implements novadaq::Cache.
Definition at line 137 of file EnvVarCache.cpp.
References _envVarMap.
|
protected |
Returns the value of the environmental variable with the specified name, for internal use.
Definition at line 92 of file EnvVarCache.cpp.
References _envVarMap, cet::getenv(), and string.
Referenced by getEnvVar(), getEnvVarAsDouble(), and getEnvVarAsLong().
|
protectedvirtual |
Loads a new set of values into the cache.
Implements novadaq::Cache.
Definition at line 125 of file EnvVarCache.cpp.
|
protectedinherited |
Reloads the cache if needed.
Definition at line 25 of file Cache.cpp.
References novadaq::Cache::_cacheIsEmpty, novadaq::Cache::_clearCachedData(), novadaq::Cache::_loadDataIntoCache(), novadaq::Cache::_policy, novadaq::CachePolicy::cacheUpdated(), and novadaq::CachePolicy::isExpired().
Referenced by novadaq::Cache::~Cache().
|
inherited |
Flushes the cache. (Removes any saved data.)
Definition at line 8 of file Cache.cpp.
References novadaq::Cache::_cacheIsEmpty, novadaq::Cache::_cacheMutex, and novadaq::Cache::_clearCachedData().
Referenced by CacheTests::testEnvVarCacheBasic(), and CacheTests::testEnvVarCacheNumbers().
std::string novadaq::EnvVarCache::getEnvVar | ( | std::string | name | ) |
Returns the value of the environmental variable with the specified name. If the env var is not found, an empty string is returned.
Definition at line 33 of file EnvVarCache.cpp.
References novadaq::Cache::_cacheMutex, and _doGetEnvVar().
Referenced by dbutils::gui::BasicEditorDisplay::_confirmSave(), dbutils::daqappmgr::ConfiguredProcessList::_fetchProcessData(), dbutils::daqconfig::DLRunConfig::_fetchStreamData(), dbutils::daqconfig::BNEVBRunConfig::_fetchSystemData(), dbutils::daqconfig::DLRunConfig::_fetchSystemData(), dbutils::daqconfig::GTRunConfig::_fetchTriggerData(), dbutils::gui::ConfigDataTableModel::ConfigDataTableModel(), dbutils::daqconfig::ConfigDataTree::ConfigDataTree(), dbutils::daqconfig::NamedConfigUtils::copyGlobalConfig(), dbutils::daqconfig::NamedConfigUtils::copySubsystemConfig(), dbutils::gui::DAQConfigEditorDisplay::DAQConfigEditorDisplay(), dbutils::gui::DBParamsGroupBox::DBParamsGroupBox(), dbutils::gui::DCSConfigEditorDisplay::DCSConfigEditorDisplay(), dbutils::gui::DCSConfigEditorDisplay::generateRecipeScripts(), dbutils::daqconfig::NamedConfigUtils::getAvailableGlobalConfigs(), dbutils::daqconfig::NamedConfigUtils::getAvailableSubsystemConfigs(), dbutils::daqconfig::NamedConfigUtils::getConfigDetailAncestry(), dbutils::daqconfig::NamedConfigUtils::getConfigIdAncestry(), dbutils::daqconfig::NamedConfigUtils::getGlobalConfigDetailAncestry(), dbutils::daqconfig::NamedConfigUtils::getGlobalConfigId(), dbutils::daqconfig::NamedConfigUtils::getGlobalConfigIdAncestry(), dbutils::daqconfig::NamedConfigUtils::getNewestGlobalConfigFromGlobalId(), dbutils::daqconfig::NamedConfigUtils::getNewestGlobalConfigFromSubsystemId(), dbutils::daqconfig::NamedConfigUtils::getNewestGlobalConfigFromSubsystemName(), dbutils::daqconfig::NamedConfigUtils::getNewestInstanceOfLatestUsedDAQGlobalConfig(), dbutils::daqconfig::NamedConfigUtils::getRecentGlobalConfigs(), dbutils::daqconfig::NamedConfigUtils::getSubsystemConfigId(), dbutils::daqconfig::NamedConfigUtils::getSubsystemConfigIdAncestry(), dbutils::daqconfig::NamedConfigUtils::getSubsystemConfigIdAncestryFromGlobalId(), dbutils::daqconfig::NamedConfigUtils::getSubsystemConfigIdFromGlobalId(), dbutils::daqconfig::NamedConfigUtils::getSubsystemConfigIdFromGlobalName(), dbutils::daqconfig::NamedConfigUtils::getSubsystemConfigIdsFromGlobalId(), dbutils::daqconfig::NamedConfigUtils::getSubsystemConfigsFromGlobalId(), dbutils::daqconfig::NamedConfigUtils::incrementUsageCount(), dbutils::daqconfig::NamedConfigUtils::markConfigDone(), dbutils::gui::BasicEditorDisplay::reactToDataChange(), dbutils::daqconfig::ConfigDataTree::saveValues(), CacheTests::testEnvVarCacheBasic(), and CacheTests::testEnvVarCacheNumbers().
double novadaq::EnvVarCache::getEnvVarAsDouble | ( | std::string | name, |
double | defaultValue | ||
) |
Returns the value of the environmental variable with the specified name with the value interpreted as a double-precision number.
Definition at line 70 of file EnvVarCache.cpp.
References novadaq::Cache::_cacheMutex, _doGetEnvVar(), and string.
Referenced by CacheTests::testEnvVarCacheNumbers().
int novadaq::EnvVarCache::getEnvVarAsLong | ( | std::string | name, |
long | defaultValue | ||
) |
Returns the value of the environmental variable with the specified name with the value interpreted as a long integer.
Definition at line 48 of file EnvVarCache.cpp.
References novadaq::Cache::_cacheMutex, _doGetEnvVar(), and string.
Referenced by CacheTests::testEnvVarCacheNumbers().
|
static |
Returns the single instance of the EnvVarCache.
Definition at line 12 of file EnvVarCache.cpp.
Referenced by dbutils::gui::BasicEditorDisplay::_confirmSave(), dbutils::daqappmgr::ConfiguredProcessList::_fetchProcessData(), dbutils::daqconfig::DLRunConfig::_fetchStreamData(), dbutils::daqconfig::BNEVBRunConfig::_fetchSystemData(), dbutils::daqconfig::DLRunConfig::_fetchSystemData(), dbutils::daqconfig::GTRunConfig::_fetchTriggerData(), dbutils::gui::ConfigDataTableModel::ConfigDataTableModel(), dbutils::daqconfig::ConfigDataTree::ConfigDataTree(), gov::fnal::cd::rms::provider::DPSingleton::connect_participant(), dbutils::daqconfig::NamedConfigUtils::copyGlobalConfig(), dbutils::daqconfig::NamedConfigUtils::copySubsystemConfig(), dbutils::gui::DAQConfigEditorDisplay::DAQConfigEditorDisplay(), dbutils::gui::DBParamsGroupBox::DBParamsGroupBox(), dbutils::gui::DCSConfigEditorDisplay::DCSConfigEditorDisplay(), dbutils::gui::DCSConfigEditorDisplay::generateRecipeScripts(), dbutils::daqconfig::NamedConfigUtils::getAvailableGlobalConfigs(), dbutils::daqconfig::NamedConfigUtils::getAvailableSubsystemConfigs(), dbutils::daqconfig::NamedConfigUtils::getConfigDetailAncestry(), dbutils::daqconfig::NamedConfigUtils::getConfigIdAncestry(), dbutils::daqconfig::NamedConfigUtils::getGlobalConfigDetailAncestry(), dbutils::daqconfig::NamedConfigUtils::getGlobalConfigId(), dbutils::daqconfig::NamedConfigUtils::getGlobalConfigIdAncestry(), dbutils::daqconfig::NamedConfigUtils::getNewestGlobalConfigFromGlobalId(), dbutils::daqconfig::NamedConfigUtils::getNewestGlobalConfigFromSubsystemId(), dbutils::daqconfig::NamedConfigUtils::getNewestGlobalConfigFromSubsystemName(), dbutils::daqconfig::NamedConfigUtils::getNewestInstanceOfLatestUsedDAQGlobalConfig(), dbutils::daqconfig::NamedConfigUtils::getRecentGlobalConfigs(), dbutils::daqconfig::NamedConfigUtils::getSubsystemConfigId(), dbutils::daqconfig::NamedConfigUtils::getSubsystemConfigIdAncestry(), dbutils::daqconfig::NamedConfigUtils::getSubsystemConfigIdAncestryFromGlobalId(), dbutils::daqconfig::NamedConfigUtils::getSubsystemConfigIdFromGlobalId(), dbutils::daqconfig::NamedConfigUtils::getSubsystemConfigIdFromGlobalName(), dbutils::daqconfig::NamedConfigUtils::getSubsystemConfigIdsFromGlobalId(), dbutils::daqconfig::NamedConfigUtils::getSubsystemConfigsFromGlobalId(), dbutils::daqconfig::NamedConfigUtils::incrementUsageCount(), gov::fnal::cd::rms::provider::DDSTopicWriterClass< TT_ >::init(), gov::fnal::cd::rms::provider::DDSTopicReaderClass< TT_ >::init(), dbutils::daqconfig::NamedConfigUtils::markConfigDone(), dbutils::gui::BasicEditorDisplay::reactToDataChange(), dbutils::daqconfig::ConfigDataTree::saveValues(), CacheTests::testEnvVarCacheBasic(), CacheTests::testEnvVarCacheNumbers(), and gov::fnal::cd::rms::provider::DDSTopicWriterClass< TT_ >::waitForNetworkServices().
|
private |
|
protectedinherited |
Definition at line 40 of file Cache.h.
Referenced by novadaq::Cache::_reloadIfNeeded(), and novadaq::Cache::flush().
|
protectedinherited |
Definition at line 41 of file Cache.h.
Referenced by novadaq::Cache::flush(), getEnvVar(), getEnvVarAsDouble(), and getEnvVarAsLong().
|
private |
Definition at line 48 of file EnvVarCache.h.
Referenced by _clearCachedData(), and _doGetEnvVar().
|
protectedinherited |
Definition at line 39 of file Cache.h.
Referenced by novadaq::Cache::_reloadIfNeeded().