47#ifndef GUM_NODE_GRAPH_PART_H
48#define GUM_NODE_GRAPH_PART_H
58#ifndef DOXYGEN_SHOULD_SKIP_THIS
62 class NodeGraphPartTestSuite;
306 bool holes_resize_policy =
true);
350 template <
typename T >
400 virtual void clear();
453 template < typename VAL >
467 template < typename VAL >
473 template < typename VAL >
Generic doubly linked lists.
Listener()
Class constructor.
NodeGraphPartIteratorSafe & operator=(const NodeGraphPartIteratorSafe &it)
copy assignment operator
NodeId value_type
types for STL compliance
value_type & reference
types for STL compliance
~NodeGraphPartIteratorSafe()
destructor
std::ptrdiff_t difference_type
types for STL compliance
friend class NodeGraphPart
void whenNodeDeleted(const void *src, NodeId id)
called when a node is deleted in the iterated NodeGraphPart
NodeGraphPartIteratorSafe(const NodeGraphPart &nodes)
default constructor
const value_type * const_pointer
types for STL compliance
const value_type & const_reference
types for STL compliance
value_type * pointer
types for STL compliance
std::forward_iterator_tag iterator_category
types for STL compliance
std::ptrdiff_t difference_type
types for STL compliance
void setPos_(NodeId id) noexcept
this function is used by NodeGraphPart to update
const value_type & const_reference
types for STL compliance
const value_type * const_pointer
types for STL compliance
void validate_() noexcept
ensure that the nodeId is either end() either a valid NodeId
virtual ~NodeGraphPartIterator() noexcept
destructor
NodeGraphPartIterator(const NodeGraphPart &nodes) noexcept
Default constructor.
friend class NodeGraphPart
value_type & reference
types for STL compliance
const NodeGraphPart * nodes_
the nodegraphpart on which points the iterator
NodeId pos_
the nodeid on which the iterator points currently
std::forward_iterator_tag iterator_category
types for STL compliance
NodeId value_type
types for STL compliance
value_type * pointer
types for STL compliance
Class for node sets in graph.
NodeGraphPartIteratorSafe _endIteratorSafe_
the end iterator (used to speed-up parsings of the NodeGraphPart)
Signaler1< NodeId > onNodeDeleted
Size size() const
alias for sizeNodes
void populateNodes(const NodeGraphPart &s)
populateNodes clears *this and fills it with the same nodes as "s"
Signaler1< NodeId > onNodeAdded
void _clearNodes_()
code for clearing nodes (called twice)
virtual void clear()
alias for clearNodes
Size sizeNodes() const
returns the number of nodes in the NodeGraphPart
NodeId bound() const
returns a number n such that all node ids are strictly lower than n
NodeGraphPartIteratorSafe NodeIteratorSafe
void _eraseHole_(NodeId id)
to delete hole.
const NodeGraphPart & nodes() const
return *this as a NodeGraphPart
friend class NodeGraphPartIterator
NodeProperty< VAL > nodesPropertyFromFunction(VAL(*f)(const NodeId &), Size size=0) const
a method to create a HashTable with key:NodeId and value:VAL
NodeGraphPartIterator node_const_iterator
types for STL compliance
NodeGraphPartIteratorSafe node_const_iterator_safe
types for STL compliance
void _updateEndIteratorSafe_()
updating endIterator (always at max+1)
virtual void eraseNode(const NodeId id)
erase the node with the given id
friend class gum_tests::NodeGraphPartTestSuite
to enable testunits to use check
NodeGraphPartIterator node_iterator
types for STL compliance
Size _holes_size_
value for holes configuration
node_iterator_safe beginSafe() const
a begin iterator to parse the set of nodes contained in the NodeGraphPart
NodeGraphPart & operator=(const NodeGraphPart &p)
copy operator
NodeSet asNodeSet() const
returns a copy of the set of nodes represented by the NodeGraphPart
virtual std::string toString() const
a function to display the set of nodes
bool exists(const NodeId id) const
alias for existsNode
bool emptyNodes() const
indicates whether there exists nodes in the NodeGraphPart
const node_iterator_safe & endSafe() const noexcept
the end iterator to parse the set of nodes contained in the NodeGraphPart
bool empty() const
alias for emptyNodes
NodeId nextNodeId() const
returns a new node id, not yet used by any node
bool _holes_resize_policy_
value for holes configuration
virtual ~NodeGraphPart()
destructor
NodeSet * _holes_
the set of nodes not contained in the NodeGraphPart in the interval 1.
virtual void clearNodes()
remove all the nodes from the NodeGraphPart
friend class NodeGraphPartIteratorSafe
virtual NodeId addNode()
insert a new node and return its id
NodeProperty< VAL > nodesPropertyFromVal(const VAL &a, Size size=0) const
a method to create a hashMap with key:NodeId and value:VAL
NodeGraphPartIteratorSafe node_iterator_safe
types for STL compliance
bool operator!=(const NodeGraphPart &p) const
check whether two NodeGraphParts contain different nodes
node_iterator begin() const noexcept
a begin iterator to parse the set of nodes contained in the NodeGraphPart
NodeGraphPartIterator NodeIterator
NodeId _boundVal_
the id below which NodeIds may belong to the NodeGraphPart
NodeGraphPartIteratorSafe NodeConstIteratorSafe
List< VAL > listMapNodes(VAL(*f)(const NodeId &)) const
a method to create a list of VAL from a set of nodes (using for every nodee, say x,...
NodeGraphPartIterator NodeConstIterator
NodeGraphPart(Size holes_size=HashTableConst::default_size, bool holes_resize_policy=true)
default constructor
const node_iterator & end() const noexcept
the end iterator to parse the set of nodes contained in the NodeGraphPart
void _addHole_(NodeId id)
to add a hole.
void populateNodesFromProperty(const NodeProperty< T > &h)
populateNodesFromProperty clears *this and fills it with the keys of "h"
bool _inHoles_(NodeId id) const
bool existsNode(const NodeId id) const
returns true iff the NodeGraphPart contains the given nodeId
virtual void addNodeWithId(const NodeId id)
try to insert a node with the given id
bool operator==(const NodeGraphPart &p) const
check whether two NodeGraphParts contain the same nodes
std::vector< NodeId > addNodes(Size n)
insert n nodes
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.
HashTable< NodeId, VAL > NodeProperty
Property on graph elements.
Set< NodeId > NodeSet
Some typdefs and define for shortcuts ...
gum is the global namespace for all aGrUM entities
Inline implementation of the base node set class for graphs.
Implementation of the NodeGraphPart.
static constexpr Size default_size
The default number of slots in hashtables.