7 #ifndef CONFIGURATION_H 8 #define CONFIGURATION_H 17 #ifdef epicsExportSharedSymbols 18 # define configurationEpicsExportSharedSymbols 19 # undef epicsExportSharedSymbols 28 #ifdef configurationEpicsExportSharedSymbols 29 # define epicsExportSharedSymbols 30 # undef configurationEpicsExportSharedSymbols 40 class ConfigurationStack;
62 bool getPropertyAsBoolean(
const std::string &name,
const bool defaultValue)
const;
82 float getPropertyAsFloat(
const std::string &name,
const float defaultValue)
const;
92 double getPropertyAsDouble(
const std::string &name,
const double defaultValue)
const;
102 std::string getPropertyAsString(
const std::string &name,
const std::string &defaultValue)
const;
113 bool getPropertyAsAddress(
const std::string& name,
osiSockAddr* addr)
const;
115 bool hasProperty(
const std::string &name)
const;
130 virtual bool tryGetPropertyAsString(
const std::string& name, std::string* val)
const = 0;
145 virtual bool tryGetPropertyAsString(
const std::string& name, std::string* val)
const;
146 virtual void addKeys(
keys_t&)
const;
157 virtual bool tryGetPropertyAsString(
const std::string& name, std::string* val)
const;
167 typedef std::vector<std::tr1::shared_ptr<Configuration> > confs_t;
169 virtual bool tryGetPropertyAsString(
const std::string& name, std::string* val)
const;
170 virtual void addKeys(
keys_t&)
const;
174 inline void push_back(
const confs_t::value_type& conf) {
175 confs.push_back(conf);
179 throw std::runtime_error(
"Stack empty");
180 confs_t::value_type ret(confs.back());
192 ConfigurationBuilder& push_env();
193 ConfigurationBuilder& push_map();
194 ConfigurationBuilder& push_config(
const Configuration::shared_pointer&);
196 ConfigurationBuilder&
add(
const std::string& name,
const V& val)
198 std::ostringstream strm;
200 return _add(name, strm.str());
202 Configuration::shared_pointer build();
204 ConfigurationBuilder& _add(
const std::string& name,
const std::string& val);
206 std::tr1::shared_ptr<ConfigurationStack> stack;
207 friend ConfigurationBuilder& operator<<(ConfigurationBuilder&,
const std::string& s);
227 virtual Configuration::shared_pointer getConfiguration(
const std::string &name) = 0;
234 virtual void registerConfiguration(
const std::string &name, Configuration::shared_pointer
const & configuration) = 0;
246 Configuration::shared_pointer getConfiguration(
const std::string &name);
247 void registerConfiguration(
const std::string &name, Configuration::shared_pointer
const & configuration);
250 std::map<std::string,Configuration::shared_pointer> _configs;
270 static ConfigurationProvider::shared_pointer getProvider();
273 getProvider()->registerConfiguration(name, configuration);
277 return getProvider()->getConfiguration(name);
virtual ~ConfigurationMap()
static void registerConfiguration(const std::string &name, Configuration::shared_pointer const &configuration)
virtual ~ConfigurationProviderImpl()
Lookup configuration strings from the process environment.
Routines to get and set EPICS environment parameters.
virtual ~ConfigurationStack()
TODO only here because of the Lockable.
Mark external symbols and entry points for shared libraries.
virtual ~ConfigurationEnviron()
static Configuration::shared_pointer getConfiguration(const std::string &name)
std::set< std::string > keys_t
confs_t::value_type pop_back()
ConfigurationProviderImpl()
virtual void addKeys(keys_t &) const
#define POINTER_DEFINITIONS(clazz)
ConfigurationMap(const properties_t &p)
virtual ~ConfigurationProvider()
ConfigurationEnviron SystemConfigurationImpl
Lookup configuration strings from an in memory store.
std::map< std::string, std::string > properties_t
#define EPICS_NOT_COPYABLE(CLASS)
Disable implicit copyable.
void push_back(const confs_t::value_type &conf)
ConfigurationBuilder & add(const std::string &name, const V &val)