SHOGUN  v3.0.0
 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 
10 #include <shogun/lib/config.h>
13 
14 namespace shogun
15 {
16 template<class T>
19  {
20  init();
21  }
22 
23 template<class T>
25  {
26  m_aggregate=static_cast<T>(0);
27 
28  set_generic<T>();
29 
30  SG_ADD(&m_aggregate, "current_aggregate",
31  "Aggregation of computation job results", MS_NOT_AVAILABLE);
32  }
33 
34 template<class T>
36  {
37  }
38 
39 template<class T>
41  {
42  SG_GCDEBUG("Entering\n")
43 
44  // check for proper typecast
45  CScalarResult<T>* new_result=dynamic_cast<CScalarResult<T>*>(result);
46  if (!new_result)
47  SG_ERROR("result is not of CScalarResult type!\n");
48  // aggregate it with previous
49  m_aggregate+=new_result->get_result();
50 
51  SG_GCDEBUG("Leaving\n")
52  }
53 
54 template<>
56  {
58  }
59 
60 template<>
62  {
64  }
65 
66 template<class T>
68  {
69  m_result=(CJobResult*)(new CScalarResult<T>(m_aggregate));
70  SG_REF(m_result);
71  }
72 
73 template class CStoreScalarAggregator<bool>;
74 template class CStoreScalarAggregator<char>;
75 template class CStoreScalarAggregator<int8_t>;
76 template class CStoreScalarAggregator<uint8_t>;
77 template class CStoreScalarAggregator<int16_t>;
79 template class CStoreScalarAggregator<int32_t>;
81 template class CStoreScalarAggregator<int64_t>;
87 }

SHOGUN Machine Learning Toolbox - Documentation