30 #ifndef GUM_MULTI_DIM_FUNCTION_GRAPH_EXACT_TERMINAL_NODE_POLICY_H 31 #define GUM_MULTI_DIM_FUNCTION_GRAPH_EXACT_TERMINAL_NODE_POLICY_H 33 #include <agrum/tools/core/bijection.h> 34 #include <agrum/tools/graphs/parts/nodeGraphPart.h> 35 #include <agrum/tools/multidim/utils/FunctionGraphUtilities/terminalNodePolicies/ITerminalNodePolicy.h> 49 template <
typename GUM_SCALAR >
58 void addTerminalNode(
const NodeId& n,
const GUM_SCALAR& v) { _map_.insert(n, v); }
100 bool hasValue()
const {
return _mappy_ != _map_.endSafe(); }
107 const GUM_SCALAR&
value()
const {
return _mappy_.second(); }
111 const NodeId&
id()
const {
return _mappy_.first(); }
Bijection< NodeId, GUM_SCALAR > _map_
void nextValue() const
Increments the constant safe iterator.
void beginValues() const
Initializes the constant safe iterator on terminal nodes.
void clearAllTerminalNodes()
Erase all terminal nodes.
const NodeId & id() const
Returns the id of the current terminal nodes pointed by the constant safe iterator.
INLINE void emplace(Args &&... args)
void eraseTerminalNode(const NodeId &n)
Remove node matching given id.
const NodeId & terminalNodeId(const GUM_SCALAR &v) const
Returns the id of the terminal node that has the given value.
bool existsTerminalNodeWithValue(const GUM_SCALAR &v) const
Returns true if a terminal node matching this value exists.
void addTerminalNode(const NodeId &n, const GUM_SCALAR &v)
Insert a new terminal node with given value.
bool hasValue() const
Indicates if constant safe iterator has reach end of terminal nodes list.
const GUM_SCALAR & terminalNodeValue(const NodeId &n) const
Returns the value of the terminal node that has the given id.
bool existsTerminalNodeWithId(const NodeId &n) const
Returns true if a terminal node matching this id exists.
BijectionIteratorSafe< NodeId, GUM_SCALAR > _mappy_
Implementation of a Terminal Node Policy that maps nodeid directly to value.
const GUM_SCALAR & value() const
Returns the value of the current terminal nodes pointed by the constant safe iterator.