SHOGUN  5.0.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules
StoreScalarAggregator.cpp
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or modify
3  * it under the terms of the GNU General Public License as published by
4  * the Free Software Foundation; either version 3 of the License, or
5  * (at your option) any later version.
6  *
7  * Written (W) 2013 Soumyajit De
8  */
9 
12 
13 namespace shogun
14 {
15 template<class T>
18  {
19  init();
20  }
21 
22 template<class T>
24  {
25  m_aggregate=static_cast<T>(0);
26 
27  set_generic<T>();
28 
29  SG_ADD(&m_aggregate, "current_aggregate",
30  "Aggregation of computation job results", MS_NOT_AVAILABLE);
31  }
32 
33 template<class T>
35  {
36  }
37 
38 template<class T>
40  {
41  SG_GCDEBUG("Entering\n")
42 
43  // check for proper typecast
44  CScalarResult<T>* new_result=dynamic_cast<CScalarResult<T>*>(result);
45  if (!new_result)
46  SG_ERROR("result is not of CScalarResult type!\n");
47  // aggregate it with previous
48  m_aggregate+=new_result->get_result();
49 
50  SG_GCDEBUG("Leaving\n")
51  }
52 
53 template<>
55  {
57  }
58 
59 template<>
61  {
63  }
64 
65 template<class T>
67  {
68  m_result=(CJobResult*)(new CScalarResult<T>(m_aggregate));
69  SG_REF(m_result);
70  }
71 
72 template class CStoreScalarAggregator<bool>;
73 template class CStoreScalarAggregator<char>;
74 template class CStoreScalarAggregator<int8_t>;
75 template class CStoreScalarAggregator<uint8_t>;
76 template class CStoreScalarAggregator<int16_t>;
78 template class CStoreScalarAggregator<int32_t>;
80 template class CStoreScalarAggregator<int64_t>;
86 }
Base class that stores the result of an independent job when the result is a scalar.
Definition: ScalarResult.h:24
Base class that stores the result of an independent job.
Definition: JobResult.h:21
#define SG_ERROR(...)
Definition: SGIO.h:129
#define SG_NOTIMPLEMENTED
Definition: SGIO.h:139
virtual void submit_result(CJobResult *result)
#define SG_REF(x)
Definition: SGObject.h:54
#define SG_GCDEBUG(...)
Definition: SGIO.h:102
Template class that aggregates scalar job results in each submit_result call, finalize then transform...
Abstract base class that provides an interface for computing an aggeregation of the job results of in...
all of classes and functions are contained in the shogun namespace
Definition: class_list.h:18
const T get_result() const
Definition: ScalarResult.h:67
#define SG_ADD(...)
Definition: SGObject.h:84

SHOGUN Machine Learning Toolbox - Documentation