summaryrefslogtreecommitdiff
path: root/project2/common/aggregate.h
blob: 18ad6a53975b644051913a23955b10c31a34a9fd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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