souffle
2.0.2-371-g6315b36
|
Abstract base class for generated Datalog programs. More...
#include <SouffleInterface.h>
Data Structures | |
struct | tuple_insert |
Helper function for the wrapper function Relation::insert() and Relation::contains(). More... | |
struct | tuple_insert< Tuple, 1 > |
Helper function for the wrapper function Relation::insert() and Relation::contains() for the first element of the tuple. More... | |
Public Member Functions | |
template<typename... Args> | |
bool | contains (const std::tuple< Args... > &t, Relation *relation) |
Contains function with std::tuple as input (wrapper) More... | |
virtual void | dumpInputs ()=0 |
Output all the input relations in stdout, without generating any files. More... | |
virtual void | dumpOutputs ()=0 |
Output all the output relations in stdout, without generating any files. More... | |
virtual void | executeSubroutine (std::string, const std::vector< RamDomain > &, std::vector< RamDomain > &) |
Execute a subroutine. More... | |
std::vector< Relation * > | getAllRelations () const |
Getter of allRelations, which this vector structure contains all relations. More... | |
std::vector< Relation * > | getInputRelations () const |
Getter of inputRelations, which this vector structure contains all input relations. More... | |
std::vector< Relation * > | getInternalRelations () const |
Getter of internalRelations, which this vector structure contains all relations that are neither an input relation or an output relation. More... | |
std::size_t | getNumThreads () |
Get the number of threads to be used. More... | |
std::vector< Relation * > | getOutputRelations () const |
Getter of outputRelations, which this vector structure contains all output relations. More... | |
virtual RecordTable & | getRecordTable ()=0 |
Get the record table of the program. More... | |
Relation * | getRelation (const std::string &name) const |
Get Relation by its name from relationMap, if relation not found, return a nullptr. More... | |
std::string | getRelationName (const std::string &name) const |
Return the name of the target relation from relationMap. More... | |
std::size_t | getRelationSize (const std::string &name) const |
Return the size of the target relation from relationMap. More... | |
virtual SymbolTable & | getSymbolTable ()=0 |
Get the symbol table of the program. More... | |
template<typename... Args> | |
void | insert (const std::tuple< Args... > &t, Relation *relation) |
Insert function with std::tuple as input (wrapper) More... | |
virtual void | loadAll (std::string inputDirectory="")=0 |
Read all input relations. More... | |
virtual void | printAll (std::string outputDirectory="")=0 |
Store all output relations. More... | |
void | purgeInputRelations () |
Remove all the tuples from the inputRelations, calling the purge method of each. More... | |
void | purgeInternalRelations () |
Remove all the tuples from the internalRelations, calling the purge method of each. More... | |
void | purgeOutputRelations () |
Remove all the tuples from the outputRelations, calling the purge method of each. More... | |
virtual void | run () |
Execute the souffle program, without any loads or stores. More... | |
virtual void | runAll (std::string inputDirectory="", std::string outputDirectory="")=0 |
Execute program, loading inputs and storing outputs as required. More... | |
void | setNumThreads (std::size_t numThreadsValue) |
Set the number of threads to be used. More... | |
virtual | ~SouffleProgram ()=default |
Destructor. More... | |
Protected Member Functions | |
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 relation, if the relation is an input relation, it will be added to inputRelations, else if the relation is an output relation, it will be added to outputRelations, otherwise will add to internalRelations. More... | |
void | addRelation (const std::string &name, Relation *rel, bool isInput, bool isOutput) |
Private Attributes | |
std::vector< Relation * > | allRelations |
allRelations store all the relation in a vector. More... | |
std::vector< Relation * > | inputRelations |
inputRelations stores all the input relation in a vector. More... | |
std::vector< Relation * > | internalRelations |
internalRelation stores all the relation in a vector that are neither an input or an output. More... | |
std::size_t | numThreads = 1 |
The number of threads used by OpenMP. More... | |
std::vector< Relation * > | outputRelations |
outputRelations stores all the output relation in a vector. More... | |
std::map< std::string, Relation * > | relationMap |
Define a relation map for external access, when getRelation(name) is called, the relation with the given name will be returned from this map, relationMap stores all the relations in a map with its name as the key and relation as the value. More... | |
Abstract base class for generated Datalog programs.
Definition at line 693 of file SouffleInterface.h.
|
virtualdefault |
Destructor.
Destructor of SouffleProgram.
|
inlineprotected |
Add the relation to relationMap (with its name) and allRelations, depends on the properties of the relation, if the relation is an input relation, it will be added to inputRelations, else if the relation is an output relation, it will be added to outputRelations, otherwise will add to internalRelations.
(a relation could be both input and output at the same time.)
name | the name of the relation (std::string) |
rel | a reference to the relation |
isInput | a bool argument, true if the relation is a input relation, else false (bool) |
isOnput | a bool argument, true if the relation is a ouput relation, else false (bool) |
Definition at line 739 of file SouffleInterface.h.
References outputRelations, and rel().
|
inlineprotected |
Definition at line 753 of file SouffleInterface.h.
|
inline |
Contains function with std::tuple as input (wrapper)
t | The existence searching tuple (std::tuple) |
relation | The relation that perform contains operation (Relation*) |
Definition at line 996 of file SouffleInterface.h.
|
pure virtual |
Output all the input relations in stdout, without generating any files.
(for debug purposes).
Implemented in souffle::interpreter::ProgInterface.
Referenced by SWIGSouffleProgram::printAll().
|
pure virtual |
Output all the output relations in stdout, without generating any files.
(for debug purposes).
Implemented in souffle::interpreter::ProgInterface.
Referenced by SWIGSouffleProgram::dumpInputs().
|
inlinevirtual |
Execute a subroutine.
name | Name of a subroutine (std:string) |
arg | Arguments of the subroutine (std::vector<RamDomain>&) |
ret | Return values of the subroutine (std::vector<RamDomain>&) |
Reimplemented in souffle::interpreter::ProgInterface.
Definition at line 903 of file SouffleInterface.h.
References outputRelations, and relation.
|
inline |
Getter of allRelations, which this vector structure contains all relations.
Definition at line 893 of file SouffleInterface.h.
References souffle::fatal().
|
inline |
Getter of inputRelations, which this vector structure contains all input relations.
Definition at line 872 of file SouffleInterface.h.
References internalRelations.
|
inline |
Getter of internalRelations, which this vector structure contains all relations that are neither an input relation or an output relation.
Definition at line 883 of file SouffleInterface.h.
References allRelations.
|
inline |
Get the number of threads to be used.
Definition at line 817 of file SouffleInterface.h.
References relationMap.
|
inline |
Getter of outputRelations, which this vector structure contains all output relations.
Definition at line 862 of file SouffleInterface.h.
References inputRelations.
|
pure virtual |
Get the record table of the program.
Implemented in souffle::interpreter::ProgInterface.
|
inline |
Get Relation by its name from relationMap, if relation not found, return a nullptr.
name | The name of the target relation (const std::string) |
Definition at line 827 of file SouffleInterface.h.
Referenced by getRelationSize().
|
inline |
Return the name of the target relation from relationMap.
name | The name of the target relation (const std::string) |
Definition at line 852 of file SouffleInterface.h.
References outputRelations.
|
inline |
Return the size of the target relation from relationMap.
name | The name of the target relation (const std::string) |
Definition at line 842 of file SouffleInterface.h.
References souffle::Relation::getName(), and getRelation().
|
pure virtual |
Get the symbol table of the program.
Implemented in souffle::interpreter::ProgInterface.
Referenced by souffle::RelationWrapper< RelType >::getArity().
|
inline |
Insert function with std::tuple as input (wrapper)
t | The insert tuple (std::tuple) |
relation | The relation that perform insert operation (Relation*) |
Definition at line 981 of file SouffleInterface.h.
References relation.
|
pure virtual |
Read all input relations.
File IO types can use the given directory to find their input file.
inputDirectory | If non-empty, specifies the input directory |
Implemented in souffle::interpreter::ProgInterface.
Referenced by SWIGSouffleProgram::runAll().
|
pure virtual |
Store all output relations.
File IO types can use the given directory to find their input file.
outputDirectory | If non-empty, specifies the output directory |
Implemented in souffle::interpreter::ProgInterface.
Referenced by SWIGSouffleProgram::loadAll().
|
inline |
Remove all the tuples from the inputRelations, calling the purge method of each.
Definition at line 934 of file SouffleInterface.h.
References internalRelations, and relation.
|
inline |
Remove all the tuples from the internalRelations, calling the purge method of each.
Definition at line 945 of file SouffleInterface.h.
References souffle::SouffleProgram::tuple_insert< Tuple, N >::add(), and TCB_SPAN_NAMESPACE_NAME::get().
|
inline |
Remove all the tuples from the outputRelations, calling the purge method of each.
Definition at line 923 of file SouffleInterface.h.
References inputRelations, and relation.
|
inlinevirtual |
Execute the souffle program, without any loads or stores.
Reimplemented in souffle::interpreter::ProgInterface.
Definition at line 770 of file SouffleInterface.h.
Referenced by SWIGSouffleProgram::~SWIGSouffleProgram().
|
pure virtual |
Execute program, loading inputs and storing outputs as required.
File IO types can use the given directories to find their input file.
inputDirectory | If non-empty, specifies the input directory |
outputDirectory | If non-empty, specifies the output directory |
Implemented in souffle::interpreter::ProgInterface.
Referenced by SWIGSouffleProgram::run().
|
inline |
Set the number of threads to be used.
Definition at line 810 of file SouffleInterface.h.
References numThreads.
|
private |
allRelations store all the relation in a vector.
Definition at line 721 of file SouffleInterface.h.
Referenced by getInternalRelations().
|
private |
inputRelations stores all the input relation in a vector.
Definition at line 706 of file SouffleInterface.h.
Referenced by getOutputRelations(), and purgeOutputRelations().
|
private |
internalRelation stores all the relation in a vector that are neither an input or an output.
Definition at line 716 of file SouffleInterface.h.
Referenced by getInputRelations(), and purgeInputRelations().
|
private |
The number of threads used by OpenMP.
Definition at line 725 of file SouffleInterface.h.
Referenced by setNumThreads().
|
private |
outputRelations stores all the output relation in a vector.
Definition at line 711 of file SouffleInterface.h.
Referenced by addRelation(), executeSubroutine(), and getRelationName().
|
private |
Define a relation map for external access, when getRelation(name) is called, the relation with the given name will be returned from this map, relationMap stores all the relations in a map with its name as the key and relation as the value.
Definition at line 701 of file SouffleInterface.h.
Referenced by getNumThreads().