EnvVarCache.h
Go to the documentation of this file.
1 #ifndef _NOVADAQ_ENVVAR_CACHE_H
2 #define _NOVADAQ_ENVVAR_CACHE_H
3 
4 #include <NovaDAQUtilities/Cache.h>
5 #include <NovaDAQUtilities/TimedCachePolicy.h>
6 #include <boost/thread/mutex.hpp>
7 #include <map>
8 
9 namespace novadaq {
10 
11 /**
12  * A singleton class that serves as a cache of environmental variable values.
13  *
14  * @author Kurt Biery
15  * @version $Revision: 1.1.34.1 $ $Date: 2019/09/27 00:07:20 $
16  */
17 
18 class EnvVarCache : public novadaq::Cache {
19 
20  public:
21 
22  static EnvVarCache& getInstance();
23 
25 
26  int getEnvVarAsLong(std::string name, long defaultValue);
27 
28  double getEnvVarAsDouble(std::string name, double defaultValue);
29 
30  protected:
31 
33 
34  void _loadDataIntoCache();
35 
36  void _clearCachedData();
37 
38  private:
39 
40  // constructor is private
41  explicit EnvVarCache(novadaq::CachePolicy policy);
42 
43  // disallow any copying
44  EnvVarCache(EnvVarCache const&); // not implemented
45  void operator= (EnvVarCache const&); // not implemented
46 
47  // the map of env var names to values
48  std::map<std::string, std::string> _envVarMap;
49 
50 };
51 
52 } // end of namespace novadaq
53 
54 #endif
const XML_Char * name
Definition: expat.h:151
EnvVarCache(novadaq::CachePolicy policy)
Definition: EnvVarCache.cpp:21
std::string _doGetEnvVar(std::string name)
Definition: EnvVarCache.cpp:92
static EnvVarCache & getInstance()
Definition: EnvVarCache.cpp:12
std::map< std::string, std::string > _envVarMap
Definition: EnvVarCache.h:48
int getEnvVarAsLong(std::string name, long defaultValue)
Definition: EnvVarCache.cpp:48
double getEnvVarAsDouble(std::string name, double defaultValue)
Definition: EnvVarCache.cpp:70
void operator=(EnvVarCache const &)
std::string getEnvVar(std::string name)
Definition: EnvVarCache.cpp:33
enum BeamMode string