souffle  2.0.2-371-g6315b36
Public Member Functions | Protected Attributes
souffle::Relation::iterator Class Reference

Wrapper class for abstract iterator. More...

#include <SouffleInterface.h>

Collaboration diagram for souffle::Relation::iterator:
Collaboration graph

Public Member Functions

 iterator ()=default
 Constructor. More...
 
 iterator (const iterator &o)
 Constructor. More...
 
 iterator (iterator &&arg)=default
 Move constructor. More...
 
 iterator (std::unique_ptr< iterator_base > it)
 Constructor. More...
 
bool operator!= (const iterator &o) const
 Overload the "!=" operator. More...
 
tupleoperator* () const
 Overload the "*" operator. More...
 
iteratoroperator++ ()
 Overload the "++" operator. More...
 
iterator operator++ (int)
 Overload the "++" operator. More...
 
iteratoroperator= (const iterator &o)
 Overload the "=" operator. More...
 
iteratoroperator= (iterator &&o)
 
bool operator== (const iterator &o) const
 Overload the "==" operator. More...
 
 ~iterator ()=default
 Destructor. More...
 

Protected Attributes

std::unique_ptr< iterator_baseiter = nullptr
 

Detailed Description

Wrapper class for abstract iterator.

Users must use iterator class to access the tuples stored in a relation.

Definition at line 158 of file SouffleInterface.h.

Constructor & Destructor Documentation

◆ iterator() [1/4]

souffle::Relation::iterator::iterator ( )
default

Constructor.

◆ iterator() [2/4]

souffle::Relation::iterator::iterator ( iterator &&  arg)
default

Move constructor.

The new iterator now has ownerhsip of the iterator base.

Parameters
arglvalue reference to an iterator object

◆ iterator() [3/4]

souffle::Relation::iterator::iterator ( std::unique_ptr< iterator_base it)
inline

Constructor.

Initialise this iterator with a given iterator base

The new iterator has ownership of the iterator base.

Parameters
argAn iterator_base class pointer

Definition at line 190 of file SouffleInterface.h.

200 : iter(o.iter->clone()) {}

◆ ~iterator()

souffle::Relation::iterator::~iterator ( )
default

Destructor.

The iterator_base instance iter is pointing is destructed.

◆ iterator() [4/4]

souffle::Relation::iterator::iterator ( const iterator o)
inline

Constructor.

Initialise the iter to be the clone of arg.

Parameters
oReference to an iterator object

Definition at line 206 of file SouffleInterface.h.

207 {

References iter, and o.

Member Function Documentation

◆ operator!=()

bool souffle::Relation::iterator::operator!= ( const iterator o) const
inline

Overload the "!=" operator.

Check if the iterator object o is not the same as the current object.

Parameters
oReference to a iterator object
Returns
Boolean. True, if they are not the same. False, otherwise

Definition at line 283 of file SouffleInterface.h.

References souffle::Relation::getArity(), and souffle::Relation::getAuxiliaryArity().

Here is the call graph for this function:

◆ operator*()

tuple& souffle::Relation::iterator::operator* ( ) const
inline

Overload the "*" operator.

This will return the tuple that the iterator is pointing to.

Returns
Reference to a tuple object

Definition at line 258 of file SouffleInterface.h.

265  {

References iter, and o.

◆ operator++() [1/2]

iterator& souffle::Relation::iterator::operator++ ( )
inline

Overload the "++" operator.

Increment the iterator_base object that iter is pointing to so that iterator_base object points to next tuple.

Returns
Reference to the iterator object which points to the next tuple in a relation

Definition at line 231 of file SouffleInterface.h.

234  : Expensive due to copy! Included for API compatibility.

◆ operator++() [2/2]

iterator souffle::Relation::iterator::operator++ ( int  )
inline

Overload the "++" operator.

Copies the iterator, increments itself, and returns the (pre-increment) copy. WARNING: Expensive due to copy! Included for API compatibility.

Returns
Pre-increment copy of this.

Definition at line 244 of file SouffleInterface.h.

252  {

◆ operator=() [1/2]

iterator& souffle::Relation::iterator::operator= ( const iterator o)
inline

Overload the "=" operator.

The original iterator_base instance is destructed.

Definition at line 213 of file SouffleInterface.h.

225  {

◆ operator=() [2/2]

iterator& souffle::Relation::iterator::operator= ( iterator &&  o)
inline

Definition at line 218 of file SouffleInterface.h.

225  {

◆ operator==()

bool souffle::Relation::iterator::operator== ( const iterator o) const
inline

Overload the "==" operator.

Check if either the iter of o and the iter of current object are the same or the corresponding iterator_base objects are the same.

Parameters
oReference to a iterator object
Returns
Boolean. True, if either of them is true. False, otherwise

Definition at line 271 of file SouffleInterface.h.

277  {

References o.

Field Documentation

◆ iter

std::unique_ptr<iterator_base> souffle::Relation::iterator::iter = nullptr
protected

Definition at line 164 of file SouffleInterface.h.

Referenced by iterator(), and operator*().


The documentation for this class was generated from the following file:
o
var o
Definition: htmlJsChartistMin.h:15
souffle::detail::brie::copy
auto copy(span< A, arity > s)
Definition: Brie.h:98
souffle::Relation::iterator::iter
std::unique_ptr< iterator_base > iter
Definition: SouffleInterface.h:164