The SAGA attribute interface. More...
#include <attribute.hpp>
Public Types | |
typedef std::vector< std::string > | strvec_type |
Attribute string vector type. | |
typedef std::map< std::string, std::string > | strmap_type |
Attribute string map type. | |
Public Member Functions | |
std::string | get_attribute (std::string const &key) const |
Gets an attribute value. | |
void | set_attribute (std::string const &key, std::string const &value) |
Sets an attribute to a value. | |
strvec_type | get_vector_attribute (std::string const &key) const |
Gets the array of values associated with an attribute. | |
void | set_vector_attribute (std::string const &key, strvec_type const &value) |
Sets an attribute to an array of values. | |
void | remove_attribute (std::string const &key) |
Removes an attribute. | |
strvec_type | list_attributes () const |
Gets the list of attribute keys. | |
strvec_type | find_attributes (std::string const &pattern) const |
Finds matching attributes. | |
bool | attribute_exists (std::string const &key) const |
Checks if the attribute exists. | |
bool | attribute_is_readonly (std::string const &key) const |
Checks the attribute mode. | |
bool | attribute_is_writable (std::string const &key) const |
Checks the attribute mode. | |
bool | attribute_is_vector (std::string const &key) const |
Checks if it is vector. | |
bool | attribute_is_removable (std::string const &key) const |
Checks the attribute mode. |
The SAGA attribute interface.
Classes implementing this interface maintain a set of attributes. These attributes can be considered as a pair of string-based key-value pairs attached to the object. This interface provies methods for querying, adding, and removing attributes.
Usage example:
saga::url lfn("rls://localhost//lfn.dat");
//logical_file implements the attribute interface
logical_file::logical_file lf (lfn);
std::vector<std::string> keys(lf.list_attributes());
std::vector<std::string>::const_iterator end = keys.end();
std::vector<std::string>::const_iterator key_it = keys.begin();
for(; key_it != end; ++key_it) { std::cout << lf.get_attribute(*key_it) << std::endl };
Definition at line 138 of file detail/attribute.hpp.
typedef std::vector<std::string> saga::detail::attribute< Derived >::strvec_type |
Attribute string vector type.
Definition at line 144 of file detail/attribute.hpp.
typedef std::map<std::string, std::string> saga::detail::attribute< Derived >::strmap_type |
Attribute string map type.
Definition at line 149 of file detail/attribute.hpp.
std::string saga::detail::attribute< Derived >::get_attribute | ( | std::string const & | key | ) | const [inline] |
Gets an attribute value.
key | Attribute key name |
Definition at line 235 of file detail/attribute.hpp.
void saga::detail::attribute< Derived >::set_attribute | ( | std::string const & | key, | |
std::string const & | value | |||
) | [inline] |
Sets an attribute to a value.
key | Attribute key name | |
value | String value to set the attribute to |
Definition at line 249 of file detail/attribute.hpp.
strvec_type saga::detail::attribute< Derived >::get_vector_attribute | ( | std::string const & | key | ) | const [inline] |
Gets the array of values associated with an attribute.
key | Attribute key name |
Definition at line 262 of file detail/attribute.hpp.
void saga::detail::attribute< Derived >::set_vector_attribute | ( | std::string const & | key, | |
strvec_type const & | value | |||
) | [inline] |
Sets an attribute to an array of values.
key | Attribute key name | |
values | String array of attribute values |
Definition at line 277 of file detail/attribute.hpp.
void saga::detail::attribute< Derived >::remove_attribute | ( | std::string const & | key | ) | [inline] |
Removes an attribute.
key | Attribute key to be removed |
Definition at line 289 of file detail/attribute.hpp.
strvec_type saga::detail::attribute< Derived >::list_attributes | ( | ) | const [inline] |
Gets the list of attribute keys.
Definition at line 301 of file detail/attribute.hpp.
strvec_type saga::detail::attribute< Derived >::find_attributes | ( | std::string const & | pattern | ) | const [inline] |
Finds matching attributes.
pattern | Key name search pattern |
Definition at line 317 of file detail/attribute.hpp.
bool saga::detail::attribute< Derived >::attribute_exists | ( | std::string const & | key | ) | const [inline] |
Checks if the attribute exists.
key | Attribute key name |
Definition at line 332 of file detail/attribute.hpp.
bool saga::detail::attribute< Derived >::attribute_is_readonly | ( | std::string const & | key | ) | const [inline] |
Checks the attribute mode.
key | Attribute key name. |
Definition at line 345 of file detail/attribute.hpp.
bool saga::detail::attribute< Derived >::attribute_is_writable | ( | std::string const & | key | ) | const [inline] |
Checks the attribute mode.
key | Attribute key name. |
Definition at line 358 of file detail/attribute.hpp.
bool saga::detail::attribute< Derived >::attribute_is_vector | ( | std::string const & | key | ) | const [inline] |
Checks if it is vector.
key | Attribute key name. |
Definition at line 371 of file detail/attribute.hpp.
bool saga::detail::attribute< Derived >::attribute_is_removable | ( | std::string const & | key | ) | const [inline] |
Checks the attribute mode.
key | Attribute key. |
Definition at line 384 of file detail/attribute.hpp.