SHOGUN  v3.0.1
 全部  命名空间 文件 函数 变量 类型定义 枚举 枚举值 友元 宏定义  
StoreScalarAggregator.cpp
浏览该文件的文档.
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 }
Base class that stores the result of an independent job when the result is a scalar.
Base class that stores the result of an independent job.
Definition: JobResult.h:20
#define SG_ERROR(...)
Definition: SGIO.h:131
#define SG_NOTIMPLEMENTED
Definition: SGIO.h:141
virtual void submit_result(CJobResult *result)
#define SG_REF(x)
Definition: SGObject.h:53
#define SG_GCDEBUG(...)
Definition: SGIO.h:104
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...
const T get_result() const
Definition: ScalarResult.h:66
#define SG_ADD(...)
Definition: SGObject.h:83

SHOGUN Machine Learning Toolbox - Documentation