souffle  2.0.2-371-g6315b36
Public Member Functions | Protected Member Functions | Private Attributes
souffle::interpreter::RelInterface::iterator_base Class Reference

Iterator wrapper class. More...

#include <ProgInterface.h>

Inheritance diagram for souffle::interpreter::RelInterface::iterator_base:
Inheritance graph
Collaboration diagram for souffle::interpreter::RelInterface::iterator_base:
Collaboration graph

Public Member Functions

iterator_baseclone () const override
 Clone iterator. More...
 
 iterator_base (uint32_t arg_id, const RelInterface *r, RelationWrapper::Iterator i)
 
tupleoperator* () override
 Get current tuple. More...
 
void operator++ () override
 Increment iterator. More...
 
 ~iterator_base () override=default
 Destructor. More...
 
- Public Member Functions inherited from souffle::Relation::iterator_base
virtual uint32_t getId () const
 Get the ID of the iterator_base object. More...
 
 iterator_base (uint32_t arg_id)
 Constructor. More...
 
bool operator== (const iterator_base &o) const
 Overload the "==" operator. More...
 

Protected Member Functions

bool equal (const souffle::Relation::iterator_base &o) const override
 Check equivalence. More...
 

Private Attributes

RelationWrapper::Iterator it
 
const RelInterfaceramRelationInterface
 
tuple tup
 

Additional Inherited Members

- Protected Attributes inherited from souffle::Relation::iterator_base
uint32_t id
 Required for identifying type of iterator (NB: LLVM has no typeinfo). More...
 

Detailed Description

Iterator wrapper class.

Definition at line 133 of file ProgInterface.h.

Constructor & Destructor Documentation

◆ iterator_base()

souffle::interpreter::RelInterface::iterator_base::iterator_base ( uint32_t  arg_id,
const RelInterface r,
RelationWrapper::Iterator  i 
)
inline

Definition at line 135 of file ProgInterface.h.

138  {

References souffle::interpreter::RelInterface::getAttrType(), i, and ramRelationInterface.

Referenced by souffle::interpreter::RelInterface::size().

Here is the call graph for this function:

◆ ~iterator_base()

souffle::interpreter::RelInterface::iterator_base::~iterator_base ( )
overridevirtualdefault

Destructor.

Reimplemented from souffle::Relation::iterator_base.

Member Function Documentation

◆ clone()

iterator_base* souffle::interpreter::RelInterface::iterator_base::clone ( ) const
inlineoverridevirtual

Clone iterator.

Implements souffle::Relation::iterator_base.

Definition at line 176 of file ProgInterface.h.

179  :

◆ equal()

bool souffle::interpreter::RelInterface::iterator_base::equal ( const souffle::Relation::iterator_base o) const
inlineoverrideprotectedvirtual

Check equivalence.

Implements souffle::Relation::iterator_base.

Definition at line 182 of file ProgInterface.h.

185  :
186  /** Wrapped interpreter relation */
187  RelationWrapper& relation;
188 
189  /** Symbol table */

◆ operator*()

tuple& souffle::interpreter::RelInterface::iterator_base::operator* ( )
inlineoverridevirtual

Get current tuple.

Implements souffle::Relation::iterator_base.

Definition at line 145 of file ProgInterface.h.

145  : {
146  tup << ramBitCast<RamFloat>((*it)[i]);
147  break;
148  }
149  case 'u': {
150  tup << ramBitCast<RamUnsigned>((*it)[i]);
151  break;
152  }
153  default: {
154  tup << (*it)[i];
155  break;
156  }
157  }
158  }
159  tup.rewind();
160  return tup;
161  }
162 
163  /** Clone iterator */
164  iterator_base* clone() const override {
165  return new RelInterface::iterator_base(getId(), ramRelationInterface, it);
166  }
167 
168  protected:
169  /** Check equivalence */
170  bool equal(const souffle::Relation::iterator_base& o) const override {
171  try {
172  auto& iter = dynamic_cast<const RelInterface::iterator_base&>(o);
173  return ramRelationInterface == iter.ramRelationInterface && it == iter.it;

References i, and it.

◆ operator++()

void souffle::interpreter::RelInterface::iterator_base::operator++ ( )
inlineoverridevirtual

Increment iterator.

Implements souffle::Relation::iterator_base.

Definition at line 140 of file ProgInterface.h.

140  : {
141  std::string s = ramRelationInterface->getSymbolTable().resolve((*it)[i]);
142  tup << s;

References souffle::interpreter::RelInterface::getSymbolTable(), i, it, ramRelationInterface, souffle::SymbolTable::resolve(), and tup.

Here is the call graph for this function:

Field Documentation

◆ it

RelationWrapper::Iterator souffle::interpreter::RelInterface::iterator_base::it
private

◆ ramRelationInterface

const RelInterface* souffle::interpreter::RelInterface::iterator_base::ramRelationInterface
private

◆ tup

tuple souffle::interpreter::RelInterface::iterator_base::tup
private

Definition at line 194 of file ProgInterface.h.

Referenced by operator++(), and souffle::interpreter::RelInterface::size().


The documentation for this class was generated from the following file:
souffle::interpreter::RelInterface::iterator_base::clone
iterator_base * clone() const override
Clone iterator.
Definition: ProgInterface.h:176
souffle::SymbolTable::resolve
const std::string & resolve(const RamDomain index) const
Find a symbol in the table by its index, note that this gives an error if the index is out of bounds.
Definition: SymbolTable.h:154
souffle::interpreter::RelInterface::iterator_base::ramRelationInterface
const RelInterface * ramRelationInterface
Definition: ProgInterface.h:192
souffle::Relation::iterator_base
Abstract iterator class.
Definition: SouffleInterface.h:64
souffle::interpreter::RelInterface::iterator_base::tup
tuple tup
Definition: ProgInterface.h:194
souffle::interpreter::RelInterface::getSymbolTable
SymbolTable & getSymbolTable() const override
Get symbol table.
Definition: ProgInterface.h:103
i
size_t i
Definition: json11.h:663
souffle::interpreter::RelInterface::relation
RelationWrapper & relation
Wrapped interpreter relation.
Definition: ProgInterface.h:199
o
var o
Definition: htmlJsChartistMin.h:15
iterator_base
souffle::interpreter::RelInterface::iterator_base::equal
bool equal(const souffle::Relation::iterator_base &o) const override
Check equivalence.
Definition: ProgInterface.h:182
souffle::interpreter::RelInterface::iterator_base::it
RelationWrapper::Iterator it
Definition: ProgInterface.h:193
souffle::interpreter::RelInterface::RelInterface
RelInterface(RelationWrapper &r, SymbolTable &s, std::string n, std::vector< std::string > t, std::vector< std::string > an, uint32_t i)
Definition: ProgInterface.h:61
souffle::tuple::rewind
void rewind()
Reset the index giving the "current element" of the tuple to zero.
Definition: SouffleInterface.h:554
souffle::Relation::iterator_base::getId
virtual uint32_t getId() const
Get the ID of the iterator_base object.
Definition: SouffleInterface.h:80