This class describes a node indexer.
Constructors and destructors | |
SBDDataGraphNodeIndexer () | |
Constructs a node indexer. | |
SBDDataGraphNodeIndexer (unsigned int initialSize) | |
Constructs a node indexer with a pre-allocated initialSize . | |
SBDDataGraphNodeIndexer (const SBDDataGraphNodeIndexer &other) | |
Copy constructor. | |
SBDDataGraphNodeIndexer (SBDDataGraphNodeIndexer &&other) | |
Move constructor. | |
virtual | ~SBDDataGraphNodeIndexer () |
Destructs the node indexer. | |
Management | |
unsigned int | addNode (SBDDataGraphNode *node) |
Adds a node to the indexer and returns the index of the node. | |
unsigned int | removeNode (SBDDataGraphNode *node) |
Erases the node from the indexer. | |
bool | hasNode (SBDDataGraphNode *node) const |
Returns true if the node has an index. | |
SBDDataGraphNode * | getNode (unsigned int index) const |
Returns the node with the given index. | |
bool | hasIndex (SBDDataGraphNode *node) const |
Returns true if the node has an index. | |
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. | |
void | getNodes (SBDDataGraphNodeIndexer &nodeIndexer, const SBNodePredicate &selectionPredicate=SBNodePredicateTrue(), const SBNodePredicate &visitPredicate=SBNodePredicateTrue(), bool includeDependencies=false) const |
Collects nodes into nodeIndexer , based on a selectionPredicate and a visitPredicate , with or without dependencies. | |
bool | hasNode (const SBNodePredicate &selectionPredicate=SBNodePredicateTrue(), const SBNodePredicate &visitPredicate=SBNodePredicateTrue(), bool includeDependencies=false) const |
Checks for nodes based on a selectionPredicate and a visitPredicate , 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. | |
SBDDataGraphNode * | operator[] (unsigned int i) const |
Returns the node with the given index. | |
SBDDataGraphNodeIndexer & | operator= (const SBDDataGraphNodeIndexer &other) |
Copy assignment. | |
SBDDataGraphNodeIndexer & | operator= (SBDDataGraphNodeIndexer &&other) |
Move assignment. | |
Additional Inherited Members | |
Public Member Functions inherited from SBCContainerIndexer< SBDDataGraphNode * > | |
SBCContainerIndexer () | |
Creates an indexer. | |
SBCContainerIndexer (unsigned int initialSize) | |
Creates an indexer with a default pre-allocated size. | |
SBCContainerIndexer (std::set< SBDDataGraphNode * > &objectSet) | |
Indexes a set of objects. | |
SBCContainerIndexer (std::vector< SBDDataGraphNode * > &objectVector) | |
Indexes a vector of objects. | |
SBCContainerIndexer (const SBCContainerIndexer &indexer) | |
Copy constructor. | |
SBCContainerIndexer (SBCContainerIndexer &&indexer) | |
Move constructor. | |
virtual | ~SBCContainerIndexer () |
Destructs the indexer. | |
SBCContainerIndexer & | operator= (const SBCContainerIndexer &indexer) |
Copy assignment. | |
SBCContainerIndexer & | operator= (SBCContainerIndexer &&indexer) |
Move assignment. | |
void | clear () |
Clears the indexer. | |
unsigned int | push_back (const SBDDataGraphNode * &object) |
Adds an object in the indexer if possible, and returns the index of the object. | |
unsigned int | insert (unsigned int i, const SBDDataGraphNode * &object) |
Inserts an object in the indexer at position i if possible, and returns the index of the object. | |
unsigned int | pop_back () |
Adds an object in the indexer and returns the index of the object. | |
unsigned int | eraseObject (const SBDDataGraphNode * &object) |
Erases the object from the indexer. | |
unsigned int | eraseIndex (unsigned int objectIndex) |
Erases object objectIndex from the indexer. | |
bool | empty () const |
Returns true if and only if the indexer is empty. | |
unsigned int | size () const |
Returns the number of indexed objects. | |
bool | hasIndex (const SBDDataGraphNode * &object) const |
Returns true if the object has an index. | |
unsigned int | getIndex (const SBDDataGraphNode * &object) const |
Returns the index associated to the object. | |
bool | getIndex (const SBDDataGraphNode * &object, unsigned int &index) const |
Returns the index associated to the object. | |
SBDDataGraphNode * | getObject (unsigned int index) const |
Returns the object associated to the index. | |
SBDDataGraphNode * | operator[] (unsigned int index) const |
Returns the object associated to the index. | |
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. | |
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. | |
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. | |
void | print () const |
Prints some debugging information. | |
Protected Attributes inherited from SBCContainerIndexer< SBDDataGraphNode * > | |
SBCContainerHashMap< SBDDataGraphNode *, unsigned int > * | indexMap |
The hash map. | |
SBCContainerVector< SBDDataGraphNode * > * | objectVector |
The object vector. | |
void SBDDataGraphNodeIndexer::getNodes | ( | SBDDataGraphNodeIndexer & | nodeIndexer, |
const SBNodePredicate & | selectionPredicate = SBNodePredicateTrue() , |
||
const SBNodePredicate & | visitPredicate = SBNodePredicateTrue() , |
||
bool | includeDependencies = false |
||
) | const |
For each node in the indexer, this function calls the getNodes function.
Note that the nodeIndexer
is not cleared when entering this function.
void SBDDataGraphNodeIndexer::getRootNodes | ( | SBDDataGraphNodeIndexer & | nodeIndexer | ) | const |
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.
bool SBDDataGraphNodeIndexer::hasNode | ( | const SBNodePredicate & | selectionPredicate = SBNodePredicateTrue() , |
const SBNodePredicate & | visitPredicate = SBNodePredicateTrue() , |
||
bool | includeDependencies = false |
||
) | const |
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.