ROSE 0.11.145.147
Classes | Public Types | Public Member Functions | List of all members
Sawyer::Container::GraphIteratorMap< K, V > Class Template Reference

Description

template<class K, class V>
class Sawyer::Container::GraphIteratorMap< K, V >

Map of graph edge or vertex pointers to some other value.

This container maps edge or vertex pointers (iterators) to values of some other type, T. Iterators form a total order by comparing their ID numbers, which is why all iterators in this container must belong to the same graph. This container is able to store only valid iterators, not end iterators. Attempting to insert an iterator with the same ID number as one that already exists is a no-op.

Since ID numbers are not stable over erasure, this container must be notified whenever edges or vertices (whichever are stored by this container), are removed from the graph, even if the items removed from the graph are not the same ones as what are stored in this container.

Definition at line 29 of file GraphIteratorMap.h.

#include <Sawyer/GraphIteratorMap.h>

Inheritance diagram for Sawyer::Container::GraphIteratorMap< K, V >:
Inheritance graph
[legend]

Classes

class  ConstKeyIterator
 Bidirectional iterator over keys. More...
 
class  ConstNodeIterator
 Bidirectional iterator over constant key/value nodes. More...
 
class  ConstValueIterator
 Bidirectional iterator over values. More...
 
class  Node
 The data stored at each node of the map. More...
 
class  NodeIterator
 Bidirectional iterator over key/value nodes. More...
 
class  ValueIterator
 Bidirectional iterator over values. More...
 

Public Types

typedef K Key
 Graph edge or vertex iterator used as keys.
 
typedef V Value
 Type of value associated with each key.
 
typedef StlVector::value_type value_type
 
typedef StlVector::allocator_type allocator_type
 
typedef StlVector::reference reference
 
typedef StlVector::pointer pointer
 
typedef StlVector::const_pointer const_pointer
 
typedef StlVector::iterator iterator
 
typedef StlVector::const_iterator const_iterator
 
typedef StlVector::reverse_iterator reverse_iterator
 
typedef StlVector::const_reverse_iterator const_reverse_iterator
 
typedef StlVector::difference_type difference_type
 
typedef StlVector::size_type size_type
 

Public Member Functions

 GraphIteratorMap ()
 Default construct an empty map.
 
void updateIdNumbers ()
 Indicate that an update is necessary due to erasures.
 
void insert (const Key &item, const Value &value)
 Insert the specified edge or vertex associated with a value.
 
ValueinsertMaybe (const Key &item, const Value &value)
 Insert a value only if its key doesn't already exist.
 
ValueinsertMaybeDefault (const Key &item)
 Insert a default value if its key doesn't already exist.
 
void erase (const Key &item)
 Erase the specified key if it exists.
 
void clear ()
 Remove all entries from this container.
 
bool exists (const Key &item) const
 Does the key exist in the map?
 
Sawyer::Optional< Valuefind (const Key &item) const
 Find the value associated with a particular key.
 
Value operator[] (const Key &item) const
 Return the value associated with an existing key.
 
NodeIterator begin ()
 
ConstNodeIterator begin () const
 
NodeIterator end ()
 
ConstNodeIterator end () const
 
boost::iterator_range< NodeIteratornodes ()
 Iterators for container nodes.
 
boost::iterator_range< ConstNodeIteratornodes () const
 Iterators for container nodes.
 
boost::iterator_range< ConstKeyIteratorkeys ()
 Iterators for container keys.
 
boost::iterator_range< ConstKeyIteratorkeys () const
 Iterators for container keys.
 
boost::iterator_range< ValueIteratorvalues ()
 Iterators for container values.
 
boost::iterator_range< ConstValueIteratorvalues () const
 Iterators for container values.
 

Member Typedef Documentation

◆ Key

template<class K , class V >
typedef K Sawyer::Container::GraphIteratorMap< K, V >::Key

Graph edge or vertex iterator used as keys.

Definition at line 31 of file GraphIteratorMap.h.

◆ Value

template<class K , class V >
typedef V Sawyer::Container::GraphIteratorMap< K, V >::Value

Type of value associated with each key.

Definition at line 32 of file GraphIteratorMap.h.

◆ value_type

template<class K , class V >
typedef StlVector::value_type Sawyer::Container::GraphIteratorMap< K, V >::value_type

Definition at line 301 of file GraphIteratorMap.h.

◆ allocator_type

