aGrUM  0.16.0
gum::ExactTerminalNodePolicy< GUM_SCALAR > Class Template Reference

Implementation of a Terminal Node Policy that maps nodeid directly to value. More...

#include <agrum/multidim/FunctionGraphUtilities/terminalNodePolicies/ExactTerminalNodePolicy.h>

+ Inheritance diagram for gum::ExactTerminalNodePolicy< GUM_SCALAR >:
+ Collaboration diagram for gum::ExactTerminalNodePolicy< GUM_SCALAR >:

Public Member Functions

Terminal Node Creation and Destruction
void addTerminalNode (const NodeId &n, const GUM_SCALAR &v)
 Insert a new terminal node with given value. More...
 
void eraseTerminalNode (const NodeId &n)
 Remove node matching given id. More...
 
void clearAllTerminalNodes ()
 Erase all terminal nodes. More...
 
Terminal Nodes Existence
bool existsTerminalNodeWithId (const NodeId &n) const
 Returns true if a terminal node matching this id exists. More...
 
bool existsTerminalNodeWithValue (const GUM_SCALAR &v) const
 Returns true if a terminal node matching this value exists. More...
 
Terminal Nodes value and id access
const GUM_SCALAR & terminalNodeValue (const NodeId &n) const
 Returns the value of the terminal node that has the given id. More...
 
const NodeIdterminalNodeId (const GUM_SCALAR &v) const
 Returns the id of the terminal node that has the given value. More...
 
Iterator on Terminal Nodes
void beginValues () const
 Initializes the constant safe iterator on terminal nodes. More...
 
bool hasValue () const
 Indicates if constant safe iterator has reach end of terminal nodes list. More...
 
void nextValue () const
 Increments the constant safe iterator. More...
 
const GUM_SCALAR & value () const
 Returns the value of the current terminal nodes pointed by the constant safe iterator. More...
 
const NodeIdid () const
 Returns the id of the current terminal nodes pointed by the constant safe iterator. More...
 

Detailed Description

template<typename GUM_SCALAR>
class gum::ExactTerminalNodePolicy< GUM_SCALAR >

Implementation of a Terminal Node Policy that maps nodeid directly to value.

Definition at line 50 of file ExactTerminalNodePolicy.h.

Member Function Documentation

◆ addTerminalNode()

template<typename GUM_SCALAR >
void gum::ExactTerminalNodePolicy< GUM_SCALAR >::addTerminalNode ( const NodeId n,
const GUM_SCALAR &  v 
)
inlinevirtual

Insert a new terminal node with given value.

Implements gum::ITerminalNodePolicy< GUM_SCALAR >.

Definition at line 58 of file ExactTerminalNodePolicy.h.

References gum::ExactTerminalNodePolicy< GUM_SCALAR >::__map, and gum::BijectionImplementation< T1, T2, Alloc, Gen >::insert().

58  {
59  __map.insert(n, v);
60  }
void insert(const T1 &first, const T2 &second)
Inserts a new association in the gum::Bijection.
Bijection< NodeId, GUM_SCALAR > __map
+ Here is the call graph for this function:

◆ beginValues()

template<typename GUM_SCALAR >
void gum::ExactTerminalNodePolicy< GUM_SCALAR >::beginValues ( ) const
inlinevirtual

Initializes the constant safe iterator on terminal nodes.

Implements gum::ITerminalNodePolicy< GUM_SCALAR >.

Definition at line 107 of file ExactTerminalNodePolicy.h.

References gum::ExactTerminalNodePolicy< GUM_SCALAR >::__map, gum::ExactTerminalNodePolicy< GUM_SCALAR >::__mappy, and gum::BijectionImplementation< T1, T2, Alloc, Gen >::beginSafe().

Referenced by gum::StructuredPlaner< double >::makePlanning().

107 { __mappy = __map.beginSafe(); }
Bijection< NodeId, GUM_SCALAR > __map
iterator_safe beginSafe() const
Returns the safe iterator at the beginning of the gum::Bijection.
BijectionIteratorSafe< NodeId, GUM_SCALAR > __mappy
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ clearAllTerminalNodes()

