summaryrefslogtreecommitdiffstats
path: root/eval
diff options
context:
space:
mode:
authorHaavard <havardpe@yahoo-inc.com>2017-01-30 12:32:42 +0000
committerHaavard <havardpe@yahoo-inc.com>2017-01-30 12:32:42 +0000
commitf17d9435d5a9a9cc4ee0cbe1f7af1d61520bf3ad (patch)
treee291cbc52c9859303acfc315cfe88d36ab23acae /eval
parent697d4696ad97e060bd8edba8c6e734d38038cb3d (diff)
add comments
Diffstat (limited to 'eval')
-rw-r--r--eval/src/vespa/eval/eval/aggr.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/eval/src/vespa/eval/eval/aggr.h b/eval/src/vespa/eval/eval/aggr.h
index 6460a90a0be..86b33cb0ef1 100644
--- a/eval/src/vespa/eval/eval/aggr.h
+++ b/eval/src/vespa/eval/eval/aggr.h
@@ -13,7 +13,16 @@ namespace eval {
struct BinaryOperation;
+/**
+ * Enumeration of all different aggregators that are allowed to be
+ * used in tensor reduce expressions.
+ **/
enum class Aggr { AVG, COUNT, PROD, SUM, MAX, MIN };
+
+/**
+ * Utiliy class used to map between aggregator enum value and symbolic
+ * name. For example Aggr::AVG <-> "avg".
+ **/
class AggrNames {
private:
static const AggrNames _instance;
@@ -26,6 +35,15 @@ public:
static const Aggr *from_name(const vespalib::string &name);
};
+/**
+ * Interface defining a general purpose aggregator that can be re-used
+ * to aggregate multiple groups of values. Each number group is
+ * aggregated by calling 'first' once, followed by any number of calls
+ * to 'next', before finally calling 'result' to obtain the
+ * aggregation result. The 'create' function acts as a factory able to
+ * create Aggregator instances for all known aggregator enum values
+ * defined above.
+ **/
struct Aggregator {
virtual void first(double value) = 0;
virtual void next(double value) = 0;