48#ifndef GUM_VARIABLE_NODE_MAP_H
49#define GUM_VARIABLE_NODE_MAP_H
Set of pairs of elements with fast search for both elements.
Set of pairs of elements with fast search for both elements.
Base class for discrete random variable.
Container used to map discrete variables with nodes.
VariableNodeMap(VariableNodeMap &&source)
Move constructor.
VariableNodeMap & operator=(const VariableNodeMap &source)
Copy operator.
void _copy_(const VariableNodeMap &source)
effectively do the copy (for copy constructor or operator=)
VariableNodeMap & operator=(VariableNodeMap &&source)
Move assignment operator.
void erase(const DiscreteVariable &var)
Removes a var and it's id of this mapping. The pointer is deleted.
void changeName(NodeId id, std::string_view new_name)
we allow the user to change the name of a variable
~VariableNodeMap()
Destructor.
const std::string & name(const DiscreteVariable &var) const
Returns the name of a variable.
const DiscreteVariable & variableFromName(std::string_view name) const
bool exists(const DiscreteVariable &var) const
Return true if var matches a node.
bool exists(NodeId id) const
Return true if id matches a node.
NodeId idFromName(std::string_view name) const
bool exists(std::string_view name) const
Return true if name matches a node.
void erase(NodeId id)
Removes a var and it's id of this mapping. The pointer is deleted.
Bijection< std::string, NodeId > _names2nodes_
HashTable for easely find an id from a name.
NodeId get(const DiscreteVariable &var) const
Returns a node id given it's variable.
const DiscreteVariable & get(NodeId id) const
Returns a discrete variable given it's node id.
const DiscreteVariable & operator[](NodeId id) const
Returns a discrete variable given it's node id.
void clear()
removes all the associations
VariableNodeMap(const VariableNodeMap &source)
Copy constructor Proceed a deep copy: all variables are copied but keep the same node id.
const std::string & name(NodeId id) const
Returns the name of a variable given its id.
Bijection< NodeId, const DiscreteVariable * > _nodes2vars_
Bijection between the node's NodeIds and the variables.
std::string toString() const
friendly displays the content of the VariableNodeMap
NodeId operator[](const DiscreteVariable &var) const
Returns a node id given it's variable.
Size size() const
give the size
NodeId insert(NodeId id, const DiscreteVariable &var)
Maps id with var.
VariableNodeMap()
Default constructor.
Base class for discrete random variable.
some utils for topology : NodeId, Edge, Arc and consorts ...
std::size_t Size
In aGrUM, hashed values are unsigned long int.
Size NodeId
Type for node ids.
gum is the global namespace for all aGrUM entities
std::ostream & operator<<(std::ostream &stream, const AVLTree< Val, Cmp > &tree)
display the content of a tree
Inlined implementation of VariableNodeMap.