souffle  2.0.2-371-g6315b36
Public Member Functions | Static Public Member Functions | Private Types | Private Attributes | Friends
souffle::interpreter::Order Class Reference

An order to be enforced for storing tuples within indexes. More...

#include <Index.h>

Collaboration diagram for souffle::interpreter::Order:
Collaboration graph

Public Member Functions

template<size_t Arity>
Tuple< RamDomain, Arity > decode (const Tuple< RamDomain, Arity > &entry) const
 Decode the tuple by order. More...
 
template<size_t Arity>
Tuple< RamDomain, Arity > encode (const Tuple< RamDomain, Arity > &entry) const
 Encode the tuple with order. More...
 
const AttributeOrdergetOrder () const
 
bool operator!= (const Order &other) const
 
bool operator== (const Order &other) const
 
Attribute operator[] (const size_t idx) const
 
 Order ()=default
 
 Order (AttributeOrder pos)
 
size_t size () const
 
bool valid () const
 Determines whether this order is a valid order. More...
 

Static Public Member Functions

static Order create (size_t arity)
 

Private Types

using Attribute = uint32_t
 
using AttributeOrder = std::vector< Attribute >
 

Private Attributes

AttributeOrder order
 

Friends

std::ostream & operator<< (std::ostream &out, const Order &order)
 

Detailed Description

An order to be enforced for storing tuples within indexes.

The order is defined by the sequence of component to be considered in sorting tuples.

Definition at line 48 of file Index.h.

Member Typedef Documentation

◆ Attribute

using souffle::interpreter::Order::Attribute = uint32_t
private

Definition at line 55 of file Index.h.

◆ AttributeOrder

Definition at line 56 of file Index.h.

Constructor & Destructor Documentation

◆ Order() [1/2]

souffle::interpreter::Order::Order ( )
default

◆ Order() [2/2]

souffle::interpreter::Order::Order ( AttributeOrder  pos)
inline

Definition at line 61 of file Index.h.

63  {

Member Function Documentation

◆ create()

static Order souffle::interpreter::Order::create ( size_t  arity)
inlinestatic

Definition at line 66 of file Index.h.

70  {
71  // Check that all indices are in range.
72  for (int i : order) {
73  if (i < 0 || i >= int(order.size())) {

References i, and order.

◆ decode()

template<size_t Arity>
Tuple<RamDomain, Arity> souffle::interpreter::Order::decode ( const Tuple< RamDomain, Arity > &  entry) const
inline

Decode the tuple by order.

Definition at line 116 of file Index.h.

116  {
117  return order == other.order;
118  }
119 
120  bool operator!=(const Order& other) const {
121  return !(*this == other);
122  }

References order.

◆ encode()

template<size_t Arity>
Tuple<RamDomain, Arity> souffle::interpreter::Order::encode ( const Tuple< RamDomain, Arity > &  entry) const
inline

Encode the tuple with order.

Definition at line 104 of file Index.h.

104  {
105  Tuple<RamDomain, Arity> res{};
106  for (size_t i = 0; i < Arity; ++i) {
107  res[order[i]] = entry[i];
108  }
109  return res;
110  }

References i, and order.

Referenced by souffle::interpreter::Index< 2, Eqrel >::size().

◆ getOrder()

const AttributeOrder& souffle::interpreter::Order::getOrder ( ) const
inline

Definition at line 124 of file Index.h.

124  {
125  return order[idx];
126  }

References order.

◆ operator!=()

bool souffle::interpreter::Order::operator!= ( const Order other) const
inline

Definition at line 132 of file Index.h.

138  {

◆ operator==()

bool souffle::interpreter::Order::operator== ( const Order other) const
inline

Definition at line 128 of file Index.h.

◆ operator[]()

Attribute souffle::interpreter::Order::operator[] ( const size_t  idx) const
inline

Definition at line 136 of file Index.h.

138  {

◆ size()

size_t souffle::interpreter::Order::size ( ) const
inline

Definition at line 75 of file Index.h.

78  {

◆ valid()

bool souffle::interpreter::Order::valid ( ) const
inline

Determines whether this order is a valid order.

Definition at line 82 of file Index.h.

92  {
93  Tuple<RamDomain, Arity> res{};
94  for (size_t i = 0; i < Arity; ++i) {
95  res[i] = entry[order[i]];
96  }
97  return res;
98  }

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  out,
const Order order 
)
friend

Definition at line 137 of file Index.h.

138  {
139  virtual ~ViewWrapper() = default;

Field Documentation

◆ order

AttributeOrder souffle::interpreter::Order::order
private

Definition at line 57 of file Index.h.

Referenced by create(), decode(), encode(), and getOrder().


The documentation for this class was generated from the following file:
souffle::interpreter::Order::operator!=
bool operator!=(const Order &other) const
Definition: Index.h:132
souffle::interpreter::Order::Order
Order()=default
i
size_t i
Definition: json11.h:663
souffle::interpreter::Order::order
AttributeOrder order
Definition: Index.h:57