A collection of attributes.
More...
#include <mia/core/attributes.hh>
A collection of attributes.
This is the base class for all data that uses attributes. It provides all the needed functions to store and retrieve attributes.
Definition at line 255 of file attributes.hh.
◆ CAttributedData() [1/3]
CAttributedData::CAttributedData |
( |
| ) |
|
◆ CAttributedData() [2/3]
◆ CAttributedData() [3/3]
Constructor that initialises with a certain attribute map
- Parameters
-
attr | the map to be initialised with |
◆ begin_attributes()
CAttributeMap::const_iterator CAttributedData::begin_attributes |
( |
| ) |
const |
- Returns
- the begin iterator to the attributes
◆ delete_attribute()
void CAttributedData::delete_attribute |
( |
const std::string & |
key | ) |
|
Delete the attribute with a given key from the list
- Parameters
-
◆ end_attributes()
CAttributeMap::const_iterator CAttributedData::end_attributes |
( |
| ) |
const |
- Returns
- the end iterator to the attributes
◆ get_attribute()
const PAttribute CAttributedData::get_attribute |
( |
const std::string & |
key | ) |
const |
◆ get_attribute_as() [1/2]
template<typename T >
const T CAttributedData::get_attribute_as |
( |
const std::string & |
key | ) |
const |
Look for a certain attribute and try to cast it to the output type. If the attribute is not found, a std::invalid_argument exception is thrown. If the cast fails then std::bad_cast exception will be thrown.
- Parameters
-
key | the key of the attribute to look up. |
- Returns
- the value of the attribute
Definition at line 755 of file attributes.hh.
◆ get_attribute_as() [2/2]
template<typename T >
const T CAttributedData::get_attribute_as |
( |
const std::string & |
key, |
|
|
T |
default_value |
|
) |
| const |
Look for a certain attribute and try to cast it to the output type. If the attribute is not found, or the cast goes wrong use the default value In the latter case a warning is written out.
- Parameters
-
key | the key of the attribute to look up. |
default_value | the default value |
- Returns
- the value of the attribute
Definition at line 765 of file attributes.hh.
References cvwarn(), and EXPORT_CORE.
◆ get_attribute_as_string()
const std::string CAttributedData::get_attribute_as_string |
( |
const std::string & |
key | ) |
const |
returns the requested attribute as string, returns an empty string if attribute doesn't exist
◆ has_attribute()
bool CAttributedData::has_attribute |
( |
const std::string & |
key | ) |
const |
See if a certain attribute exists
- Parameters
-
- Returns
- true if attribute exists, false otherwise
◆ operator=()
◆ print()
void CAttributedData::print |
( |
std::ostream & |
os | ) |
const |
|
inline |
◆ set_attribute() [1/4]
void CAttributedData::set_attribute |
( |
const std::string & |
key, |
|
|
PAttribute |
attr |
|
) |
| |
◆ set_attribute() [2/4]
void CAttributedData::set_attribute |
( |
const std::string & |
key, |
|
|
const std::string & |
value |
|
) |
| |
Set an attribute using one of the defined translators
- Parameters
-
◆ set_attribute() [3/4]
template<typename T >
void CAttributedData::set_attribute |
( |
const std::string & |
key, |
|
|
const T & |
value |
|
) |
| |
◆ set_attribute() [4/4]
void CAttributedData::set_attribute |
( |
const std::string & |
key, |
|
|
const char * |
value |
|
) |
| |
Set an attribute using one of the defined translators
- Parameters
-
◆ set_attributes()
void CAttributedData::set_attributes |
( |
CAttributeMap::const_iterator |
begin, |
|
|
CAttributeMap::const_iterator |
end |
|
) |
| |
Insersts or overwrites the attributes given in the input range
- Parameters
-
The documentation for this class was generated from the following file: