JODA  0.13.1 (59b41972)
JSON On-Demand Analysis
Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes
joda::query::GroupAggregator Class Reference

#include <GroupAggregator.h>

Inheritance diagram for joda::query::GroupAggregator:
[legend]
Collaboration diagram for joda::query::GroupAggregator:
[legend]

Public Member Functions

 GroupAggregator (const std::string &toPointer, std::unique_ptr< IValueProvider > &&groupBy, std::unique_ptr< IAggregator > &&agg, std::string groupAs="")
 
 ~GroupAggregator () override=default
 
void merge (IAggregator *other) override
 
std::unique_ptr< IAggregatorduplicate () const override
 
const std::string getName () const override
 
std::string toString () const override
 
RJValue terminate (RJMemoryPoolAlloc &alloc) override
 
void accumulate (const RapidJsonDocument &json, RJMemoryPoolAlloc &alloc) override
 
std::vector< std::string > getAttributes () const override
 
void setGroupAs (const std::string &groupAs)
 
- Public Member Functions inherited from joda::query::IAggregator
 IAggregator (const std::string &toPointer, std::vector< std::unique_ptr< IValueProvider >> &&params)
 
 IAggregator (IAggregator const &)=delete
 
void operator= (IAggregator const &x)=delete
 
virtual ~IAggregator ()=default
 
virtual const std::string & getDestPointer () const
 
std::string getParameterStringRepresentation () const
 

Static Public Member Functions

static constexpr auto getName_ ()
 

Protected Types

typedef std::unordered_map< std::string, std::unique_ptr< IAggregator > > StringAggregators
 
typedef std::unordered_map< double, std::unique_ptr< IAggregator > > NumAggregators
 

Protected Member Functions

const std::string getGroupName () const
 
const std::string getValueName () const
 
- Protected Member Functions inherited from joda::query::IAggregator
void checkParamSize (unsigned int expected)
 
void checkMinParamSize (unsigned int expected)
 
void checkParamType (unsigned int i, IValueType expected)
 
void checkOptionalParamType (unsigned int i, IValueType expected)
 
std::vector< std::unique_ptr< IValueProvider > > duplicateParameters () const
 

Protected Attributes

const std::unique_ptr< IValueProvidergroupBy
 
const std::unique_ptr< IAggregatorprotoAgg
 
StringAggregators stringGroups
 
NumAggregators numGroups
 
std::unique_ptr< IAggregatortrueAgg = nullptr
 
std::unique_ptr< IAggregatorfalseAgg = nullptr
 
std::string groupAs
 
- Protected Attributes inherited from joda::query::IAggregator
std::string toPointer
 
std::vector< std::unique_ptr< IValueProvider > > params
 

Member Typedef Documentation

◆ NumAggregators

typedef std::unordered_map<double, std::unique_ptr<IAggregator> > joda::query::GroupAggregator::NumAggregators
protected

◆ StringAggregators

typedef std::unordered_map<std::string, std::unique_ptr<IAggregator> > joda::query::GroupAggregator::StringAggregators
protected

Constructor & Destructor Documentation

◆ GroupAggregator()

joda::query::GroupAggregator::GroupAggregator ( const std::string &  toPointer,
std::unique_ptr< IValueProvider > &&  groupBy,
std::unique_ptr< IAggregator > &&  agg,
std::string  groupAs = "" 
)

◆ ~GroupAggregator()

joda::query::GroupAggregator::~GroupAggregator ( )
overridedefault

Member Function Documentation

◆ accumulate()

void joda::query::GroupAggregator::accumulate ( const RapidJsonDocument json,
RJMemoryPoolAlloc alloc 
)
overridevirtual

Accumulates another value. This function is called for every value once

Parameters
jsonThe Rapidjsondocument to retrieve values from. (Or an empty RapidJsonDocument for const values)
allocA MemoryPoolAllocator to create the values with

Implements joda::query::IAggregator.

◆ duplicate()

std::unique_ptr< joda::query::IAggregator > joda::query::GroupAggregator::duplicate ( ) const
overridevirtual

Duplicates the Aggregator

Returns
A new Instance of the given Aggregator

Implements joda::query::IAggregator.

◆ getAttributes()

std::vector< std::string > joda::query::GroupAggregator::getAttributes ( ) const
overridevirtual

Reimplemented from joda::query::IAggregator.

◆ getGroupName()

const std::string joda::query::GroupAggregator::getGroupName ( ) const
protected

◆ getName()

const std::string joda::query::GroupAggregator::getName ( ) const
overridevirtual

Returns the name of the Aggregator

Returns
Name of Aggregator

Implements joda::query::IAggregator.

◆ getName_()

static constexpr auto joda::query::GroupAggregator::getName_ ( )
inlinestaticconstexpr

◆ getValueName()

const std::string joda::query::GroupAggregator::getValueName ( ) const
protected

◆ merge()

void joda::query::GroupAggregator::merge ( IAggregator other)
overridevirtual

Merges the given instance with another.

Parameters
otherOther instance to be merged. Has to be of same class!

Implements joda::query::IAggregator.

◆ setGroupAs()

void joda::query::GroupAggregator::setGroupAs ( const std::string &  groupAs)

◆ terminate()

RJValue joda::query::GroupAggregator::terminate ( RJMemoryPoolAlloc alloc)
overridevirtual

Terminates the aggregation and collects the values

Returns
Collected values (GroupKey,Value)

Implements joda::query::IAggregator.

◆ toString()

std::string joda::query::GroupAggregator::toString ( ) const
overridevirtual

Reimplemented from joda::query::IAggregator.

Field Documentation

◆ falseAgg

std::unique_ptr<IAggregator> joda::query::GroupAggregator::falseAgg = nullptr
protected

◆ groupAs

std::string joda::query::GroupAggregator::groupAs
protected

◆ groupBy

const std::unique_ptr<IValueProvider> joda::query::GroupAggregator::groupBy
protected

◆ numGroups

NumAggregators joda::query::GroupAggregator::numGroups
protected

◆ protoAgg

const std::unique_ptr<IAggregator> joda::query::GroupAggregator::protoAgg
protected

◆ stringGroups

StringAggregators joda::query::GroupAggregator::stringGroups
protected

◆ trueAgg

std::unique_ptr<IAggregator> joda::query::GroupAggregator::trueAgg = nullptr
protected

The documentation for this class was generated from the following files: