7 #ifndef CONFIGURATION_H
8 #define CONFIGURATION_H
17 #ifdef epicsExportSharedSymbols
18 # define configurationEpicsExportSharedSymbols
19 # undef epicsExportSharedSymbols
22 #include <pv/pvType.h>
23 #include <pv/noDefaultMethods.h>
25 #include <pv/sharedPtr.h>
28 #ifdef configurationEpicsExportSharedSymbols
29 # define epicsExportSharedSymbols
30 # undef configurationEpicsExportSharedSymbols
40 class ConfigurationStack;
62 bool getPropertyAsBoolean(
const std::string &name,
const bool defaultValue)
const;
72 epics::pvData::int32 getPropertyAsInteger(
const std::string &name,
const epics::pvData::int32 defaultValue)
const;
82 float getPropertyAsFloat(
const std::string &name,
const float defaultValue)
const;
92 double getPropertyAsDouble(
const std::string &name,
const double defaultValue)
const;
113 bool getPropertyAsAddress(
const std::string& name, osiSockAddr* addr)
const;
131 virtual void addKeys(keys_t&)
const {}
146 virtual void addKeys(
keys_t&)
const;
170 virtual void addKeys(
keys_t&)
const;
174 inline void push_back(
const confs_t::value_type& conf) {
175 confs.push_back(conf);
177 inline confs_t::value_type pop_back() {
180 confs_t::value_type ret(confs.back());
184 inline size_t size()
const {
189 struct epicsShareClass ConfigurationBuilder
191 ConfigurationBuilder();
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)
200 return _add(name, strm.
str());
202 Configuration::shared_pointer build();
205 ConfigurationMap::properties_t mymap;
206 std::tr1::shared_ptr<ConfigurationStack> stack;
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;
239 EPICS_NOT_COPYABLE(ConfigurationProviderImpl)
241 ConfigurationProviderImpl() {}
245 virtual ~ConfigurationProviderImpl() {}
246 Configuration::shared_pointer getConfiguration(
const std::string &name);
247 void registerConfiguration(
const std::string &name, Configuration::shared_pointer
const & configuration);
249 epics::pvData::Mutex _mutex;
270 static ConfigurationProvider::shared_pointer getProvider();
271 static void registerConfiguration(
const std::string &name, Configuration::shared_pointer
const & configuration)
273 getProvider()->registerConfiguration(name, configuration);
275 static Configuration::shared_pointer getConfiguration(
const std::string& name)
277 return getProvider()->getConfiguration(name);
Lookup configuration strings from the process environment.
basic_ostream< _CharT, _Traits > & operator<<(basic_ostream< _CharT, _Traits > &__os, const basic_string< _CharT, _Traits, _Alloc > &__str)
keys_t keys() const
Return a (partial) list of available key names.
Lookup configuration strings from a heap of sub-Configurations.
Lookup configuration strings from an in memory store.
__string_type str() const