template<class K , class V >
typedef StlVector::allocator_type Sawyer::Container::GraphIteratorMap< K, V >::allocator_type

Definition at line 302 of file GraphIteratorMap.h.

◆ reference

template<class K , class V >
typedef StlVector::reference Sawyer::Container::GraphIteratorMap< K, V >::reference

Definition at line 303 of file GraphIteratorMap.h.

◆ pointer

template<class K , class V >
typedef StlVector::pointer Sawyer::Container::GraphIteratorMap< K, V >::pointer

Definition at line 304 of file GraphIteratorMap.h.

◆ const_pointer

template<class K , class V >
typedef StlVector::const_pointer Sawyer::Container::GraphIteratorMap< K, V >::const_pointer

Definition at line 305 of file GraphIteratorMap.h.

◆ iterator

template<class K , class V >
typedef StlVector::iterator Sawyer::Container::GraphIteratorMap< K, V >::iterator

Definition at line 306 of file GraphIteratorMap.h.

◆ const_iterator

template<class K , class V >
typedef StlVector::const_iterator Sawyer::Container::GraphIteratorMap< K, V >::const_iterator

Definition at line 307 of file GraphIteratorMap.h.

◆ reverse_iterator

template<class K , class V >
typedef StlVector::reverse_iterator Sawyer::Container::GraphIteratorMap< K, V >::reverse_iterator

Definition at line 308 of file GraphIteratorMap.h.

◆ const_reverse_iterator

template<class K , class V >
typedef StlVector::const_reverse_iterator Sawyer::Container::GraphIteratorMap< K, V >::const_reverse_iterator

Definition at line 309 of file GraphIteratorMap.h.

◆ difference_type

template<class K , class V >
typedef StlVector::difference_type Sawyer::Container::GraphIteratorMap< K, V >::difference_type

Definition at line 310 of file GraphIteratorMap.h.

◆ size_type

template<class K , class V >
typedef StlVector::size_type Sawyer::Container::GraphIteratorMap< K, V >::size_type

Definition at line 311 of file GraphIteratorMap.h.

Constructor & Destructor Documentation

◆ GraphIteratorMap()

template<class K , class V >
Sawyer::Container::GraphIteratorMap< K, V >::GraphIteratorMap ( )
inline

Default construct an empty map.

Definition at line 318 of file GraphIteratorMap.h.

Member Function Documentation

◆ updateIdNumbers()

template<class K , class V >
void Sawyer::Container::GraphIteratorMap< K, V >::updateIdNumbers ( )
inline

Indicate that an update is necessary due to erasures.

If the graph whose iterators are stored in this container has any edges or vertices that are erased (whichever type are stored in this container), then this function should be called to tell the container that the ID numbers of its contained iterators have possibly changed.

The actual re-sorting of this container will be delayed as long as possible, but logically the user can assume that it occurs immediately.

Definition at line 333 of file GraphIteratorMap.h.

Referenced by Sawyer::Container::GraphIteratorBiMap< LhsIterator, RhsIterator >::updateIdNumbers().

◆ insert()

template<class K , class V >
void Sawyer::Container::GraphIteratorMap< K, V >::insert ( const Key item,
const Value value 
)
inline

Insert the specified edge or vertex associated with a value.

If the edge or vertex already exists, then its value is changed, otherwise a new edge or vertex with the associated value is inserted into the map. Note that this is different behavior than std::map where no new value is inserted if the key already exists.

Definition at line 342 of file GraphIteratorMap.h.

Referenced by Sawyer::Container::GraphIteratorBiMap< LhsIterator, RhsIterator >::insert().

◆ insertMaybe()

template<class K , class V >
Value & Sawyer::Container::GraphIteratorMap< K, V >::insertMaybe ( const Key item,
const Value value 
)
inline

Insert a value only if its key doesn't already exist.

Returns a reference to the value, which should be used immediately. The reference is valid until the next modifying operation on this object.

Definition at line 357 of file GraphIteratorMap.h.

Referenced by Sawyer::Container::GraphIteratorMap< K, V >::insertMaybeDefault().

◆ insertMaybeDefault()

template<class K , class V >
Value & Sawyer::Container::GraphIteratorMap< K, V >::insertMaybeDefault ( const Key item)
inline

Insert a default value if its key doesn't already exist.

Returns a reference to the value, which should be used immediately. The reference is value until the next modifying operation on this object.

Definition at line 370 of file GraphIteratorMap.h.

References Sawyer::Container::GraphIteratorMap< K, V >::insertMaybe().

