Attribute manager, which should be embedded into a parent object, which supports attributes.
More...
#include <attribute_repository.hpp>
|
attribute | create (const std::string &name, const type &datatype) |
| Creates a new attribute. More...
|
|
template<typename T > |
attribute | create (const std::string &name) |
| Creates a new attribute. More...
|
|
template<typename T > |
attribute | create (const std::string &name, const T &value) |
| Creates a new attribute and initializes it with a given value. More...
|
|
attribute | operator[] (const std::string &name) const |
| Accessor function for this attribute repository. More...
|
|
bool | exists (const std::string &name) const |
| Tests, if an attribute exists. More...
|
|
attribute | require (const std::string &name, const type &datatype) |
| Returns the requested attribute, if it already exists, otherwise a new attribute is created. More...
|
|
template<typename T > |
attribute | require (const std::string &name) |
| Returns the requested attribute, if it already exists, otherwise the attribute is created. More...
|
|
template<typename T > |
attribute | require (const std::string &name, const T &value) |
| Returns the requested attribute, if it already exists, otherwise a new attribute is created. More...
|
|
template<typename Parent>
class echelon::attribute_repository< Parent >
Attribute manager, which should be embedded into a parent object, which supports attributes.
- Template Parameters
-
Parent | Type of the object into which the attribute repository is embedded. |
template<typename Parent>
Creates a new attribute.
- Parameters
-
name | name of the new attribute |
datatype | value type of the new attribute |
- Returns
- a handle to the new attribute
template<typename Parent>
template<typename T >
Creates a new attribute.
- Template Parameters
-
T | C++ type, which should be used to determine the dataset's value type |
- Parameters
-
name | name of the new attribute |
- Returns
- a handle to the new attribute
template<typename Parent>
template<typename T >
Creates a new attribute and initializes it with a given value.
- Template Parameters
-
T | C++ type, which should be used to determine the dataset's value type |
- Parameters
-
name | name of the new attribute |
value | value, which is used to initialize the attribute |
- Returns
- a handle to the new attribute
template<typename Parent>
Tests, if an attribute exists.
- Parameters
-
name | name of the requested attribute |
- Returns
- true, if the requested attribute exists, false otherwise
template<typename Parent>
Accessor function for this attribute repository.
- Parameters
-
name | name of the requested attribute |
- Returns
- a handle to the requested attribute
template<typename Parent>
Returns the requested attribute, if it already exists, otherwise a new attribute is created.
The new attribute is created using the given parameters.
This method allows the user to make a contract with the library, that an object with certain properties exists after the method has terminated.
If the attribute already exists and its datatype differs from its requested value and an exception is thrown, since the contract can't be fulfilled.
- Parameters
-
name | name of the requested attribute |
datatype | value type of the new attribute |
- Exceptions
-
broken_contract_exception | is thrown, if the contract can't be fulfilled. |
- Returns
- the requested attribute, if it is already existing, or a new attribute otherwise
template<typename Parent>
template<typename T >
Returns the requested attribute, if it already exists, otherwise the attribute is created.
The new attribute is created using the given parameters.
This method allows the user to make a contract with the library, that an object with certain properties exists after the method has terminated.
If the attribute already exists and its datatype differs from its requested value and an exception is thrown, since the contract can't be fulfilled.
- Parameters
-
name | name of the requested attribute |
- Template Parameters
-
T | C++ type, which should be used to determine the attribute's value type |
- Exceptions
-
broken_contract_exception | is thrown, if the contract can't be fulfilled. |
- Returns
- the requested attribute, if it is already existing, or a new attribute otherwise
template<typename Parent>
template<typename T >
Returns the requested attribute, if it already exists, otherwise a new attribute is created.
The new attribute is created using the given parameters and is initialized with the given value.
This method allows the user to make a contract with the library, that an object with certain properties exists after the method has terminated.
If the attribute already exists and its datatype differs from its requested value and an exception is thrown, since the contract can't be fulfilled.
- Parameters
-
name | name of the requested attribute |
value | value, which should be used to intialize the attribute |
- Template Parameters
-
T | C++ type, which should be used to determine the attribute's value type |
- Exceptions
-
broken_contract_exception | is thrown, if the contract can't be fulfilled. |
- Returns
- the requested attribute, if it is already existing, or a new attribute otherwise
The documentation for this class was generated from the following file: