SAGA C++ API 1.6
saga::detail::attribute< Derived > Struct Template Reference

The SAGA attribute interface. More...

#include <attribute.hpp>

Inheritance diagram for saga::detail::attribute< Derived >:

List of all members.

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.

Detailed Description

template<typename Derived>
struct saga::detail::attribute< Derived >

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.


Member Typedef Documentation

template<typename Derived>
typedef std::vector<std::string> saga::detail::attribute< Derived >::strvec_type

Attribute string vector type.

Definition at line 144 of file detail/attribute.hpp.

template<typename Derived>
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.


Member Function Documentation

template<typename Derived>
std::string saga::detail::attribute< Derived >::get_attribute ( std::string const &  key) const [inline]

Gets an attribute value.

Parameters:
keyAttribute key name
Returns:
String value of the attribute.

Definition at line 235 of file detail/attribute.hpp.

template<typename Derived>
void saga::detail::attribute< Derived >::set_attribute ( std::string const &  key,
std::string const &  value 
) [inline]

Sets an attribute to a value.

Parameters:
keyAttribute key name
valueString value to set the attribute to

Definition at line 249 of file detail/attribute.hpp.

template<typename Derived>
strvec_type saga::detail::attribute< Derived >::get_vector_attribute ( std::string const &  key) const [inline]

Gets the array of values associated with an attribute.

Parameters:
keyAttribute key name
Returns:
String array of attribute values

Definition at line 262 of file detail/attribute.hpp.

template<typename Derived>
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.

Parameters:
keyAttribute key name
valuesString array of attribute values

Definition at line 277 of file detail/attribute.hpp.

template<typename Derived>
void saga::detail::attribute< Derived >::remove_attribute ( std::string const &  key) [inline]

Removes an attribute.

Parameters:
keyAttribute key to be removed

Definition at line 289 of file detail/attribute.hpp.

template<typename Derived>
strvec_type saga::detail::attribute< Derived >::list_attributes ( ) const [inline]

Gets the list of attribute keys.

Returns:
Existing attribute keys

Definition at line 301 of file detail/attribute.hpp.

template<typename Derived>
strvec_type saga::detail::attribute< Derived >::find_attributes ( std::string const &  pattern) const [inline]

Finds matching attributes.

Parameters:
patternKey name search pattern
Returns:
Matching attribute keys

Definition at line 317 of file detail/attribute.hpp.

template<typename Derived>
bool saga::detail::attribute< Derived >::attribute_exists ( std::string const &  key) const [inline]

Checks if the attribute exists.

Parameters:
keyAttribute key name
Returns:
true if the attribute exists, false otherwise

Definition at line 332 of file detail/attribute.hpp.

template<typename Derived>
bool saga::detail::attribute< Derived >::attribute_is_readonly ( std::string const &  key) const [inline]

Checks the attribute mode.

Parameters:
keyAttribute key name.
Returns:
true if the attribute is read-only, false otherwise

Definition at line 345 of file detail/attribute.hpp.

template<typename Derived>
bool saga::detail::attribute< Derived >::attribute_is_writable ( std::string const &  key) const [inline]

Checks the attribute mode.

Parameters:
keyAttribute key name.
Returns:
true if the attribute is writeable, false otherwise

Definition at line 358 of file detail/attribute.hpp.

template<typename Derived>
bool saga::detail::attribute< Derived >::attribute_is_vector ( std::string const &  key) const [inline]

Checks if it is vector.

Parameters:
keyAttribute key name.
Returns:
true if the attribute is a vector, false otherwise

Definition at line 371 of file detail/attribute.hpp.

template<typename Derived>
bool saga::detail::attribute< Derived >::attribute_is_removable ( std::string const &  key) const [inline]

Checks the attribute mode.

Parameters:
keyAttribute key.
Returns:
true if the attribute is removable, false otherwise

Definition at line 384 of file detail/attribute.hpp.


The documentation for this struct was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines