SHOGUN  3.2.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 }

SHOGUN Machine Learning Toolbox - Documentation