JODA  0.13.1 (59b41972)
JSON On-Demand Analysis
CountAggregator.h
Go to the documentation of this file.
1 #ifndef JODA_COUNTAGGREGATOR_H
2 #define JODA_COUNTAGGREGATOR_H
3 
4 #include "IAggregator.h"
5 
6 namespace joda::query {
7 class CountAggregator : public IAggregator {
8  public:
9  CountAggregator(const std::string &toPointer,
10  std::vector<std::unique_ptr<IValueProvider>> &&params);
11  void merge(IAggregator *other) override;
12  RJValue terminate(RJMemoryPoolAlloc &alloc) override;
13  std::unique_ptr<IAggregator> duplicate() const override;
14  void accumulate(const RapidJsonDocument &json,
15  RJMemoryPoolAlloc &alloc) override;
16  const std::string getName() const override;
17 
18  static constexpr auto getName_() { return "COUNT"; }
19 
20  protected:
21  ulong count = 0;
22 };
23 } // namespace joda::query
24 
25 #endif // JODA_COUNTAGGREGATOR_H
rapidjson::MemoryPoolAllocator< RJBaseAlloc > RJMemoryPoolAlloc
Definition: RJFwd.h:26
rapidjson::GenericValue< RJChar, RJMemoryPoolAlloc > RJValue
Definition: RJFwd.h:29
Definition: RapidJsonDocument.h:22
Definition: CountAggregator.h:7
const std::string getName() const override
Definition: CountAggregator.cpp:55
CountAggregator(const std::string &toPointer, std::vector< std::unique_ptr< IValueProvider >> &&params)
Definition: CountAggregator.cpp:27
ulong count
Definition: CountAggregator.h:21
static constexpr auto getName_()
Definition: CountAggregator.h:18
RJValue terminate(RJMemoryPoolAlloc &alloc) override
Definition: CountAggregator.cpp:16
void accumulate(const RapidJsonDocument &json, RJMemoryPoolAlloc &alloc) override
Definition: CountAggregator.cpp:36
std::unique_ptr< IAggregator > duplicate() const override
Definition: CountAggregator.cpp:23
void merge(IAggregator *other) override
Definition: CountAggregator.cpp:8
Definition: IAggregator.h:25
std::vector< std::unique_ptr< IValueProvider > > params
Definition: IAggregator.h:124
std::string toPointer
Definition: IAggregator.h:120
Definition: AttributeStatAggregator.h:12