blob: c7f5fe0f50b77c4eba538cec1c45ec3a27d14392 (
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
|
#include <aggregate.h>
class Distinct : public SetAggregate {
public:
Distinct(ScriptNodePtr s) :
SetAggregate(s)
{
}
void reset() const
{
result.clear();
}
void pushValue(const VariableType & v, ExecContext *) const
{
result.insert(v);
}
void onResultValues(const SetAggregate::UseAgg & u) const
{
for (const VariableType & v : result) {
u(v);
}
}
private:
mutable std::set<VariableType> result;
};
NAMEDFACTORY("distinct", Distinct, SetAggregateFactory);
|