Class SBDDataGraphNodeIndexer#
ClassList > SBDDataGraphNodeIndexer
This class describes a node indexer. More...
#include <SBDDataGraphNodeIndexer.hpp>
Inherits the following classes: SBCContainerIndexer
Public Functions#
| Type | Name |
|---|---|
| SBDDataGraphNodeIndexer () Constructs a node indexer. |
|
| SBDDataGraphNodeIndexer (unsigned int initialSize) Constructs a node indexer with a pre-allocated initialSize . |
|
| SBDDataGraphNodeIndexer (std::set< SBDDataGraphNode * > & nodeSet) Constructs an indexer from the set of nodes. |
|
| SBDDataGraphNodeIndexer (std::vector< SBDDataGraphNode * > & nodeVector) Constructs an indexer from the vector of nodes. |
|
| SBDDataGraphNodeIndexer (std::initializer_list< SBDDataGraphNode * > nodeList) Constructs a node indexer using the initializer list. |
|
| SBDDataGraphNodeIndexer (const SBDDataGraphNodeIndexer & other) Copy constructor. |
|
| SBDDataGraphNodeIndexer (SBDDataGraphNodeIndexer && other) noexcept Move constructor. |
|
| unsigned int | addNode (SBDDataGraphNode * node) Adds a node to the indexer and returns the index of the node. |
| unsigned int | getIndex (SBDDataGraphNode * node) const Returns the index associated to the node . |
| bool | getIndex (SBDDataGraphNode * node, unsigned int & index) const Returns the index associated to the node . |
| SBDDataGraphNode * | getNode (unsigned int index) const Returns the node with the given index . |
| void | getNodes (SBDDataGraphNodeIndexer & nodeIndexer, const SBNodePredicate & selectionPredicate=SBNodePredicateTrue(), const SBNodePredicate & visitPredicate=SBNodePredicateTrue(), bool includeDependencies=false) const Collects nodes into nodeIndexer , based on aselectionPredicate and avisitPredicate , with or without dependencies. |
| void | getRootNodes (SBDDataGraphNodeIndexer & nodeIndexer) const Collect the root nodes among the indexed nodes, i.e. the nodes that do not have indexed ascendants. |
| bool | hasIndex (SBDDataGraphNode * node) const Returns true if the__node has an index. |
| bool | hasNode (SBDDataGraphNode * node) const Returns true if the__node has an index. |
| bool | hasNode (const SBNodePredicate & selectionPredicate=SBNodePredicateTrue(), const SBNodePredicate & visitPredicate=SBNodePredicateTrue(), bool includeDependencies=false) const Checks for nodes based on a selectionPredicate and avisitPredicate , with or without dependencies. |
| SBDDataGraphNodeIndexer & | operator= (const SBDDataGraphNodeIndexer & other) Copy assignment. |
| SBDDataGraphNodeIndexer & | operator= (SBDDataGraphNodeIndexer && other) Move assignment. |
| SBDDataGraphNode * | operator[] (unsigned int i) const Returns the node with the given index . |
| unsigned int | removeNode (SBDDataGraphNode * node) Erases the node from the indexer. |
| virtual | ~SBDDataGraphNodeIndexer () Destructs the node indexer. |
Public Functions inherited from SBCContainerIndexer#
| Type | Name |
|---|---|
| SBCContainerIndexer () Creates an indexer. |
|
| SBCContainerIndexer (unsigned int initialSize) Creates an indexer with a default pre-allocated size. |
|
| SBCContainerIndexer (std::set< ObjectType > & objectSet) Constructs an indexer using the set of objects. |
|
| SBCContainerIndexer (std::vector< ObjectType > & objectVector) Constructs an indexer using the vector of objects. |
|
| SBCContainerIndexer (std::initializer_list< ObjectType > objectList) Constructs an indexer using the initializer list. |
|
| SBCContainerIndexer (const SBCContainerIndexer & indexer) Copy constructor. |
|
| SBCContainerIndexer (SBCContainerIndexer && indexer) noexcept Move constructor. |
|
| iterator | begin () Returns an iterator that points to the beginning of the indexer. |
| const_iterator | begin () const Returns an iterator that points to the beginning of the indexer. |
| void | clear () Clears the indexer. |
| bool | empty () const Returns true if and only if the indexer is empty. |
| iterator | end () Returns an iterator that points to the end of the indexer. |
| const_iterator | end () const Returns an iterator that points to the end of the indexer. |
| unsigned int | eraseIndex (unsigned int objectIndex) Erases object objectIndex from the indexer. |
| unsigned int | eraseObject (const ObjectType & object) Erases the object from the indexer. |
| unsigned int | getIndex (const ObjectType & object) const Returns the index associated to the object . |
| bool | getIndex (const ObjectType & object, unsigned int & index) const Returns the index associated to the object . |
| ObjectType | getObject (unsigned int index) const Returns the object associated to the index . |
| bool | hasIndex (const ObjectType & object) const Returns true if the__object has an index. |
| unsigned int | insert (unsigned int i, const ObjectType & object) Inserts an object in the indexer at position i if possible, and returns the index of the object. |
| SBCContainerIndexer & | operator= (const SBCContainerIndexer & indexer) Copy assignment. |
| SBCContainerIndexer & | operator= (SBCContainerIndexer && indexer) noexcept Move assignment. |
| ObjectType | operator[] (unsigned int index) const Returns the object associated to the index . |
| unsigned int | pop_back () Adds an object in the indexer and returns the index of the object. |
| void | print (std::ostream & os) const Prints some debugging information. |
| void | print () const Prints some debugging information. |
| unsigned int | push_back (const ObjectType & object) Adds an object in the indexer if possible, and returns the index of the object. |
| reverse_iterator | rbegin () Returns a reverse iterator that points to the reverse beginning of the indexer. |
| const_reverse_iterator | rbegin () const Returns a reverse iterator that points to the reverse beginning of the indexer. |
| reverse_iterator | rend () Returns a reverse iterator that points to the reverse end of the indexer. |
| const_reverse_iterator | rend () const Returns a reverse iterator that points to the reverse end of the indexer. |
| unsigned int | size () const Returns the number of indexed objects. |
| virtual | ~SBCContainerIndexer () Destructs the indexer. |
Protected Attributes inherited from SBCContainerIndexer#
| Type | Name |
|---|---|
| HashMap * | indexMap The hash map. |
| Vector * | objectVector The object vector. |
Detailed Description#
Short name: SBNodeIndexer
Public Functions Documentation#
function SBDDataGraphNodeIndexer [1/7]#
Constructs a node indexer.
function SBDDataGraphNodeIndexer [2/7]#
Constructs a node indexer with a pre-allocated initialSize .
Constructs a node indexer with a pre-allocated initial size.
Parameters:
initialSizePre-allocated size for the indexer.
function SBDDataGraphNodeIndexer [3/7]#
Constructs an indexer from the set of nodes.
explicit SBDDataGraphNodeIndexer::SBDDataGraphNodeIndexer (
std::set< SBDDataGraphNode * > & nodeSet
)
Constructs an indexer from the given set of nodes.
Parameters:
nodeSetSet of node pointers to initialize the indexer with.
function SBDDataGraphNodeIndexer [4/7]#
Constructs an indexer from the vector of nodes.
explicit SBDDataGraphNodeIndexer::SBDDataGraphNodeIndexer (
std::vector< SBDDataGraphNode * > & nodeVector
)
Constructs an indexer from the given vector of nodes.
Parameters:
nodeVectorVector of node pointers to initialize the indexer with.
function SBDDataGraphNodeIndexer [5/7]#
Constructs a node indexer using the initializer list.
explicit SBDDataGraphNodeIndexer::SBDDataGraphNodeIndexer (
std::initializer_list< SBDDataGraphNode * > nodeList
)
Parameters:
nodeListInitializer list of node pointers.
function SBDDataGraphNodeIndexer [6/7]#
Copy constructor.
Copy constructs an indexer from another.
Parameters:
otherSource indexer to copy from.
function SBDDataGraphNodeIndexer [7/7]#
Move constructor.
Move constructs an indexer from another.
Parameters:
otherSource indexer to move from.
function addNode#
Adds a node to the indexer and returns the index of the node.
Adds a node to the indexer and returns its index.
Parameters:
nodePointer to the node to add.
Returns:
Index assigned to the added node.
function getIndex [1/2]#
Returns the index associated to the node .
Retrieves the index associated with the given node.
Parameters:
nodePointer to the node.
Returns:
Index of the node.
function getIndex [2/2]#
Returns the index associated to the node .
Retrieves the index associated with the given node, if it exists.
Parameters:
nodePointer to the node.indexOutput parameter that receives the index if the node has one.
Returns:
true if the node has an index; false otherwise.
function getNode#
Returns the node with the given index .
Retrieves the node at the specified index.
Parameters:
indexIndex of the node to retrieve.
Returns:
Pointer to the node if index is valid; nullptr otherwise.
function getNodes#
Collects nodes into nodeIndexer , based on aselectionPredicate and avisitPredicate , with or without dependencies.
void SBDDataGraphNodeIndexer::getNodes (
SBDDataGraphNodeIndexer & nodeIndexer,
const SBNodePredicate & selectionPredicate=SBNodePredicateTrue (),
const SBNodePredicate & visitPredicate=SBNodePredicateTrue (),
bool includeDependencies=false
) const
Collects nodes from each indexed node into a target indexer.
For each node in the indexer, this function calls the getNodes function.
Note that the nodeIndexer is not cleared when entering this function.
Parameters:
nodeIndexerTarget indexer to collect nodes into.selectionPredicatePredicate used to select nodes.visitPredicatePredicate used to determine traversal of node children.includeDependenciesIf true, dependencies are included in the collection.
See also: SBNodePredicate
See also: getNodes
function getRootNodes#
Collect the root nodes among the indexed nodes, i.e. the nodes that do not have indexed ascendants.
Collects root nodes among the indexed nodes.
Collects the root nodes among the indexed nodes, i.e. the nodes that do not have indexed ascendants. The resulting root nodes are added in the nodeIndexer.
For example, if the indexed nodes contain two nodes - an atom and its direct parent node (e.g. a backbone node) - then only this parent node will be added in the resulting nodeIndexer.
Note that the nodeIndexer is not cleared when entering this function.
Parameters:
nodeIndexerTarget indexer to receive root nodes.
function hasIndex#
Returns true if the__node has an index.
Checks whether the given node has an index in the indexer.
Parameters:
nodePointer to the node to check.
Returns:
true if the node has an index; false otherwise.
function hasNode [1/2]#
Returns true if the__node has an index.
Checks whether the given node has an index in the indexer.
Parameters:
nodePointer to the node to check.
Returns:
true if the node has an index; false otherwise.
function hasNode [2/2]#
Checks for nodes based on a selectionPredicate and avisitPredicate , with or without dependencies.
bool SBDDataGraphNodeIndexer::hasNode (
const SBNodePredicate & selectionPredicate=SBNodePredicateTrue (),
const SBNodePredicate & visitPredicate=SBNodePredicateTrue (),
bool includeDependencies=false
) const
Checks whether any indexed node satisfies the given predicates.
For each node in the indexer, this function calls the hasNode function until either the called function returns true or the indexer is fully traversed.
Parameters:
selectionPredicatePredicate used to select nodes.visitPredicatePredicate used to determine traversal of node children.includeDependenciesIf true, dependencies are included in the check.
Returns:
true if any node matches the predicates; false otherwise.
See also: SBNodePredicate
See also: hasNode
function operator=#
Copy assignment.
SBDDataGraphNodeIndexer & SBDDataGraphNodeIndexer::operator= (
const SBDDataGraphNodeIndexer & other
)
Copies the content of another indexer into this indexer.
Parameters:
otherSource indexer to copy from.
Returns:
Reference to this indexer.
function operator=#
Move assignment.
Moves the content of another indexer into this indexer.
Parameters:
otherSource indexer to move from.
Returns:
Reference to this indexer.
function operator[]#
Returns the node with the given index .
Retrieves the node at the given index.
Parameters:
indexIndex of the node to retrieve.
Returns:
Pointer to the node if index is valid; nullptr otherwise.
function removeNode#
Erases the node from the indexer.
Removes a node from the indexer.
Parameters:
nodePointer to the node to remove.
Returns:
Index of the removed node.
function ~SBDDataGraphNodeIndexer#
Destructs the node indexer.
Destroys the node indexer.