-
-
Notifications
You must be signed in to change notification settings - Fork 1k
/
StoreScalarAggregator.h
63 lines (50 loc) · 1.47 KB
/
StoreScalarAggregator.h
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/*
* This software is distributed under BSD 3-clause license (see LICENSE file).
*
* Authors: Soumyajit De, Thoralf Klein, Yuyu Zhang, Björn Esser
*/
#ifndef STORE_SCALAR_AGGREGATOR_H_
#define STORE_SCALAR_AGGREGATOR_H_
#include <shogun/lib/config.h>
#include <shogun/lib/computation/aggregator/JobResultAggregator.h>
namespace shogun
{
class CJobResult;
/** @brief Template class that aggregates scalar job results in each
* submit_result call, finalize then transforms current aggregation into
* a CScalarResult.
*/
template<class T> class CStoreScalarAggregator : public CJobResultAggregator
{
/** this class supports complex */
typedef bool supports_complex128_t;
public:
/** default constructor */
CStoreScalarAggregator();
/** destructor */
virtual ~CStoreScalarAggregator();
/**
* method that submits the result (scalar) of an independent job, and
* computes the aggregation with the previously submitted result
*
* @param result the result of an independent job
*/
virtual void submit_result(CJobResult* result);
/**
* method that finalizes the aggregation and computes the result (scalar),
* its necessary to call finalize before getting the final result
*/
virtual void finalize();
/** @return object name */
virtual const char* get_name() const
{
return "StoreScalarAggregator";
}
private:
/** the aggregation */
T m_aggregate;
/** initialize with default values and register params */
void init();
};
}
#endif // STORE_SCALAR_AGGREGATOR_H_