Back to index

nordugrid-arc-nox  1.1.0~rc6
Public Member Functions | Protected Member Functions | Protected Attributes | Friends
Arc::AttributeIterator Class Reference

A const iterator class for accessing multiple values of an attribute. More...

#include <MessageAttributes.h>

List of all members.

Public Member Functions

 AttributeIterator ()
 Default constructor.
const std::string & operator* () const
 The dereference operator.
const std::string * operator-> () const
 The arrow operator.
const std::string & key (void) const
 The key of attribute.
const AttributeIteratoroperator++ ()
 The prefix advance operator.
AttributeIterator operator++ (int)
 The postfix advance operator.
bool hasMore () const
 Predicate method for iteration termination.

Protected Member Functions

 AttributeIterator (AttrConstIter begin, AttrConstIter end)
 Protected constructor used by the MessageAttributes class.

Protected Attributes

AttrConstIter current_
 A const_iterator pointing to the current key-value pair.
AttrConstIter end_
 A const_iterator pointing beyond the last key-value pair.

Friends

class MessageAttributes
 The MessageAttributes class is a friend.

Detailed Description

A const iterator class for accessing multiple values of an attribute.

This is an iterator class that is used when accessing multiple values of an attribute. The getAll() method of the MessageAttributes class returns an AttributeIterator object that can be used to access the values of the attribute.

Typical usage is:

    MessageAttributes attributes;
    ...
    for (AttributeIterator iterator=attributes.getAll("Foo:Bar");
         iterator.hasMore(); ++iterator)
      std::cout << *iterator << std::endl;

Definition at line 52 of file MessageAttributes.h.


Constructor & Destructor Documentation

Default constructor.

The default constructor. Does nothing since all attributes are instances of well-behaving STL classes.

Definition at line 11 of file MessageAttributes.cpp.

                                      {
  }

Here is the caller graph for this function:

Protected constructor used by the MessageAttributes class.

This constructor is used to create an iterator for iteration over all values of an attribute. It is not supposed to be visible externally, but is only used from within the getAll() method of MessageAttributes class.

Parameters:
beginA const_iterator pointing to the first matching key-value pair in the internal multimap of the MessageAttributes class.
endA const_iterator pointing to the first key-value pair in the internal multimap of the MessageAttributes class where the key is larger than the key searched for.

Definition at line 14 of file MessageAttributes.cpp.

                                                      :
    current_(begin), end_(end) {
  }

Member Function Documentation

Predicate method for iteration termination.

This method determines whether there are more values for the iterator to refer to.

Returns:
Returns true if there are more values, otherwise false.

Definition at line 41 of file MessageAttributes.cpp.

                                        {
    return current_!=end_;
  }

Here is the caller graph for this function:

const std::string & Arc::AttributeIterator::key ( void  ) const

The key of attribute.

This method returns reference to key of attribute to which iterator refers.

Definition at line 27 of file MessageAttributes.cpp.

                                                    {
    return current_->first;
  }
const std::string & Arc::AttributeIterator::operator* ( void  ) const

The dereference operator.

This operator is used to access the current value referred to by the iterator.

Returns:
A (constant reference to a) string representation of the current value.

Definition at line 19 of file MessageAttributes.cpp.

                                                      {
    return current_->second;
  }
const AttributeIterator & Arc::AttributeIterator::operator++ ( void  )

The prefix advance operator.

Advances the iterator to the next value. Works intuitively.

Returns:
A const reference to this iterator.

Definition at line 31 of file MessageAttributes.cpp.

                                                         {
    ++current_;
    return *this;
  }
AttributeIterator Arc::AttributeIterator::operator++ ( int  )

The postfix advance operator.

Advances the iterator to the next value. Works intuitively.

Returns:
An iterator referring to the value referred to by this iterator before the advance.

Definition at line 36 of file MessageAttributes.cpp.

                                                     {
    AttrConstIter recent=current_++;
    return AttributeIterator(recent,end_);
  }

Here is the call graph for this function:

const std::string * Arc::AttributeIterator::operator-> ( void  ) const

The arrow operator.

Used to call methods for value objects (strings) conveniently.

Definition at line 23 of file MessageAttributes.cpp.

                                                       {
    return &(current_->second);
  }

Friends And Related Function Documentation

friend class MessageAttributes [friend]

The MessageAttributes class is a friend.

The constructor that creates an AttributeIterator that is connected to the internal multimap of the MessageAttributes class should not be exposed to the outside, but it still needs to be accessible from the getAll() method of the MessageAttributes class. Therefore, that class is a friend.

Definition at line 137 of file MessageAttributes.h.


Member Data Documentation

A const_iterator pointing to the current key-value pair.

This iterator is the internal representation of the current value. It points to the corresponding key-value pair in the internal multimap of the MessageAttributes class.

Definition at line 121 of file MessageAttributes.h.

A const_iterator pointing beyond the last key-value pair.

A const_iterator pointing to the first key-value pair in the internal multimap of the MessageAttributes class where the key is larger than the key searched for.

Definition at line 128 of file MessageAttributes.h.


The documentation for this class was generated from the following files: