Arc::MessageAttributes Class Reference

A class for storage of attribute values. More...

#include <MessageAttributes.h>

Public Member Functions

 MessageAttributes ()
void set (const std::string &key, const std::string &value)
void add (const std::string &key, const std::string &value)
void removeAll (const std::string &key)
void remove (const std::string &key, const std::string &value)
int count (const std::string &key) const
const std::string & get (const std::string &key) const
AttributeIterator getAll (const std::string &key) const
AttributeIterator getAll (void) const

Protected Attributes

AttrMap attributes_

Detailed Description

A class for storage of attribute values.

This class is used to store attributes of messages. All attribute keys and their corresponding values are stored as strings. Any key or value that is not a string must thus be represented as a string during storage. Furthermore, an attribute is usually a key-value pair with a unique key, but there may also be multiple such pairs with equal keys.

The key of an attribute is composed by the name of the Message Chain Component (MCC) which produce it and the name of the attribute itself with a colon (:) in between, i.e. MCC_Name:Attribute_Name. For example, the key of the "Content-Length" attribute of the HTTP MCC is thus "HTTP:Content-Length".

There are also "global attributes", which may be produced by different MCCs depending on the configuration. The keys of such attributes are NOT prefixed by the name of the producing MCC. Before any new global attribute is introduced, it must be agreed upon by the core development team and added below. The global attributes decided so far are:


Constructor & Destructor Documentation

Arc::MessageAttributes::MessageAttributes (  ) 

The default constructor.

This is the default constructor of the MessageAttributes class. It constructs an empty object that initially contains no attributes.


Member Function Documentation

void Arc::MessageAttributes::add ( const std::string &  key,
const std::string &  value 
)

Adds a value to an attribute.

This method adds a new value to an attribute. Any previous value will be preserved, i.e. the attribute may become multiple valued.

Parameters:
key The key of the attribute.
value The (new) value of the attribute.
int Arc::MessageAttributes::count ( const std::string &  key  )  const

Returns the number of values of an attribute.

Returns the number of values of an attribute that matches a certain key.

Parameters:
key The key of the attribute for which to count values.
Returns:
The number of values that corresponds to the key.
const std::string& Arc::MessageAttributes::get ( const std::string &  key  )  const

Returns the value of a single-valued attribute.

This method returns the value of a single-valued attribute. If the attribute is not single valued (i.e. there is no such attribute or it is a multiple-valued attribute) an empty string is returned.

Parameters:
key The key of the attribute for which to return the value.
Returns:
The value of the attribute.
AttributeIterator Arc::MessageAttributes::getAll ( const std::string &  key  )  const

Access the value(s) of an attribute.

This method returns an AttributeIterator that can be used to access the values of an attribute.

Parameters:
key The key of the attribute for which to return the values.
Returns:
An AttributeIterator for access of the values of the attribute.
void Arc::MessageAttributes::remove ( const std::string &  key,
const std::string &  value 
)

Removes one value of an attribute.

This method removes a certain value from the attribute that matches a certain key.

Parameters:
key The key of the attribute from which the value shall be removed.
value The value to remove.
void Arc::MessageAttributes::removeAll ( const std::string &  key  ) 

Removes all attributes with a certain key.

This method removes all attributes that match a certain key.

Parameters:
key The key of the attributes to remove.
void Arc::MessageAttributes::set ( const std::string &  key,
const std::string &  value 
)

Sets a unique value of an attribute.

This method removes any previous value of an attribute and sets the new value as the only value.

Parameters:
key The key of the attribute.
value The (new) value of the attribute.

Field Documentation

Internal storage of attributes.

An AttrMap (multimap) in which all attributes (key-value pairs) are stored.


The documentation for this class was generated from the following file:
Generated on Wed Jun 27 11:54:24 2012 for Hosting Environment (Daemon) by  doxygen 1.6.3