DiaDes  0.1
DIAgnosis of Discrete-Event System
Public Types | Static Public Member Functions | List of all members
Diades::Graph::NodeMap< T > Class Template Reference

#include <NodeMap.hh>

Public Types

typedef Diades::Utils::Exception< NodeMapException
 
typedef vector< T >::reference Reference
 
typedef vector< T >::const_reference ConstReference
 
typedef vector< T >::value_type ValueType
 
typedef vector< T >::iterator Iterator
 
typedef vector< T >::const_iterator ConstIterator
 
typedef vector< T >::size_type SizeType
 
typedef vector< T >::difference_type DifferenceType
 
typedef vector< T >::allocator_type AllocatorType
 
typedef vector< T >::pointer Pointer
 
typedef vector< T >::const_pointer ConstPointer
 
typedef vector< T >::reverse_iterator ReverseIterator
 
typedef vector< T >::const_reverse_iterator ConstReverseIterator
 

Public Member Functions

Constructors
 NodeMap ()
 
 NodeMap (Graph &g, SizeType capacity=0, ValueType dflt=ValueType())
 
 ~NodeMap ()
 

Static Public Member Functions

static string typeName ()
 

Others

vector< ValueType_tabData
 
Graph_owner
 
ValueType _dflt
 
void clear ()
 
void init (Graph &g, SizeType capacity=0, ValueType dflt=ValueType())
 
const Graphowner () const
 
Graphowner ()
 
NodeMapIterator< ValueTypenodeBegin (ConstReference value) const
 
NodeMapIterator< ValueTypenodeEnd (ConstReference value) const
 
bool valid () const
 
Reference operator[] (Node node)
 
ConstReference operator[] (Node node) const
 
NodeIterator initValue (NodeIterator begin, NodeIterator end, ConstReference value)
 
void export2dot (ostream &os)
 

Detailed Description

template<typename T>
class Diades::Graph::NodeMap< T >

Association between a node of a graph (Node) and a object T.

A NodeMap defines a map between each node of a Graph and objects of type T. This map is more efficient than the map (even unordered_map) developped in the STL as it relies on vectors and their direct access to elements

Definition at line 29 of file NodeMap.hh.

Member Typedef Documentation

◆ AllocatorType

template<typename T>
typedef vector<T>::allocator_type Diades::Graph::NodeMap< T >::AllocatorType

AllocatorType the type of the allocator (use it at your own risk)

Definition at line 69 of file NodeMap.hh.

◆ ConstIterator

template<typename T>
typedef vector<T>::const_iterator Diades::Graph::NodeMap< T >::ConstIterator

Iterator internal constant iterator of the mapping (use it at your own risk)

Definition at line 57 of file NodeMap.hh.

◆ ConstPointer

template<typename T>
typedef vector<T>::const_pointer Diades::Graph::NodeMap< T >::ConstPointer

ConstPointer constant pointer on the element of the map

Definition at line 77 of file NodeMap.hh.

◆ ConstReference

template<typename T>
typedef vector<T>::const_reference Diades::Graph::NodeMap< T >::ConstReference

ConstReference constant reference of the mapped element of type T

Definition at line 45 of file NodeMap.hh.

◆ ConstReverseIterator

template<typename T>
typedef vector<T>::const_reverse_iterator Diades::Graph::NodeMap< T >::ConstReverseIterator

ConstReverseIterator internal constant reverse iterator of the mapping (use it at your own risk)

Definition at line 85 of file NodeMap.hh.

◆ DifferenceType

template<typename T>
typedef vector<T>::difference_type Diades::Graph::NodeMap< T >::DifferenceType

DifferenceType the type of the distance in the map (use it at your own risk)

Definition at line 65 of file NodeMap.hh.

◆ Exception

Definition at line 35 of file NodeMap.hh.

◆ Iterator

template<typename T>
typedef vector<T>::iterator Diades::Graph::NodeMap< T >::Iterator

Iterator internal iterator of the mapping (use it at your own risk)

Definition at line 53 of file NodeMap.hh.

◆ Pointer

template<typename T>
typedef vector<T>::pointer Diades::Graph::NodeMap< T >::Pointer

Pointer pointer on the element of the map

Definition at line 73 of file NodeMap.hh.

◆ Reference

template<typename T>
typedef vector<T>::reference Diades::Graph::NodeMap< T >::Reference

Reference reference of the mapped element of type T

Definition at line 41 of file NodeMap.hh.

◆ ReverseIterator

template<typename T>
typedef vector<T>::reverse_iterator Diades::Graph::NodeMap< T >::ReverseIterator

ReverseIterator internal reverse iterator of the mapping (use it at your own risk)

Definition at line 81 of file NodeMap.hh.

◆ SizeType

template<typename T>
typedef vector<T>::size_type Diades::Graph::NodeMap< T >::SizeType

SizeType the type of the size of the map

Definition at line 61 of file NodeMap.hh.

◆ ValueType