template<typename GUM_SCALAR >
void gum::ExactTerminalNodePolicy< GUM_SCALAR >::clearAllTerminalNodes ( )
inlinevirtual

Erase all terminal nodes.

Implements gum::ITerminalNodePolicy< GUM_SCALAR >.

Definition at line 66 of file ExactTerminalNodePolicy.h.

References gum::ExactTerminalNodePolicy< GUM_SCALAR >::__map, and gum::BijectionImplementation< T1, T2, Alloc, Gen >::clear().

66 { __map.clear(); }
void clear()
Removes all the associations from the gum::Bijection.
Bijection< NodeId, GUM_SCALAR > __map
+ Here is the call graph for this function:

◆ eraseTerminalNode()

template<typename GUM_SCALAR >
void gum::ExactTerminalNodePolicy< GUM_SCALAR >::eraseTerminalNode ( const NodeId n)
inlinevirtual

Remove node matching given id.

Implements gum::ITerminalNodePolicy< GUM_SCALAR >.

Definition at line 63 of file ExactTerminalNodePolicy.h.

References gum::ExactTerminalNodePolicy< GUM_SCALAR >::__map, and gum::BijectionImplementation< T1, T2, Alloc, Gen >::eraseFirst().

63 { __map.eraseFirst(n); }
void eraseFirst(const T1 &first)
Erases an association containing the given first element.
Bijection< NodeId, GUM_SCALAR > __map
+ Here is the call graph for this function:

◆ existsTerminalNodeWithId()

template<typename GUM_SCALAR >
bool gum::ExactTerminalNodePolicy< GUM_SCALAR >::existsTerminalNodeWithId ( const NodeId n) const
inlinevirtual

Returns true if a terminal node matching this id exists.

Implements gum::ITerminalNodePolicy< GUM_SCALAR >.

Definition at line 75 of file ExactTerminalNodePolicy.h.

References gum::ExactTerminalNodePolicy< GUM_SCALAR >::__map, and gum::BijectionImplementation< T1, T2, Alloc, Gen >::existsFirst().

75  {
76  return __map.existsFirst(n);
77  }
bool existsFirst(const T1 &first) const
Returns true if first is the first element in a pair in the gum::Bijection.
Bijection< NodeId, GUM_SCALAR > __map
+ Here is the call graph for this function:

◆ existsTerminalNodeWithValue()

template<typename GUM_SCALAR >
bool gum::ExactTerminalNodePolicy< GUM_SCALAR >::existsTerminalNodeWithValue ( const GUM_SCALAR &  v) const
inlinevirtual

Returns true if a terminal node matching this value exists.

Implements gum::ITerminalNodePolicy< GUM_SCALAR >.

Definition at line 80 of file ExactTerminalNodePolicy.h.

References gum::ExactTerminalNodePolicy< GUM_SCALAR >::__map, and gum::BijectionImplementation< T1, T2, Alloc, Gen >::existsSecond().

80  {
81  return __map.existsSecond(v);
82  }
bool existsSecond(const T2 &second) const
Returns true if second is the second element in a pair in the gum::Bijection.
Bijection< NodeId, GUM_SCALAR > __map
+ Here is the call graph for this function:

◆ hasValue()

template<typename GUM_SCALAR >
bool gum::ExactTerminalNodePolicy< GUM_SCALAR >::hasValue ( ) const
inlinevirtual

Indicates if constant safe iterator has reach end of terminal nodes list.

Implements gum::ITerminalNodePolicy< GUM_SCALAR >.

Definition at line 110 of file ExactTerminalNodePolicy.h.

References gum::ExactTerminalNodePolicy< GUM_SCALAR >::__map, gum::ExactTerminalNodePolicy< GUM_SCALAR >::__mappy, and gum::BijectionImplementation< T1, T2, Alloc, Gen >::endSafe().

Referenced by gum::StructuredPlaner< double >::makePlanning().

