29 #ifndef DOXYGEN_SHOULD_SKIP_THIS 82 GUM_ERROR(DuplicateLabel,
"Unable to insert var with this name.");
87 "Unable to insert a new variable with id " <<
id <<
".");
118 const DiscreteVariable&
129 GUM_ERROR(DuplicateLabel,
"Unable to insert var with this name.");
132 DiscreteVariable* var =
133 const_cast< DiscreteVariable*
>(
__nodes2vars.second(
id));
136 var->setName(new_name);
144 INLINE
const std::string&
void insert(const T1 &first, const T2 &second)
Inserts a new association in the gum::Bijection.
const T2 & second(const T1 &first) const
Returns the second value of a pair given its first value.
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.
const T1 & first(const T2 &second) const
Returns the first value of a pair given its second value.
void eraseFirst(const T1 &first)
Erases an association containing the given first element.
NodeId insert(NodeId id, const DiscreteVariable &var)
Maps id with var.
bool exists(NodeId id) const
Return true if id matches a node.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
void erase(NodeId id)
Removes a var and it's id of this mapping. The pointer is deleted.
bool existsFirst(const T1 &first) const
Returns true if first is the first element in a pair in the gum::Bijection.
const DiscreteVariable & operator[](NodeId id) const
Returns a discrete variable given it's node id.
NodeId idFromName(const std::string &name) const
void changeName(NodeId id, const std::string &new_name)
we allow the user to change the name of a variable
Bijection< std::string, NodeId > __names2nodes
HashTable for easely find an id from a name.
const DiscreteVariable & variableFromName(const std::string &name) const
Size NodeId
Type for node ids.
#define GUM_ERROR(type, msg)
const DiscreteVariable & get(NodeId id) const
Returns a discrete variable given it's node id.