17#ifdef epicsExportSharedSymbols
18# define configurationEpicsExportSharedSymbols
19# undef epicsExportSharedSymbols
23#include <pv/noDefaultMethods.h>
25#include <pv/sharedPtr.h>
28#ifdef configurationEpicsExportSharedSymbols
29# define epicsExportSharedSymbols
30# undef configurationEpicsExportSharedSymbols
40class ConfigurationStack;
115 bool hasProperty(
const std::string &name)
const;
130 virtual bool tryGetPropertyAsString(
const std::string& name, std::string* val)
const = 0;
131 virtual void addKeys(keys_t&)
const {}
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;
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) {
177 inline confs_t::value_type pop_back() {
180 confs_t::value_type ret(confs.
back());
184 inline size_t size()
const {
189struct 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)
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);
205 ConfigurationMap::properties_t mymap;
206 std::tr1::shared_ptr<ConfigurationStack> stack;
207 friend ConfigurationBuilder&
operator<<(ConfigurationBuilder&,
const std::string& s);
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;
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);
281 ConfigurationFactory() {};
valarray< size_t > size() const
basic_ostream< _CharT, _Traits > & operator<<(basic_ostream< _CharT, _Traits > &__os, const basic_string< _CharT, _Traits, _Alloc > &__str)
constexpr void push_back(const value_type &__x)
constexpr void pop_back() noexcept
constexpr const_reference back() const noexcept
constexpr bool empty() const noexcept
constexpr size_type size() const noexcept
Lookup configuration strings from the process environment.
static ConfigurationProvider::shared_pointer getProvider()
Lazily creates configuration provider.
epics::pvData::int32 getPropertyAsInteger(const std::string &name, const epics::pvData::int32 defaultValue) const
Get the environment variable specified by name or return default value if it does not exist.
bool getPropertyAsAddress(const std::string &name, osiSockAddr *addr) const
Fetch and parse as a socket address and port number (address family set accordingly).
keys_t keys() const
Return a (partial) list of available key names.
double getPropertyAsDouble(const std::string &name, const double defaultValue) const
Get the environment variable specified by name or return default value if it does not exist.
float getPropertyAsFloat(const std::string &name, const float defaultValue) const
Get the environment variable specified by name or return default value if it does not exist.
std::string getPropertyAsString(const std::string &name, const std::string &defaultValue) const
Get the environment variable specified by name or return default value if it does not exist.
bool getPropertyAsBoolean(const std::string &name, const bool defaultValue) const
Get the environment variable specified by name or return default value if it does not exist.
Lookup configuration strings from an in memory store.
virtual void registerConfiguration(const std::string &name, Configuration::shared_pointer const &configuration)=0
Register configuration.
virtual Configuration::shared_pointer getConfiguration(const std::string &name)=0
Return configuration specified by name.
Lookup configuration strings from a heap of sub-Configurations.
Copyright - See the COPYRIGHT that is included with this distribution.