souffle
2.0.2-371-g6315b36
|
Go to the documentation of this file.
49 RelInterface(RelationWrapper& r, SymbolTable& s, std::string
n, std::vector<std::string> t,
50 std::vector<std::string> an, uint32_t
i)
66 iterator
begin()
const override {
71 iterator
end()
const override {
76 std::string
getName()
const override {
96 const char*
getAttrType(
size_t idx)
const override {
97 assert(idx <
getArity() &&
"exceeded tuple size");
102 const char*
getAttrName(
size_t idx)
const override {
113 void purge()
override {
146 tup << ramBitCast<RamFloat>((*
it)[
i]);
150 tup << ramBitCast<RamUnsigned>((*
it)[
i]);
172 auto& iter =
dynamic_cast<const RelInterface::iterator_base&
>(
o);
174 }
catch (
const std::bad_cast&
e) {
196 std::vector<std::string>
types;
216 std::map<std::string, const ram::Relation*>
map;
221 if (relHandler ==
nullptr) {
225 auto& interpreterRel = **relHandler;
226 auto& name = interpreterRel.getName();
231 std::vector<std::string>
types =
rel.getAttributeTypes();
232 std::vector<std::string> attrNames =
rel.getAttributeNames();
234 auto*
interface = new RelInterface(interpreterRel,
symTable,
rel.getName(),
types, attrNames,
id);
240 const std::string& op = io.get(
"operation");
243 }
else if (op ==
"output" || op ==
"printsize") {
246 assert(
"wrong i/o operation");
254 ~ProgInterface()
override {
255 for (
auto* interface : interfaces) {
261 void run()
override {}
264 void runAll(std::string, std::string)
override {}
267 void loadAll(std::string)
override {}
270 void printAll(std::string)
override {}
273 void dumpInputs()
override {}
276 void dumpOutputs()
override {}
279 void executeSubroutine(
280 std::string name,
const std::vector<RamDomain>& args, std::vector<RamDomain>& ret)
override {
281 exec.executeSubroutine(name, args, ret);
298 std::vector<RelInterface*> interfaces;
virtual bool contains(const RamDomain *) const =0
iterator_base * clone() const override
Clone iterator.
Wrapper class for abstract iterator.
~iterator_base() override=default
Destructor.
std::vector< std::string > attrNames
Attribute Names.
bool contains(const tuple &t) const override
Check whether tuple exists.
RAM program relation declaration and functions.
virtual Iterator end() const =0
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.
A functor representing the identity function for a generic type T.
iterator begin() const override
Iterator to first tuple.
std::vector< std::string > types
Attribute type.
std::string getName() const override
Get name.
std::vector< RelInterface * > interfaces
l j a showGridBackground &&c b raw series this eventEmitter e
const RelInterface * ramRelationInterface
arity_type getArity() const override
Get arity.
std::vector< Own< ast::Type > > types
auto map(const std::vector< A > &xs, F &&f)
Applies a function to each element of a vector and returns the results.
const std::string & getRelation() const
Get RAM relation.
ProgInterface(Engine &interp)
tuple & operator*() override
Get current tuple.
SymbolTable & getSymbolTable() const override
Get symbol table.
Object-oriented wrapper class for Souffle's templatized relations.
void operator++() override
Increment iterator.
Abstract base class for generated Datalog programs.
const RamDomain * data
Allows printing using WriteStream.
An abstract class for performing indexed operations.
const char * getAttrName(size_t idx) const override
Get attribute name.
const ram::Program & prog
RelationWrapper & relation
Wrapped interpreter relation.
virtual Iterator begin() const =0
This class translate the RAM Program into executable format and interpreter it.
VecOwn< RelationHandle > & getRelationMap()
Return the relation map.
I/O statement for a relation.
RecordTable & getRecordTable() override
Get the record table of the program.
void addRelation(const std::string &name, Relation &rel, bool isInput, bool isOutput)
Add the relation to relationMap (with its name) and allRelations, depends on the properties of the re...
arity_type getAuxiliaryArity() const
const char * getAttrType(size_t idx) const override
Get attribute type.
arity_type getArity() const
RecordTable & recordTable
void purge() override
Eliminate all the tuples in relation.
std::string name
Name of relation.
bool equal(const souffle::Relation::iterator_base &o) const override
Check equivalence.
Implementation of SouffleProgram interface for an interpreter instance.
SymbolTable & symTable
Symbol table.
Wrapper class for interpreter relations.
Wrapper for InterpreterRelation.
RelationWrapper::Iterator it
void visitDepthFirst(const Node &root, Visitor< R, Ps... > &visitor, Args &... args)
A utility function visiting all nodes within the ast rooted by the given node recursively in a depth-...
RelInterface(RelationWrapper &r, SymbolTable &s, std::string n, std::vector< std::string > t, std::vector< std::string > an, uint32_t i)
void rewind()
Reset the index giving the "current element" of the tuple to zero.
void insert(const tuple &t) override
Insert tuple.
SymbolTable & getSymbolTable() override
Get symbol table.
~RelInterface() override=default
void rel(size_t limit, bool showLimit=true)
virtual size_t size() const =0
arity_type getAuxiliaryArity() const override
Get arity.
Defines a tuple for the OO interface such that relations with varying columns can be accessed.
virtual uint32_t getId() const
Get the ID of the iterator_base object.
virtual void insert(const RamDomain *)=0
size_t size() const override
Get number of tuples in relation.
iterator end() const override
Iterator to last tuple.
iterator_base(uint32_t arg_id, const RelInterface *r, RelationWrapper::Iterator i)
uint32_t id
Unique id for wrapper.