40 while (_pos < _nodes->bound()) {
107 return ((
_pos == it._pos) && (
_valid == it._valid) && (
_nodes == it._nodes));
194 Listener:: operator=(it);
207 Listener:: operator=(std::move(it));
218 if (
this != &p) { populateNodes(p); }
227 if (__holes && (!__holes->empty()))
228 next = *(__holes->begin());
239 if (__holes->empty()) {
254 if (__holes && (!__holes->empty())) {
255 newNode = *(__holes->begin());
256 __eraseHole(newNode);
258 newNode = __boundVal;
260 __updateEndIteratorSafe();
269 std::vector< NodeId > v;
271 for (
Idx i = 0; i < N; i++)
272 v.push_back(this->addNode());
278 return (__holes) ? (__boundVal - __holes->size()) : __boundVal;
284 if (node >= __boundVal)
return false;
286 return (!__inHoles(node));
290 return existsNode(node);
294 if (!existsNode(node))
return;
323 __endIteratorSafe._setPos(__boundVal);
327 return __endIteratorSafe;
337 return __endIteratorSafe;
345 return (*__holes == *p.
__holes);
362 for (
NodeId n = 0; n < __boundVal; ++n) {
363 if (!__inHoles(n)) son.
insert(n);
375 return __holes && __holes->contains(
id);
380 return __holes ? __holes->size() : (
Size)0;
NodeGraphPart & operator=(const NodeGraphPart &p)
copy operator
Base node set class for graphs.
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
gum is the global namespace for all aGrUM entities
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