| souffle
    2.0.2-371-g6315b36
    | 
 
 
 
Go to the documentation of this file.
   38 #ifndef __EMBEDDED_SOUFFLE__ 
   73 template <
class RelType>
 
   78     using AttrStrSeq = std::array<const char*, Arity>;
 
   91         typename RelType::iterator 
it;
 
  115             return it == casted.it;
 
  128     iterator 
end()
 const override {
 
  129         return iterator(mk<iterator_wrapper>(
id, 
this, 
relation.end()));
 
  135         assert(arg.
size() == 
Arity && 
"wrong tuple arity");
 
  136         for (
size_t i = 0; 
i < 
Arity; 
i++) {
 
  141     bool contains(
const tuple& arg)
 const override {
 
  143         assert(arg.size() == 
Arity && 
"wrong tuple arity");
 
  144         for (
size_t i = 0; 
i < 
Arity; 
i++) {
 
  149     std::size_t 
size()
 const override {
 
  152     std::string 
getName()
 const override {
 
  156         assert(arg < 
Arity && 
"attribute out of bound");
 
  159     const char* 
getAttrName(
size_t arg)
 const override {
 
  160         assert(arg < 
Arity && 
"attribute out of bound");
 
  174     void purge()
 override {
 
  182     std::atomic<bool> 
data{
false};
 
  210             return other.value == 
value;
 
  214             return other.value != 
value;
 
  227     iterator 
end()
 const {
 
  263 template <Relation::arity_type Arity_>
 
  274     class iterator : 
public std::iterator<std::forward_iterator_tag, Tuple<RamDomain, Arity>> {
 
  275         typename std::vector<Tuple<RamDomain, Arity>>::const_iterator 
it;
 
  278         iterator(
const typename std::vector<t_tuple>::const_iterator& 
o) : 
it(
o) {}
 
  285             return other.it == 
it;
 
  289             return !(*
this == other);
 
  297     iterator 
begin()
 const {
 
  317             t.data[
i] = ramDomain[
i];
 
  323         for (
const auto& 
o : 
data) {
 
  333     std::size_t 
size()
 const {
 
  337         return data.size() == 0;
 
  345     std::vector<Tuple<RamDomain, Arity>> 
data;
 
  
std::array< const char *, Arity > AttrStrSeq
Wrapper class for abstract iterator.
virtual SouffleProgram * newInstance()=0
Create new instance (abstract).
iterator end() const override
Return an iterator pointing to next to the last tuple of the relation.
static constexpr Relation::arity_type Arity
SymbolTable & getSymbolTable() const override
Get the symbol table of a relation.
bool equal(const iterator_base &o) const override
A functor representing the identity function for a generic type T.
iterator_wrapper(uint32_t arg_id, const Relation *rel, typename RelType::iterator arg_it)
const t_tuple operator*()
std::forward_iterator_tag iterator_category
A small utility class for implementing simple locks.
Tuple< RamDomain, 0 > t_tuple
bool operator==(const iterator &other) const
void operator++() override
void insert(const t_tuple &)
void insert(const t_tuple &, context &)
static constexpr arity_type Arity
Object-oriented wrapper class for Souffle's templatized relations.
iterator(const typename std::vector< t_tuple >::const_iterator &o)
Abstract base class for generated Datalog programs.
std::string getName() const override
Get the name of a relation.
const Relation & getRelation() const
Get the reference to the relation to which the tuple belongs.
iterator_base * clone() const override
void purge() override
Eliminate all the tuples in relation.
bool contains(const tuple &arg) const override
Check whether a tuple exists in a relation.
arity_type getArity() const override
Return the arity of a relation.
Tuple< RamDomain, Arity > t_tuple
tuple & operator*() override
iterator begin() const override
Return an iterator pointing to the first tuple of the relation.
const RamDomain * operator*()
ptrdiff_t difference_type
const arity_type numAuxAttribs
bool contains(const t_tuple &) const
void printStatistics(std::ostream &) const
const Relation * relation
bool operator==(const iterator &other) const
Relation wrapper used internally in the generated Datalog program.
const char * getAttrName(size_t arg) const override
Get the attribute name of a relation at the column specified by the parameter.
Tuple< RamDomain, Arity > TupleType
RelationWrapper(uint32_t id, RelType &r, SouffleProgram &p, std::string name, const AttrStrSeq &t, const AttrStrSeq &n, arity_type numAuxAttribs)
Relation::arity_type size() const
Return the number of elements in the tuple.
void printStatistics(std::ostream &) const
std::vector< Tuple< RamDomain, Arity > >::const_iterator it
std::vector< Tuple< RamDomain, Arity > > data
const char * getAttrType(size_t arg) const override
Get the attribute type of a relation at the column specified by the parameter.
bool contains(const t_tuple &t) const
static constexpr Relation::arity_type Arity
void rewind()
Reset the index giving the "current element" of the tuple to zero.
std::size_t size() const override
Get the number of tuples in a relation.
void rel(size_t limit, bool showLimit=true)
void insert(const tuple &arg) override
Insert a new tuple into the relation.
Defines a tuple for the OO interface such that relations with varying columns can be accessed.
arity_type getAuxiliaryArity() const override
Return the number of auxiliary attributes.
bool operator!=(const iterator &other) const
void insert(const t_tuple &t)
bool operator!=(const iterator &other) const
virtual SymbolTable & getSymbolTable()=0
Get the symbol table of the program.
a horizontalBars(j=m=void 0===a.axisX.type?new c.AutoScaleAxis(c.Axis.units.x, b.normalized.series, o, c.extend({}, a.axisX,{highLow:d, referenceValue:0})):a.axisX.type.call(c, c.Axis.units.x, b.normalized.series, o, c.extend({}, a.axisX,{highLow:d, referenceValue:0})), l=n=void 0===a.axisY.type?new c.StepAxis(c.Axis.units.y, b.normalized.series, o,{ticks:k}):a.axisY.type.call(c, c.Axis.units.y, b.normalized.series, o, a.axisY)) var p
souffle::SouffleProgram * getInstance(const char *p)