43 while (_pos < _nodes->bound()) {
110 return ((
_pos == it._pos) && (
_valid == it._valid) && (
_nodes == it._nodes));
197 Listener:: operator=(it);
210 Listener:: operator=(std::move(it));
221 if (
this != &p) { populateNodes(p); }
230 if (__holes && (!__holes->empty()))
231 next = *(__holes->begin());
242 if (__holes->empty()) {
257 if (__holes && (!__holes->empty())) {
258 newNode = *(__holes->begin());
259 __eraseHole(newNode);
261 newNode = __boundVal;
263 __updateEndIteratorSafe();
272 std::vector< NodeId > v;
274 for (
Idx i = 0; i < N; i++)
275 v.push_back(this->addNode());
281 return (__holes) ? (__boundVal - __holes->size()) : __boundVal;
287 if (node >= __boundVal)
return false;
289 return (!__inHoles(node));
293 return existsNode(node);
297 if (!existsNode(node))
return;
326 __endIteratorSafe._setPos(__boundVal);
330 return __endIteratorSafe;
340 return __endIteratorSafe;
348 return (*__holes == *p.
__holes);
365 for (
NodeId n = 0; n < __boundVal; ++n) {
366 if (!__inHoles(n)) son.
insert(n);
378 return __holes && __holes->contains(
id);
383 return __holes ? __holes->size() : (
Size)0;
NodeGraphPart & operator=(const NodeGraphPart &p)
copy operator
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
node_iterator_safe beginSafe() const
a begin iterator to parse the set of nodes contained in the NodeGraphPart
NodeSet * __holes
the set of nodes not contained in the NodeGraphPart in the interval 1..__max
#define GUM_EMIT1(signal, arg1)
NodeGraphPartIterator & operator=(const NodeGraphPartIterator &it) noexcept
copy assignment operator
NodeGraphPartIteratorSafe & operator=(const NodeGraphPartIteratorSafe &it)
copy assignment operator
Size size() const
alias for sizeNodes
void _validate() noexcept
ensure that the nodeId is either end() either a valid NodeId
void _setPos(NodeId id) noexcept
this function is used by NodeGraphPart to update
bool exists(const NodeId id) const
alias for existsNode
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
bool __inHoles(NodeId id) const
const NodeGraphPart * _nodes
the nodegraphpart on which points the iterator
virtual NodeId addNode()
insert a new node and return its id
~NodeGraphPartIteratorSafe()
destructor
bool operator!=(const NodeGraphPartIterator &it) const noexcept
checks whether two iterators point toward different nodes
bool operator==(const NodeGraphPart &p) const
check whether two NodeGraphParts contain the same nodes
NodeId __boundVal
the id below which NodeIds may belong to the NodeGraphPart
bool empty() const
alias for emptyNodes
bool emptyNodes() const
indicates whether there exists nodes in the NodeGraphPart
node_iterator begin() const noexcept
a begin iterator to parse the set of nodes contained in the NodeGraphPart
Unsafe iterator on the node set of a graph.
void __updateEndIteratorSafe()
updating endIterator (always at __max+1)
NodeGraphPartIteratorSafe(const NodeGraphPart &nodes)
default constructor
value_type operator*() const
dereferencing operator
NodeSet asNodeSet() const
returns a copy of the set of nodes represented by the NodeGraphPart
NodeGraphPartIterator & operator++() noexcept
increment the iterator
const NodeGraphPart & nodes() const
return *this as a NodeGraphPart
std::vector< NodeId > addNodes(Size n)
insert n nodes
Class for node sets in graph.
virtual void clear()
alias for clearNodes
bool existsNode(const NodeId id) const
returns true iff the NodeGraphPart contains the given nodeId
Size sizeNodes() const
returns the number of nodes in the NodeGraphPart
#define GUM_CONNECT(sender, signal, receiver, target)
bool operator==(const NodeGraphPartIterator &it) const noexcept
checks whether two iterators point toward the same node
NodeId bound() const
returns a number n such that all node ids are strictly lower than n
NodeId _pos
the nodeid on which the iterator points currently
virtual void clearNodes()
remove all the nodes from the NodeGraphPart
Size Idx
Type for indexes.
const node_iterator_safe & endSafe() const noexcept
the end iterator to parse the set of nodes contained in the NodeGraphPart
NodeId nextNodeId() const
returns a new node id, not yet used by any node
bool operator!=(const NodeGraphPart &p) const
check whether two NodeGraphParts contain different nodes
void __eraseHole(NodeId id)
to delete hole.
virtual ~NodeGraphPartIterator() noexcept
destructor
std::size_t Size
In aGrUM, hashed values are unsigned long int.
NodeGraphPartIterator(const NodeGraphPart &nodes) noexcept
Default constructor.
Safe iterator on the node set of a graph.
const node_iterator & end() const noexcept
the end iterator to parse the set of nodes contained in the NodeGraphPart
void whenNodeDeleted(const void *src, NodeId id)
called when a node is deleted in the iterated NodeGraphPart
Size NodeId
Type for node ids.
void insert(const Key &k)
Inserts a new element into the set.
#define GUM_ERROR(type, msg)
virtual void eraseNode(const NodeId id)
erase the node with the given id