template<typename T>
typedef vector<T>::value_type Diades::Graph::NodeMap< T >::ValueType

ValueType the type T

Definition at line 49 of file NodeMap.hh.

Constructor & Destructor Documentation

◆ NodeMap() [1/2]

template<typename T >
Diades::Graph::NodeMap< T >::NodeMap ( )

Default constructor

Make an invalid map (empty). You must initilialize it with init

Definition at line 300 of file NodeMap.hh.

◆ NodeMap() [2/2]

template<typename T >
Diades::Graph::NodeMap< T >::NodeMap ( Graph g,
SizeType  capacity = 0,
ValueType  dflt = ValueType() 
)
explicit

Parametrized constructor

Parameters
gGraph whose nodes will be associated in the map
capacityNode capacity (memory allocation). This parameter is considered only if it is greater than the node capacity of the graph
dfltT default value associated to each node of the graph

Construction of a map for the nodes of Graph g to the value dflt

Definition at line 304 of file NodeMap.hh.

◆ ~NodeMap()

template<typename T>
Diades::Graph::NodeMap< T >::~NodeMap ( )
inline

destructor

Definition at line 119 of file NodeMap.hh.

Member Function Documentation

◆ clear()

template<typename T>
void Diades::Graph::NodeMap< T >::clear ( )
inline

◆ export2dot()

template<typename T >
void Diades::Graph::NodeMap< T >::export2dot ( ostream &  os)

Export the map as a dot file. Require that the function printDot is working on the type T

Parameters
ostreamoutput stream

Definition at line 443 of file NodeMap.hh.

Referenced by Diades::Graph::NodeMap< Status >::valid().

◆ init()

template<typename T >
void Diades::Graph::NodeMap< T >::init ( Graph g,
SizeType  capacity = 0,
ValueType  dflt = ValueType() 
)

◆ initValue()

template<typename T >
NodeIterator Diades::Graph::NodeMap< T >::initValue ( NodeIterator  begin,
NodeIterator  end,
ConstReference  value 
)

◆ nodeBegin()

template<typename T>
NodeMapIterator< typename NodeMap< T >::ValueType > Diades::Graph::NodeMap< T >::nodeBegin ( ConstReference  value) const

NodeMapIterator

Definition at line 475 of file NodeMap.hh.

Referenced by Diades::Graph::NodeMap< Status >::owner().

◆ nodeEnd()

template<typename T>
NodeMapIterator< typename NodeMap< T >::ValueType > Diades::Graph::NodeMap< T >::nodeEnd ( ConstReference  value) const

NodeMapIterator

Definition at line 483 of file NodeMap.hh.

Referenced by Diades::Graph::NodeMap< Status >::owner().

◆ operator[]() [1/2]

template<typename T >
NodeMap< T >::Reference Diades::Graph::NodeMap< T >::operator[] ( Node  node)

Read/write accessor function

Parameters
nodeNode to read/write the associated information
Returns
a reference to the value associated to node.

Use this function to change the value of an element in the map

Definition at line 329 of file NodeMap.hh.

Referenced by Diades::Graph::NodeMap< Status >::valid().

◆ operator[]() [2/2]

template<typename T >
NodeMap< T >::ConstReference Diades::Graph::NodeMap< T >::operator[] ( Node  node) const

Read-only accessor function

Parameters
nodeNode to read the associated information
Returns
a constant reference to the value associated to trans.

Be careful, this operator returns an undefined value if not initialized before.

Definition at line 342 of file NodeMap.hh.

◆ owner() [1/2]

template<typename T>
const Graph& Diades::Graph::NodeMap< T >::owner ( ) const
inline
Returns
the owner of the map

Definition at line 156 of file NodeMap.hh.

Referenced by Diades::Graph::NodeMapIterator< T >::NodeMapIterator(), and Diades::Graph::NodeMapIterator< T >::operator++().

◆ owner() [2/2]

template<typename T>
Graph& Diades::Graph::NodeMap< T >::owner ( )
inline
Returns
the owner of the map

Definition at line 163 of file NodeMap.hh.

◆ typeName()

template<typename T>
static string Diades::Graph::NodeMap< T >::typeName ( )
inlinestatic

Definition at line 32 of file NodeMap.hh.

◆ valid()

template<typename T>
bool Diades::Graph::NodeMap< T >::valid ( ) const
inline

Validity of the map

Returns
true if the map is valid (has an owner)

Definition at line 182 of file NodeMap.hh.

Member Data Documentation

◆ _dflt

template<typename T>
ValueType Diades::Graph::NodeMap< T >::_dflt
private

Definition at line 229 of file NodeMap.hh.

◆ _owner

template<typename T>
Graph* Diades::Graph::NodeMap< T >::_owner
private

◆ _tabData

template<typename T>
vector<ValueType> Diades::Graph::NodeMap< T >::_tabData
mutableprivate

Definition at line 227 of file NodeMap.hh.

Referenced by Diades::Graph::NodeMap< Status >::clear().


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