8#ifndef META_OCEAN_BASE_CONFIG_H
9#define META_OCEAN_BASE_CONFIG_H
105 virtual unsigned int values(
const std::string& name)
const;
112 virtual bool exist(
const std::string& name)
const;
120 virtual Value&
value(
const std::string& name,
const unsigned int index = 0u);
129 virtual bool value(
const std::string& name,
const unsigned int index,
Value** value);
137 virtual Value&
value(
const unsigned int index, std::string& name);
146 virtual bool value(
const unsigned int index, std::string& name,
Value** value);
181 inline std::string operator()(
const char* value)
const;
188 virtual std::string
operator()(
const std::string& value)
const;
195 virtual std::vector<bool>
operator()(
const std::vector<bool>& value)
const;
202 virtual std::vector<int>
operator()(
const std::vector<int>& value)
const;
209 virtual std::vector<double>
operator()(
const std::vector<double>& value)
const;
216 virtual std::vector<std::string>
operator()(
const std::vector<std::string>& value)
const;
244 inline bool operator=(
const char* value);
258 virtual bool operator=(
const std::vector<bool>& values);
272 virtual bool operator=(
const std::vector<double>& values);
279 virtual bool operator=(
const std::vector<std::string>& values);
348 virtual unsigned int values(
const std::string& name)
const;
355 virtual bool exist(
const std::string& name)
const;
363 virtual Value&
value(
const unsigned int index, std::string& name);
372 virtual bool value(
const unsigned int index, std::string& name,
Value** value);
381 virtual bool value(
const std::string& name,
const unsigned int index,
Value** value);
389 virtual Value&
value(
const std::string& name,
const unsigned int index = 0);
440 return (*
this)(std::string(
value));
445 return (*
this) = std::string(
value);
This class implements a configuration value.
Definition Config.h:77
virtual bool value(const unsigned int index, std::string &name, Value **value)
Returns a sub value specified by it's index.
virtual std::vector< double > operator()(const std::vector< double > &value) const
Returns this value as multi number.
virtual std::vector< int > operator()(const std::vector< int > &value) const
Returns this value as multi integer.
virtual bool operator=(const bool value)
Sets this value as boolean.
virtual Value & value(const std::string &name, const unsigned int index=0u)
Returns a sub value specified by it's name and it's index if more than one value exists with the same...
virtual unsigned int values(const std::string &name) const
Returns the number of sub values with a given name.
virtual int operator()(const int value) const
Returns this value as integer.
Value()=default
Creates a new value object.
virtual bool operator=(const std::vector< double > &values)
Sets this value as multi number.
virtual bool exist(const std::string &name) const
Returns whether this value holds at least one specified sub value.
virtual std::vector< std::string > operator()(const std::vector< std::string > &value) const
Returns this value as multi string.
virtual bool operator=(const double value)
Sets this value as number.
virtual bool operator=(const std::string &value)
Sets this value as string.
virtual bool operator=(const int value)
Sets this value as integer.
virtual bool operator=(const std::vector< bool > &values)
Sets this value as multi boolean.
virtual std::string operator()(const std::string &value) const
Returns this value as string.
virtual ValueType type() const
Returns the type of this value.
virtual bool operator=(const std::vector< std::string > &values)
Sets this value as multi string.
virtual unsigned int values() const
Returns the number of sub values.
virtual double operator()(const double value) const
Returns this value as number.
virtual Value & add(const std::string &name)
Adds a new sub value specified by it's name.
virtual bool value(const std::string &name, const unsigned int index, Value **value)
Returns a sub value specified by it's name and it's index if more than one value exists with the same...
virtual Value & value(const unsigned int index, std::string &name)
Returns a sub value specified by it's index.
virtual bool operator=(const std::vector< int > &values)
Sets this value as multi integer.
Value(const Value &value)=default
Default copy constructor.
virtual bool isMultiType() const
Returns whether this value holds a multi type.
virtual bool operator()(const bool value) const
Returns this value as boolean.
virtual Value & operator[](const std::string &name)
Returns the first sub value specified by it's name or creates a new value if no existing.
virtual ~Value()=default
Destructs a value object.
virtual std::vector< bool > operator()(const std::vector< bool > &value) const
Returns this value as multi boolean.
This class implements an application or module configuration toolkit.
Definition Config.h:38
static Value & nullValue()
Returns the default value holding no data.
virtual Value & value(const unsigned int index, std::string &name)
Returns a sub value specified by it's index.
virtual bool value(const unsigned int index, std::string &name, Value **value)
Returns a sub value specified by it's index.
virtual bool read()
Reads / loads all values of this configuration.
virtual Value & value(const std::string &name, const unsigned int index=0)
Returns a sub value specified by it's name and it's index if more than one value exists with the same...
Config(const Config &config)=delete
Disabled copy constructor.
virtual Value & operator[](const std::string &name)
Returns the first sub value specified by it's name or creates a new one if not existing.
virtual unsigned int values() const
Returns the number of sub values.
Config()
Creates a new configuration toolkit.
ValueType
Definition of different value types.
Definition Config.h:45
@ TYPE_MULTI_NUMBER
Multi number value type.
Definition Config.h:63
@ TYPE_NUMBER
Number value type.
Definition Config.h:55
@ TYPE_MULTI_BOOL
Multi boolean value type.
Definition Config.h:59
@ TYPE_MULTI_INT
Multi integer value type.
Definition Config.h:61
@ TYPE_BOOL
Boolean value type.
Definition Config.h:51
@ TYPE_MULTI_STRING
Multi string value type.
Definition Config.h:65
@ TYPE_INT
Integer value type.
Definition Config.h:53
@ TYPE_STRING
String value type.
Definition Config.h:57
@ TYPE_UNDEFINED
Undefined value type.
Definition Config.h:49
@ TYPE_INVALID
Invalid value type.
Definition Config.h:47
virtual ~Config()
Destructs a configuration toolkit.
virtual unsigned int values(const std::string &name) const
Returns the number of sub values with a given name.
Timestamp writeTimestamp_
Holds the timestamp of the most recent write execution.
Definition Config.h:435
virtual bool value(const std::string &name, const unsigned int index, Value **value)
Returns a sub value specified by it's name and it's index if more than one value exists with the same...
Config & operator=(const Config &config)=delete
Disabled copy operator.
virtual Value & add(const std::string &name)
Adds a new sub value specified by it's name.
virtual bool write()
Writes / saves all values of this configuration.
virtual bool exist(const std::string &name) const
Returns whether this value holds at least one specified sub value.
Timestamp writeTimestamp() const
Returns the timestamp of the last write execution.
Definition Config.h:448
This class implements a timestamp.
Definition Timestamp.h:36
The namespace covering the entire Ocean framework.
Definition Accessor.h:15