souffle
2.0.2-371-g6315b36
|
Object-oriented wrapper class for Souffle's templatized relations. More...
#include <SouffleInterface.h>
Data Structures | |
class | iterator |
Wrapper class for abstract iterator. More... | |
class | iterator_base |
Abstract iterator class. More... | |
Public Types | |
using | arity_type = uint32_t |
Public Member Functions | |
virtual iterator | begin () const =0 |
Return an iterator pointing to the first tuple of the relation. More... | |
virtual bool | contains (const tuple &t) const =0 |
Check whether a tuple exists in a relation. More... | |
virtual iterator | end () const =0 |
Return an iterator pointing to next to the last tuple of the relation. More... | |
virtual arity_type | getArity () const =0 |
Return the arity of a relation. More... | |
virtual const char * | getAttrName (size_t) const =0 |
Get the attribute name of a relation at the column specified by the parameter. More... | |
virtual const char * | getAttrType (size_t) const =0 |
Get the attribute type of a relation at the column specified by the parameter. More... | |
virtual arity_type | getAuxiliaryArity () const =0 |
Return the number of auxiliary attributes. More... | |
virtual std::string | getName () const =0 |
Get the name of a relation. More... | |
arity_type | getPrimaryArity () const |
Return the number of non-auxiliary attributes. More... | |
std::string | getSignature () |
Get the signature of a relation. More... | |
virtual SymbolTable & | getSymbolTable () const =0 |
Get the symbol table of a relation. More... | |
virtual void | insert (const tuple &t)=0 |
Insert a new tuple into the relation. More... | |
virtual void | purge ()=0 |
Delete all the tuples in relation. More... | |
virtual std::size_t | size () const =0 |
Get the number of tuples in a relation. More... | |
virtual | ~Relation ()=default |
Destructor. More... | |
Object-oriented wrapper class for Souffle's templatized relations.
Definition at line 49 of file SouffleInterface.h.
using souffle::Relation::arity_type = uint32_t |
Definition at line 51 of file SouffleInterface.h.
|
virtualdefault |
Destructor.
|
pure virtual |
Return an iterator pointing to the first tuple of the relation.
This iterator is used to access the tuples of the relation.
Implemented in souffle::RelationWrapper< RelType >, and souffle::interpreter::RelInterface.
|
pure virtual |
Check whether a tuple exists in a relation.
The definition of contains has to be defined by the child class of relation class.
t | Reference to a tuple object |
Implemented in souffle::interpreter::RelInterface, and souffle::RelationWrapper< RelType >.
|
pure virtual |
Return an iterator pointing to next to the last tuple of the relation.
Implemented in souffle::RelationWrapper< RelType >, and souffle::interpreter::RelInterface.
|
pure virtual |
Return the arity of a relation.
For example for a tuple (1 2) the arity is 2 and for a tuple (1 2 3) the arity is 3.
arity_type
) Implemented in souffle::RelationWrapper< RelType >, and souffle::interpreter::RelInterface.
Referenced by souffle::tuple::begin(), getPrimaryArity(), and souffle::Relation::iterator::operator!=().
|
pure virtual |
Get the attribute name of a relation at the column specified by the parameter.
The attribute name is the name given to the type by the user in the .decl statement. For example, for ".decl edge (node1:Node, node2:Node)", the attribute names are node1 and node2.
The | index of the column starting starting from 0 (size_t) |
Implemented in souffle::interpreter::RelInterface, and souffle::RelationWrapper< RelType >.
|
pure virtual |
Get the attribute type of a relation at the column specified by the parameter.
The attribute type is in the form "<primitive type>:<type name>". <primitive type> can be s, f, u, or i standing for symbol, float, unsigned, and integer respectively, which are the primitive types in Souffle. <type name> is the name given by the user in the Souffle program
The | index of the column starting starting from 0 (size_t) |
Implemented in souffle::interpreter::RelInterface, and souffle::RelationWrapper< RelType >.
Referenced by getPrimaryArity(), souffle::tuple::operator<<(), souffle::tuple::operator>>(), and souffle::tuple::rewind().
|
pure virtual |
Return the number of auxiliary attributes.
Auxiliary attributes are used for provenance and and other alternative evaluation strategies. They are stored as the last attributes of a tuple.
arity_type
) Implemented in souffle::RelationWrapper< RelType >, and souffle::interpreter::RelInterface.
Referenced by souffle::Relation::iterator::operator!=().
|
pure virtual |
Get the name of a relation.
Implemented in souffle::RelationWrapper< RelType >, and souffle::interpreter::RelInterface.
Referenced by souffle::SouffleProgram::getRelationSize().
|
inline |
Return the number of non-auxiliary attributes.
Auxiliary attributes are used for provenance and and other alternative evaluation strategies. They are stored as the last attributes of a tuple.
arity_type
) Definition at line 381 of file SouffleInterface.h.
References getArity(), and getAttrType().
|
inline |
Get the signature of a relation.
The signature is in the form <<primitive type 1>:<type name 1>,<primitive type 2>:<type name 2>...> for all the attributes in a relation. For example, <s:Node,s:Node>. The primitive type and type name are explained in getAttrType.
Definition at line 408 of file SouffleInterface.h.
|
pure virtual |
Get the symbol table of a relation.
The symbols in a tuple to be stored into a relation are stored and assigned with a number in a table called symbol table. For example, to insert ("John","Student") to a relation, "John" and "Student" are stored in symbol table and they are assigned with number say 0 and 1. After this, instead of inserting ("John","Student"), (0, 1) is inserted. When accessing this tuple, 0 and 1 will be looked up in the table and replaced by "John" and "Student". This is done so to save memory space if same symbols are inserted many times. Symbol table has many rows where each row contains a symbol and its corresponding assigned number.
Implemented in souffle::RelationWrapper< RelType >, and souffle::interpreter::RelInterface.
Referenced by souffle::tuple::operator<<(), and souffle::tuple::rewind().
|
pure virtual |
Insert a new tuple into the relation.
The definition of insert function has to be defined by the child class of relation class.
t | Reference to a tuple class object |
Implemented in souffle::interpreter::RelInterface, and souffle::RelationWrapper< RelType >.
|
pure virtual |
Delete all the tuples in relation.
When purge() is called, it sets the head and tail of the table (table is a singly-linked list structure) to nullptr, and for every elements in the table, set the next element pointer points to the current element itself.
Implemented in souffle::RelationWrapper< RelType >, and souffle::interpreter::RelInterface.
|
pure virtual |
Get the number of tuples in a relation.
Implemented in souffle::RelationWrapper< RelType >, and souffle::interpreter::RelInterface.