Bifrost
Public Member Functions
neighborIterator< Unitig_data_t, Graph_data_t, is_const > Class Template Reference

Iterator for the neighbors (predecessors or successors) of a reference unitig used in a UnitigMap object. More...

Inherits iterator< std::input_iterator_tag, UnitigMap< void, void, false >, int >.

Public Member Functions

 neighborIterator ()
 Constructor. More...
 
 neighborIterator (const UnitigMap< U, G, is_const > &um_, const bool is_forward_)
 Constructor. More...
 
 neighborIterator (const neighborIterator &o)
 Copy constructor. More...
 
neighborIteratoroperator++ ()
 Prefix increment, iterate over the next neighbor (predecessor or successor). More...
 
neighborIterator operator++ (int)
 Postfix increment, iterate over the next neighbor (predecessor or successor). More...
 
bool operator== (const neighborIterator &o) const
 Equality operator: check if two neighborIterator are the same. More...
 
bool operator!= (const neighborIterator &o) const
 Inequality operator: check if two neighborIterator are different. More...
 
const UnitigMap< U, G, is_const > & operator* () const
 Indirection operator. More...
 
const UnitigMap< U, G, is_const > * operator-> () const
 Dereference operator. More...
 

Detailed Description

template<typename Unitig_data_t = void, typename Graph_data_t = void, bool is_const = false>
class neighborIterator< Unitig_data_t, Graph_data_t, is_const >

Iterator for the neighbors (predecessors or successors) of a reference unitig used in a UnitigMap object.

A neighborIterator object has 3 template parameters: the type of data associated with the unitigs of the graph, the type of data associated with the graph and a boolean indicating if this is a constant iterator or not. Note that you are supposed to use this class as the iterator of a BackwardCDBG or ForwardCDBG object, which can be obtained respectively from UnitigMap::getPredecessors() and UnitigMap::getSuccessors(), so you shouldn't have to instantiate an object neighborIterator and its template parameters yourself. The unitig data and graph data types should be the same as the ones used for the CompactedDBG the iterator is from. No specific order (such as a lexicographic one) is assumed during iteration.

... // Some more code, cdbg construction
for (const auto& unitig : cdbg){
cout << unitig.toString() << endl; // unitig is of type UnitigMap
for (const auto& pred : unitig.getPredecessors()) cout << pred.toString() << endl;
for (const auto& succ : unitig.getSuccessors()) cout << succ.toString() << endl;
}

Constructor & Destructor Documentation

◆ neighborIterator() [1/3]

template<typename Unitig_data_t = void, typename Graph_data_t = void, bool is_const = false>
neighborIterator< Unitig_data_t, Graph_data_t, is_const >::neighborIterator ( )

Constructor.

Returns
an empty neighborIterator.

◆ neighborIterator() [2/3]

template<typename Unitig_data_t = void, typename Graph_data_t = void, bool is_const = false>
neighborIterator< Unitig_data_t, Graph_data_t, is_const >::neighborIterator ( const UnitigMap< U, G, is_const > &  um_,
const bool  is_forward_ 
)

Constructor.

Parameters
um_is a UnitigMap object: the constructed neighborIterator will iterate over the neighbors of the UnitigMap reference unitig
is_forward_indicates if the iterator must iterate over the successors (true) or the predecessors (false)
Returns
a neighborIterator.

◆ neighborIterator() [3/3]

template<typename Unitig_data_t = void, typename Graph_data_t = void, bool is_const = false>
neighborIterator< Unitig_data_t, Graph_data_t, is_const >::neighborIterator ( const neighborIterator< Unitig_data_t, Graph_data_t, is_const > &  o)

Copy constructor.

Returns
a copy of a neighborIterator.

Member Function Documentation

◆ operator!=()

template<typename Unitig_data_t = void, typename Graph_data_t = void, bool is_const = false>
bool neighborIterator< Unitig_data_t, Graph_data_t, is_const >::operator!= ( const neighborIterator< Unitig_data_t, Graph_data_t, is_const > &  o) const

Inequality operator: check if two neighborIterator are different.

Parameters
ois another neighborIterator.
Returns
a boolean indicating whether the two neighborIterator are different.

◆ operator*()

template<typename Unitig_data_t = void, typename Graph_data_t = void, bool is_const = false>
const UnitigMap<U, G, is_const>& neighborIterator< Unitig_data_t, Graph_data_t, is_const >::operator* ( ) const

Indirection operator.

Returns
a UnitigMap reference which contains information about the mapped neighbor.

◆ operator++() [1/2]

template<typename Unitig_data_t = void, typename Graph_data_t = void, bool is_const = false>
neighborIterator& neighborIterator< Unitig_data_t, Graph_data_t, is_const >::operator++ ( )

Prefix increment, iterate over the next neighbor (predecessor or successor).

Note that no specific order (such as a lexicographic one) is assumed during iteration.

◆ operator++() [2/2]

template<typename Unitig_data_t = void, typename Graph_data_t = void, bool is_const = false>
neighborIterator neighborIterator< Unitig_data_t, Graph_data_t, is_const >::operator++ ( int  )

Postfix increment, iterate over the next neighbor (predecessor or successor).

Note that no specific order (such as a lexicographic one) is assumed during iteration.

◆ operator->()

template<typename Unitig_data_t = void, typename Graph_data_t = void, bool is_const = false>
const UnitigMap<U, G, is_const>* neighborIterator< Unitig_data_t, Graph_data_t, is_const >::operator-> ( ) const

Dereference operator.

Returns
a UnitigMap pointer which contains information about the mapped neighbor.

◆ operator==()

template<typename Unitig_data_t = void, typename Graph_data_t = void, bool is_const = false>
bool neighborIterator< Unitig_data_t, Graph_data_t, is_const >::operator== ( const neighborIterator< Unitig_data_t, Graph_data_t, is_const > &  o) const

Equality operator: check if two neighborIterator are the same.

Parameters
ois another neighborIterator.
Returns
a boolean indicating whether the two neighborIterator are the same.

The documentation for this class was generated from the following file:
CompactedDBG
Represent a Compacted de Bruijn graph.
Definition: CompactedDBG.hpp:313