aGrUM 2.3.2
a C++ library for (probabilistic) graphical models
gum::ExactTerminalNodePolicy< GUM_SCALAR > Class Template Reference

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

#include <agrum/base/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.
void eraseTerminalNode (const NodeId &n)
 Remove node matching given id.
void clearAllTerminalNodes ()
 Erase all terminal nodes.
Terminal Nodes Existence
bool existsTerminalNodeWithId (const NodeId &n) const
 Returns true if a terminal node matching this id exists.
bool existsTerminalNodeWithValue (const GUM_SCALAR &v) const
 Returns true if a terminal node matching this value exists.
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.
const NodeIdterminalNodeId (const GUM_SCALAR &v) const
 Returns the id of the terminal node that has the given value.
Iterator on Terminal Nodes
void beginValues () const
 Initializes the constant safe iterator on terminal nodes.
bool hasValue () const
 Indicates if constant safe iterator has reach end of terminal nodes list.
void nextValue () const
 Increments the constant safe iterator.
const GUM_SCALAR & value () const
 Returns the value of the current terminal nodes pointed by the constant safe iterator.
const NodeIdid () const
 Returns the id of the current terminal nodes pointed by the constant safe iterator.

Private Attributes

Bijection< NodeId, GUM_SCALAR > _map_
BijectionIteratorSafe< NodeId, GUM_SCALAR > _mappy_

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 70 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 78 of file ExactTerminalNodePolicy.h.

78{ _map_.insert(n, v); }
Implementation of a Terminal Node Policy that maps nodeid directly to value.
Bijection< NodeId, GUM_SCALAR > _map_

References _map_.

◆ 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 117 of file ExactTerminalNodePolicy.h.

117{ _mappy_ = _map_.beginSafe(); }
BijectionIteratorSafe< NodeId, GUM_SCALAR > _mappy_

References _map_, and _mappy_.

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

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 84 of file ExactTerminalNodePolicy.h.

84{ _map_.clear(); }

References _map_.

Referenced by gum::MultiDimFunctionGraph< GUM_SCALAR, TerminalNodePolicy >::clear().

Here is the caller 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 81 of file ExactTerminalNodePolicy.h.

81{ _map_.eraseFirst(n); }

References _map_.

◆ 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 93 of file ExactTerminalNodePolicy.h.

93{ return _map_.existsFirst(n); }

References _map_.

Referenced by gum::MultiDimFunctionGraph< GUM_SCALAR, TerminalNodePolicy >::isTerminalNode().

Here is the caller 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 96 of file ExactTerminalNodePolicy.h.

96{ return _map_.existsSecond(v); }

References _map_.

◆ 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 120 of file ExactTerminalNodePolicy.h.

120{ return _mappy_ != _map_.endSafe(); }

References _map_, and _mappy_.

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

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 131 of file ExactTerminalNodePolicy.h.

131{ return _mappy_.first(); }

References _mappy_.

◆ 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 123 of file ExactTerminalNodePolicy.h.

123{ ++_mappy_; }

References _mappy_.

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

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 108 of file ExactTerminalNodePolicy.h.

108{ return _map_.first(v); }

References _map_.

◆ 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 105 of file ExactTerminalNodePolicy.h.

105{ return _map_.second(n); }

References _map_.

Referenced by gum::MultiDimFunctionGraph< GUM_SCALAR, TerminalNodePolicy >::get(), gum::MultiDimFunctionGraph< GUM_SCALAR, TerminalNodePolicy >::nodeValue(), and gum::MultiDimFunctionGraph< GUM_SCALAR, TerminalNodePolicy >::toDot().

Here is the caller 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 127 of file ExactTerminalNodePolicy.h.

127{ return _mappy_.second(); }

References _mappy_.

Referenced by gum::MultiDimFunctionGraph< GUM_SCALAR, TerminalNodePolicy >::set().

Here is the caller graph for this function:

Member Data Documentation

◆ _map_

◆ _mappy_

template<typename GUM_SCALAR>
BijectionIteratorSafe< NodeId, GUM_SCALAR > gum::ExactTerminalNodePolicy< GUM_SCALAR >::_mappy_
mutableprivate

Definition at line 137 of file ExactTerminalNodePolicy.h.

Referenced by beginValues(), hasValue(), id(), nextValue(), and value().


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