◆ erase()

template<class K , class V >
void Sawyer::Container::GraphIteratorMap< K, V >::erase ( const Key item)
inline

◆ clear()

template<class K , class V >
void Sawyer::Container::GraphIteratorMap< K, V >::clear ( )
inline

Remove all entries from this container.

Definition at line 384 of file GraphIteratorMap.h.

Referenced by Sawyer::Container::GraphIteratorBiMap< LhsIterator, RhsIterator >::clear().

◆ exists()

template<class K , class V >
bool Sawyer::Container::GraphIteratorMap< K, V >::exists ( const Key item) const
inline

Does the key exist in the map?

Definition at line 394 of file GraphIteratorMap.h.

Referenced by Sawyer::Container::GraphIteratorBiMap< LhsIterator, RhsIterator >::GraphIteratorBiMap().

◆ find()

template<class K , class V >
Sawyer::Optional< Value > Sawyer::Container::GraphIteratorMap< K, V >::find ( const Key item) const
inline

◆ operator[]()

template<class K , class V >
Value Sawyer::Container::GraphIteratorMap< K, V >::operator[] ( const Key item) const
inline

Return the value associated with an existing key.

Definition at line 414 of file GraphIteratorMap.h.

References Sawyer::Container::GraphIteratorMap< K, V >::find().

◆ nodes() [1/2]

template<class K , class V >
boost::iterator_range< NodeIterator > Sawyer::Container::GraphIteratorMap< K, V >::nodes ( )
inline

Iterators for container nodes.

This returns a range of node-iterators that will traverse all nodes (key/value pairs) of this container.

Definition at line 428 of file GraphIteratorMap.h.

Referenced by Sawyer::Container::GraphIteratorBiMap< LhsIterator, RhsIterator >::GraphIteratorBiMap().

◆ nodes() [2/2]

template<class K , class V >
boost::iterator_range< ConstNodeIterator > Sawyer::Container::GraphIteratorMap< K, V >::nodes ( ) const
inline

Iterators for container nodes.

This returns a range of node-iterators that will traverse all nodes (key/value pairs) of this container.

Definition at line 432 of file GraphIteratorMap.h.

◆ keys() [1/2]

template<class K , class V >
boost::iterator_range< ConstKeyIterator > Sawyer::Container::GraphIteratorMap< K, V >::keys ( )
inline

Iterators for container keys.

Returns a range of key-iterators that will traverse the keys of this container.

Definition at line 443 of file GraphIteratorMap.h.

◆ keys() [2/2]

template<class K , class V >
boost::iterator_range< ConstKeyIterator > Sawyer::Container::GraphIteratorMap< K, V >::keys ( ) const
inline

Iterators for container keys.

Returns a range of key-iterators that will traverse the keys of this container.

Definition at line 447 of file GraphIteratorMap.h.

◆ values() [1/2]

template<class K , class V >
boost::iterator_range< ValueIterator > Sawyer::Container::GraphIteratorMap< K, V >::values ( )
inline

Iterators for container values.

Returns a range of iterators that will traverse the user-defined values of this container. The values are iterated in key order, although the keys are not directly available via these iterators.

Definition at line 459 of file GraphIteratorMap.h.

◆ values() [2/2]

template<class K , class V >
boost::iterator_range< ConstValueIterator > Sawyer::Container::GraphIteratorMap< K, V >::values ( ) const
inline

Iterators for container values.

Returns a range of iterators that will traverse the user-defined values of this container. The values are iterated in key order, although the keys are not directly available via these iterators.

Definition at line 463 of file GraphIteratorMap.h.

◆ begin() [1/2]

template<class K , class V >
NodeIterator Sawyer::Container::GraphIteratorMap< K, V >::begin ( )
inline

Definition at line 470 of file GraphIteratorMap.h.

◆ begin() [2/2]

template<class K , class V >
ConstNodeIterator Sawyer::Container::GraphIteratorMap< K, V >::begin ( ) const
inline

Definition at line 471 of file GraphIteratorMap.h.

◆ end() [1/2]

template<class K , class V >
NodeIterator Sawyer::Container::GraphIteratorMap< K, V >::end ( )
inline

Definition at line 472 of file GraphIteratorMap.h.

◆ end() [2/2]

template<class K , class V >
ConstNodeIterator Sawyer::Container::GraphIteratorMap< K, V >::end ( ) const
inline

Definition at line 473 of file GraphIteratorMap.h.


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