souffle  2.0.2-371-g6315b36
Public Member Functions | Protected Member Functions | Protected Attributes
souffle::ram::AbstractAggregate Class Reference

Abstract class for aggregation. More...

#include <AbstractAggregate.h>

Inheritance diagram for souffle::ram::AbstractAggregate:
Inheritance graph
Collaboration diagram for souffle::ram::AbstractAggregate:
Collaboration graph

Public Member Functions

 AbstractAggregate (AggregateOp fun, Own< Expression > expr, Own< Condition > cond)
 
std::vector< const Node * > getChildNodes () const
 
const ConditiongetCondition () const
 Get condition. More...
 
const ExpressiongetExpression () const
 Get target expression. More...
 
AggregateOp getFunction () const
 Get aggregation function. More...
 
virtual ~AbstractAggregate ()=default
 

Protected Member Functions

bool equal (const Node &node) const
 
void print (std::ostream &os, int) const
 

Protected Attributes

Own< Conditioncondition
 Aggregation tuple condition. More...
 
Own< Expressionexpression
 Aggregation expression. More...
 
const AggregateOp function
 Aggregation function. More...
 

Detailed Description

Abstract class for aggregation.

A particular function (e.g. MIN) is applied given a that a condition holds

Definition at line 42 of file AbstractAggregate.h.

Constructor & Destructor Documentation

◆ AbstractAggregate()

souffle::ram::AbstractAggregate::AbstractAggregate ( AggregateOp  fun,
Own< Expression expr,
Own< Condition cond 
)
inline

Definition at line 44 of file AbstractAggregate.h.

49  {

◆ ~AbstractAggregate()

virtual souffle::ram::AbstractAggregate::~AbstractAggregate ( )
virtualdefault

Member Function Documentation

◆ equal()

bool souffle::ram::AbstractAggregate::equal ( const Node node) const
inlineprotected

Definition at line 94 of file AbstractAggregate.h.

◆ getChildNodes()

std::vector<const Node*> souffle::ram::AbstractAggregate::getChildNodes ( ) const
inline

Definition at line 69 of file AbstractAggregate.h.

69  :
70  void print(std::ostream& os, int /* tabpos */) const {
71  switch (function) {

References souffle::FMIN, and souffle::MIN.

Referenced by souffle::ram::Aggregate::Aggregate(), and souffle::ram::IndexAggregate::IndexAggregate().

◆ getCondition()

const Condition& souffle::ram::AbstractAggregate::getCondition ( ) const
inline

Get condition.

Definition at line 53 of file AbstractAggregate.h.

55  {
56  return function;

Referenced by souffle::ram::ParallelAggregate::print().

◆ getExpression()

const Expression& souffle::ram::AbstractAggregate::getExpression ( ) const
inline

Get target expression.

Definition at line 64 of file AbstractAggregate.h.

65  {
66  return {expression.get(), condition.get()};
67  }

References condition, and expression.

◆ getFunction()

AggregateOp souffle::ram::AbstractAggregate::getFunction ( ) const
inline

Get aggregation function.

Definition at line 59 of file AbstractAggregate.h.

60  {
61  assert(expression != nullptr && "Expression of aggregate is a null-pointer");

References expression.

◆ print()

void souffle::ram::AbstractAggregate::print ( std::ostream &  os,
int   
) const
inlineprotected

Definition at line 74 of file AbstractAggregate.h.

74  : os << "min "; break;
75  case AggregateOp::MAX:
76  case AggregateOp::UMAX:
77  case AggregateOp::FMAX: os << "max "; break;
78  case AggregateOp::SUM:
79  case AggregateOp::FSUM:
80  case AggregateOp::USUM: os << "sum "; break;
81  case AggregateOp::COUNT: os << "count "; break;
82  case AggregateOp::MEAN: os << "mean "; break;
83  }
84  if (function != AggregateOp::COUNT) {
85  os << *expression << " ";
86  }
87  }
88 
89 protected:
90  bool equal(const Node& node) const {
91  const auto& other = dynamic_cast<const AbstractAggregate&>(node);

Referenced by souffle::ram::ParallelAggregate::clone().

Field Documentation

◆ condition

Own<Condition> souffle::ram::AbstractAggregate::condition
protected

Aggregation tuple condition.

Definition at line 107 of file AbstractAggregate.h.

Referenced by souffle::ram::Aggregate::clone(), getExpression(), and souffle::ram::ParallelAggregate::ParallelAggregate().

◆ expression

Own<Expression> souffle::ram::AbstractAggregate::expression
protected

◆ function

const AggregateOp souffle::ram::AbstractAggregate::function
protected

Aggregation function.

Definition at line 101 of file AbstractAggregate.h.


The documentation for this class was generated from the following file:
souffle::AggregateOp::USUM
@ USUM
souffle::ram::AbstractAggregate::equal
bool equal(const Node &node) const
Definition: AbstractAggregate.h:94
souffle::AggregateOp::FSUM
@ FSUM
souffle::ram::AbstractAggregate::print
void print(std::ostream &os, int) const
Definition: AbstractAggregate.h:74
souffle::AggregateOp::MAX
@ MAX
souffle::ram::AbstractAggregate::expression
Own< Expression > expression
Aggregation expression.
Definition: AbstractAggregate.h:104
souffle::AggregateOp::UMAX
@ UMAX
souffle::AggregateOp::FMAX
@ FMAX
souffle::AggregateOp::COUNT
@ COUNT
souffle::AggregateOp::SUM
@ SUM
souffle::AggregateOp::MEAN
@ MEAN
souffle::ram::AbstractAggregate::condition
Own< Condition > condition
Aggregation tuple condition.
Definition: AbstractAggregate.h:107
souffle::ram::AbstractAggregate::AbstractAggregate
AbstractAggregate(AggregateOp fun, Own< Expression > expr, Own< Condition > cond)
Definition: AbstractAggregate.h:44