souffle  2.0.2-371-g6315b36
Public Member Functions | Protected Member Functions
souffle::ram::transform::ReorderFilterBreak Class Reference

#include <ReorderFilterBreak.h>

Inheritance diagram for souffle::ram::transform::ReorderFilterBreak:
Inheritance graph
Collaboration diagram for souffle::ram::transform::ReorderFilterBreak:
Collaboration graph

Public Member Functions

std::string getName () const override
 @Brief get name of the transformer More...
 
bool reorderFilterBreak (Program &program)
 reorder filter-break nesting to break-filter nesting More...
 
- Public Member Functions inherited from souffle::ram::transform::Transformer
bool apply (TranslationUnit &translationUnit)
 @Brief apply the transformer to a translation unit @Param translationUnit that will be transformed. More...
 
virtual ~Transformer ()=default
 

Protected Member Functions

bool transform (TranslationUnit &translationUnit) override
 @Brief transform the translation unit / used by apply @Param translationUnit that will be transformed. More...
 

Detailed Description

Definition at line 53 of file ReorderFilterBreak.h.

Member Function Documentation

◆ getName()

std::string souffle::ram::transform::ReorderFilterBreak::getName ( ) const
inlineoverridevirtual

@Brief get name of the transformer

Implements souffle::ram::transform::Transformer.

Definition at line 55 of file ReorderFilterBreak.h.

62  :
63  bool transform(TranslationUnit& translationUnit) override {

◆ reorderFilterBreak()

bool souffle::ram::transform::ReorderFilterBreak::reorderFilterBreak ( Program program)

reorder filter-break nesting to break-filter nesting

Parameters
programProgram that is transform
Returns
Flag showing whether the program has been changed by the transformation

Definition at line 33 of file ReorderFilterBreak.cpp.

34  {
35  if (const Break* br = dynamic_cast<Break*>(&filter->getOperation())) {
36  changed = true;
37  // convert to break-filter nesting
38  node = mk<Break>(souffle::clone(&br->getCondition()),
39  mk<Filter>(souffle::clone(&filter->getCondition()),
40  souffle::clone(&br->getOperation())));
41  }
42  }
43  node->apply(makeLambdaRamMapper(filterRewriter));
44  return node;
45  };
46  const_cast<Query*>(&query)->apply(makeLambdaRamMapper(filterRewriter));
47  });
48  return changed;
49 }
50 
51 } // namespace souffle::ram::transform

References souffle::clone(), and souffle::filter().

Here is the call graph for this function:

◆ transform()

bool souffle::ram::transform::ReorderFilterBreak::transform ( TranslationUnit translationUnit)
inlineoverrideprotectedvirtual

@Brief transform the translation unit / used by apply @Param translationUnit that will be transformed.

@Return flag reporting whether the RAM program has changed

Implements souffle::ram::transform::Transformer.

Definition at line 67 of file ReorderFilterBreak.h.


The documentation for this class was generated from the following files:
souffle::ram::transform::Transformer::apply
bool apply(TranslationUnit &translationUnit)
@Brief apply the transformer to a translation unit @Param translationUnit that will be transformed.
Definition: Transformer.cpp:39
souffle::ram::transform::ReorderFilterBreak::transform
bool transform(TranslationUnit &translationUnit) override
@Brief transform the translation unit / used by apply @Param translationUnit that will be transformed...
Definition: ReorderFilterBreak.h:67
souffle::clone
auto clone(const std::vector< A * > &xs)
Definition: ContainerUtil.h:172
souffle::filter
std::vector< A > filter(std::vector< A > xs, F &&f)
Filter a vector to include certain elements.
Definition: FunctionalUtil.h:155
souffle::ram::makeLambdaRamMapper
LambdaNodeMapper< Lambda > makeLambdaRamMapper(const Lambda &lambda)
Creates a node mapper based on a corresponding lambda expression.
Definition: LambdaNodeMapper.h:67