summaryrefslogtreecommitdiff
path: root/project2/common/aggregate.h
diff options
context:
space:
mode:
Diffstat (limited to 'project2/common/aggregate.h')
-rw-r--r--project2/common/aggregate.h36
1 files changed, 36 insertions, 0 deletions
diff --git a/project2/common/aggregate.h b/project2/common/aggregate.h
new file mode 100644
index 0000000..18ad6a5
--- /dev/null
+++ b/project2/common/aggregate.h
@@ -0,0 +1,36 @@
+#ifndef AGGREGATE_H
+#define AGGREGATE_H
+
+#include "scripts.h"
+#include <boost/function.hpp>
+
+class Aggregate : public SourceObject {
+ public:
+ Aggregate(ScriptNodePtr);
+
+ virtual void reset() const = 0;
+ void pushValue() const;
+ protected:
+ virtual void pushValue(const VariableType &) const = 0;
+ private:
+ Variable value;
+};
+
+class ValueAggregate : public Aggregate {
+ public:
+ ValueAggregate(ScriptNodePtr);
+
+ virtual VariableType resultValue() const = 0;
+};
+typedef boost::intrusive_ptr<const ValueAggregate> ValueAggregateCPtr;
+
+class SetAggregate : public Aggregate {
+ public:
+ typedef boost::function1<void, VariableType> UseAgg;
+ SetAggregate(ScriptNodePtr);
+
+ virtual void onResultValues(const UseAgg &) const = 0;
+};
+typedef boost::intrusive_ptr<const SetAggregate> SetAggregateCPtr;
+
+#endif