110 { return __mappy != __map.endSafe(); }
Bijection< NodeId, GUM_SCALAR > __map
BijectionIteratorSafe< NodeId, GUM_SCALAR > __mappy
const iterator_safe & endSafe() const noexcept
Returns the safe iterator at the end of the gum::Bijection.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ id()

template<typename GUM_SCALAR >
const NodeId& gum::ExactTerminalNodePolicy< GUM_SCALAR >::id ( ) const
inlinevirtual

Returns the id of the current terminal nodes pointed by the constant safe iterator.

Implements gum::ITerminalNodePolicy< GUM_SCALAR >.

Definition at line 121 of file ExactTerminalNodePolicy.h.

References gum::ExactTerminalNodePolicy< GUM_SCALAR >::__mappy, and gum::BijectionIteratorSafe< T1, T2 >::first().

121 { return __mappy.first(); }
BijectionIteratorSafe< NodeId, GUM_SCALAR > __mappy
const T1 & first() const
Returns the first element of the current association.
+ Here is the call graph for this function:

◆ nextValue()

template<typename GUM_SCALAR >
void gum::ExactTerminalNodePolicy< GUM_SCALAR >::nextValue ( ) const
inlinevirtual

Increments the constant safe iterator.

Implements gum::ITerminalNodePolicy< GUM_SCALAR >.

Definition at line 113 of file ExactTerminalNodePolicy.h.

References gum::ExactTerminalNodePolicy< GUM_SCALAR >::__mappy.

Referenced by gum::StructuredPlaner< double >::makePlanning().

113 { ++__mappy; }
BijectionIteratorSafe< NodeId, GUM_SCALAR > __mappy
+ Here is the caller graph for this function:

◆ terminalNodeId()

template<typename GUM_SCALAR >
const NodeId& gum::ExactTerminalNodePolicy< GUM_SCALAR >::terminalNodeId ( const GUM_SCALAR &  v) const
inlinevirtual

Returns the id of the terminal node that has the given value.

Implements gum::ITerminalNodePolicy< GUM_SCALAR >.

Definition at line 96 of file ExactTerminalNodePolicy.h.

References gum::ExactTerminalNodePolicy< GUM_SCALAR >::__map, and gum::BijectionImplementation< T1, T2, Alloc, Gen >::first().

Referenced by gum::StatesCounter::__incState().

96  {
97  return __map.first(v);
98  }
const T1 & first(const T2 &second) const
Returns the first value of a pair given its second value.
Bijection< NodeId, GUM_SCALAR > __map
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ terminalNodeValue()

template<typename GUM_SCALAR >
const GUM_SCALAR& gum::ExactTerminalNodePolicy< GUM_SCALAR >::terminalNodeValue ( const NodeId n) const
inlinevirtual

Returns the value of the terminal node that has the given id.

Implements gum::ITerminalNodePolicy< GUM_SCALAR >.

Definition at line 91 of file ExactTerminalNodePolicy.h.

References gum::ExactTerminalNodePolicy< GUM_SCALAR >::__map, and gum::BijectionImplementation< T1, T2, Alloc, Gen >::second().

91  {
92  return __map.second(n);
93  }
const T2 & second(const T1 &first) const
Returns the second value of a pair given its first value.
Bijection< NodeId, GUM_SCALAR > __map
+ Here is the call graph for this function:

◆ value()

template<typename GUM_SCALAR >
const GUM_SCALAR& gum::ExactTerminalNodePolicy< GUM_SCALAR >::value ( ) const
inlinevirtual

Returns the value of the current terminal nodes pointed by the constant safe iterator.

Implements gum::ITerminalNodePolicy< GUM_SCALAR >.

Definition at line 117 of file ExactTerminalNodePolicy.h.

References gum::ExactTerminalNodePolicy< GUM_SCALAR >::__mappy, and gum::BijectionIteratorSafe< T1, T2 >::second().

Referenced by gum::StructuredPlaner< double >::makePlanning().

117 { return __mappy.second(); }
BijectionIteratorSafe< NodeId, GUM_SCALAR > __mappy
const T2 & second() const
Returns the second element of the current association.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ __map

◆ __mappy


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