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.
const DiscreteVariable & variableFromName(const std::string &name) const
VariableNodeMap & operator=(const VariableNodeMap &source)
Copy operator.
void _copy_(const VariableNodeMap &source)
effectively do the copy (for copy constructor or operator=)
void erase(const DiscreteVariable &var)
Removes a var and it's id of this mapping. The pointer is deleted.
~VariableNodeMap()
Destructor.
const std::string & name(const DiscreteVariable &var) const
Returns the name of a variable.
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.
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.
NodeId idFromName(const std::string &name) const
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
void changeName(NodeId id, const std::string &new_name)
we allow the user to change the name of a variable
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.