souffle  2.0.2-371-g6315b36
Public Member Functions | Private Member Functions | Private Attributes
souffle::interpreter::NodeGenerator::OrderingContext Class Reference

This class help generator reordering tuple access based on the index oder. More...

Collaboration diagram for souffle::interpreter::NodeGenerator::OrderingContext:
Collaboration graph

Public Member Functions

void addNewTuple (size_t tupleId, size_t arity)
 Bind tuple with a natural full order. More...
 
template<class RamNode >
void addTupleWithDefaultOrder (size_t tupleId, const RamNode &node)
 Bind tuple with the default order. More...
 
template<class RamNode >
void addTupleWithIndexOrder (size_t tupleId, const RamNode &node)
 Bind tuple with the corresponding index order. More...
 
size_t mapOrder (size_t tupleId, size_t elementId) const
 Map the decoded order of elementId based on current context. More...
 
 OrderingContext (NodeGenerator &generator)
 

Private Member Functions

void insertOrder (size_t tupleId, const Order &order)
 

Private Attributes

NodeGeneratorgenerator
 
std::vector< OrdertupleOrders
 

Detailed Description

This class help generator reordering tuple access based on the index oder.

Definition at line 242 of file Generator.h.

Constructor & Destructor Documentation

◆ OrderingContext()

souffle::interpreter::NodeGenerator::OrderingContext::OrderingContext ( NodeGenerator generator)

Definition at line 711 of file Generator.cpp.

Member Function Documentation

◆ addNewTuple()

void souffle::interpreter::NodeGenerator::OrderingContext::addNewTuple ( size_t  tupleId,
size_t  arity 
)

Bind tuple with a natural full order.

This is usually used when an operation implicitly introduce a runtime tuple, such as UnpackRecord NestedIntrinsicOperator, and nested operation in Aggregate.

Definition at line 713 of file Generator.cpp.

717  {
718  auto interpreterRel = generator.encodeRelation(node.getRelation());
719  insertOrder(tupleId, (*generator.getRelationHandle(interpreterRel))->getIndexOrder(0));

◆ addTupleWithDefaultOrder()

template<class RamNode >
void souffle::interpreter::NodeGenerator::OrderingContext::addTupleWithDefaultOrder ( size_t  tupleId,
const RamNode &  node 
)

Bind tuple with the default order.

This is usually used for tuples created by non-indexed operations. Such as Scan, Aggregate, Choice.

Definition at line 722 of file Generator.cpp.

723  {
724  auto interpreterRel = generator.encodeRelation(node.getRelation());
725  auto indexId = generator.encodeIndexPos(node);

◆ addTupleWithIndexOrder()

template<class RamNode >
void souffle::interpreter::NodeGenerator::OrderingContext::addTupleWithIndexOrder ( size_t  tupleId,
const RamNode &  node 
)

Bind tuple with the corresponding index order.

This is usually used for tuples created by indexed operations. Such as IndexScan, IndexAggregate, IndexChoice.

Definition at line 728 of file Generator.cpp.

730  {
731  return tupleOrders[tupleId][elementId];
732 }
733 

◆ insertOrder()

void souffle::interpreter::NodeGenerator::OrderingContext::insertOrder ( size_t  tupleId,
const Order order 
)
private

Definition at line 739 of file Generator.cpp.

740  {
741  decodeOrder[order[i]] = i;
742  }
743 
744  tupleOrders[tupleId] = std::move(decodeOrder);
745 }
746 }; // namespace souffle::interpreter

◆ mapOrder()

size_t souffle::interpreter::NodeGenerator::OrderingContext::mapOrder ( size_t  tupleId,
size_t  elementId 
) const

Map the decoded order of elementId based on current context.

Definition at line 735 of file Generator.cpp.

735  {
736  tupleOrders.resize(tupleId + 1);
737  }

Field Documentation

◆ generator

NodeGenerator& souffle::interpreter::NodeGenerator::OrderingContext::generator
private

Definition at line 274 of file Generator.h.

◆ tupleOrders

std::vector<Order> souffle::interpreter::NodeGenerator::OrderingContext::tupleOrders
private

Definition at line 273 of file Generator.h.


The documentation for this class was generated from the following files:
souffle::interpreter::NodeGenerator::getRelationHandle
RelationHandle * getRelationHandle(const size_t idx)
Definition: Generator.cpp:542
souffle::interpreter::NodeGenerator::OrderingContext::tupleOrders
std::vector< Order > tupleOrders
Definition: Generator.h:273
souffle::interpreter::NodeGenerator::OrderingContext::generator
NodeGenerator & generator
Definition: Generator.h:274
i
size_t i
Definition: json11.h:663
souffle::interpreter::NodeGenerator::OrderingContext::insertOrder
void insertOrder(size_t tupleId, const Order &order)
Definition: Generator.cpp:739
souffle::interpreter::NodeGenerator::encodeRelation
size_t encodeRelation(const std::string &relName)
Encode and create the relation, return the relation id.
Definition: Generator.cpp:531
souffle::interpreter::NodeGenerator::encodeIndexPos
size_t encodeIndexPos(RamNode &node)
Return operation index id from the result of indexAnalysis.
Definition: Generator.cpp:497