souffle
2.0.2-371-g6315b36
|
Go to the documentation of this file.
42 struct RelationWrapper {
99 return !(*
this == other);
111 virtual size_t size()
const = 0;
113 virtual void purge() = 0;
115 const std::string&
getName()
const {
153 template <
size_t _Arity,
template <
size_t>
typename Structure>
156 static constexpr
size_t Arity = _Arity;
177 return static_cast<View*
>(view);
192 if (set.find(
i) == set.end()) {
197 indexes.push_back(mk<Index>(order));
209 void purge()
override {
225 size_t size()
const override {
230 return indexes[idx]->getOrder();
272 Iterator
end()
const override {
300 for (
const auto&
tuple : other.scan()) {
331 std::vector<souffle::range<iterator>>
partitionScan(
size_t partitionCount)
const {
346 const size_t& indexPos,
const Tuple&
low,
const Tuple&
high,
size_t partitionCount)
const {
347 return indexes[indexPos]->partitionRange(
low,
high, partitionCount);
virtual bool contains(const RamDomain *) const =0
Iterator begin() const override
Index * getIndex(size_t idx)
virtual Iterator end() const =0
bool equal(const RelationWrapper::iterator_base &other) const override
A utility class enabling representation of ranges by pairing two iterator instances marking lower and...
For EqrelIndex we do inheritence since EqrelIndex only diff with one extra function.
virtual iterator_base & operator++()=0
static View * castView(ViewWrapper *view)
Cast an abstract view into a view of Index::View type.
void __purge()
Clear all indexes.
Relation(size_t auxiliaryArity, std::string name, const ram::analysis::MinIndexSelection &orderSet)
Creates a relation, build all necessary indexes.
souffle::range< iterator > range(const size_t &indexPos, const Tuple &low, const Tuple &high) const
Obtains a pair of iterators covering the interval between the two given entries.
bool empty() const
Tests whether this index is empty or not.
Own< RelationWrapper > createEqrelRelation(const ram::Relation &id, const ram::analysis::MinIndexSelection &orderSet)
iterator_base & operator++() override
static Tuple constructTuple(const RamDomain *data)
Construct a typed tuple from a raw data.
Own< RelationWrapper > createBTreeRelation(const ram::Relation &id, const ram::analysis::MinIndexSelection &orderSet)
void swap(Relation< Arity, Structure > &other)
Swaps the content of this and the given relation, including the installed indexes.
Own< iterator_base > iter
size_t size() const override
bool contains(const Tuple &tuple) const
Tests whether the given tuple is present in this index or not.
souffle::range< iterator > scan() const
Obtains a pair of iterators to scan the entire relation.
void extend(const EqrelRelation &rel)
std::vector< souffle::range< iterator > > partitionRange(const size_t &indexPos, const Tuple &low, const Tuple &high, size_t partitionCount) const
Returns a partitioned list of iterators coving elements in range [low, high].
bool operator==(const Iterator &other) const
const std::string & getName() const
Iterator end() const override
Iterator(const Iterator &other)
typename Index::iterator iterator
Own< RelationWrapper > createProvenanceRelation(const ram::Relation &id, const ram::analysis::MinIndexSelection &orderSet)
A virtualized iterator class that can be used by the Proginterface.
size_t __size() const
Return number of tuples in relation (full-order)
bool operator!=(const Iterator &other) const
std::unordered_set< AttributeIndex > AttributeSet
const RamDomain * operator*() override
virtual ~RelationWrapper()=default
An order to be enforced for storing tuples within indexes.
A dummy wrapper for indexViews.
virtual const RamDomain * operator*()=0
souffle::range< iterator > scan() const
Returns a pair of iterators covering the entire index content.
An index is an abstraction of a data structure.
Object-oriented wrapper class for Souffle's templatized relations.
std::set< Attribute > AttributeSet
IndexViewPtr createView(const size_t &indexPos) const override
Obtains a view on an index of this relation, facilitating hint-supported accesses.
Order getIndexOrder(size_t idx) const override
Return the order of an index.
void insert(const RamDomain *data) override
std::vector< souffle::range< iterator > > partitionScan(size_t partitionCount) const
Returns a partitioned list of iterators for parallel computation.
typename Index::View View
An abstract class for performing indexed operations.
iterator_base(typename Index::iterator iter, Order order)
virtual bool equal(const iterator_base &other) const =0
virtual Iterator begin() const =0
Own< RelationWrapper >(*)(const ram::Relation &id, const ram::analysis::MinIndexSelection &orderSet) RelationFactory
virtual iterator_base * clone() const =0
arity_type getAuxiliaryArity() const
bool insert(const Tuple &tuple)
Inserts a tuple into this index.
typename Data::iterator iterator
arity_type getArity() const
void extend(EqrelIndex *otherIndex)
Extend another index.
size_t size() const
Obtains the number of elements stored in this index.
souffle::Tuple< RamDomain, Arity > Tuple
virtual ~iterator_base()=default
Order getOrder() const
Obtains the lex order of this index.
virtual Order getIndexOrder(size_t) const =0
Return the order of an index.
virtual IndexViewPtr createView(const size_t &) const =0
Obtains a view on an index of this relation, facilitating hint-supported accesses.
iterator_base * clone() const override
A view on a relation caching local access patterns (not thread safe!).
std::vector< souffle::range< iterator > > partitionScan(int partitionCount) const
Retruns a partitioned list of iterators for parallel computation.
RelationWrapper(arity_type arity, arity_type auxiliaryArity, std::string relName)
A relation, composed of a collection of indexes.
Own< RelationWrapper > createBrieRelation(const ram::Relation &id, const ram::analysis::MinIndexSelection &)
Own< ViewWrapper > IndexViewPtr
souffle::Relation::arity_type arity_type
constexpr auto data(C &c) -> decltype(c.data())
const OrderCollection getAllOrders() const
@Brief Get all indexes
Wrapper for InterpreterRelation.
bool empty() const
Check if the relation is empty.
void rel(size_t limit, bool showLimit=true)
bool contains(const RamDomain *data) const override
arity_type auxiliaryArity
virtual size_t size() const =0
Defines a tuple for the OO interface such that relations with varying columns can be accessed.
const RamDomain * operator*()
std::vector< Own< A > > VecOwn
static constexpr size_t Arity
decltype(array) ::iterator begin()
Iterator for direct access to tuple's data.
virtual void insert(const RamDomain *)=0
bool exists(const Tuple &tuple) const
Check if a tuple exists in relation.