SHOGUN  4.1.0
 全部  命名空间 文件 函数 变量 类型定义 枚举 枚举值 友元 宏定义  
ScalarResult.h
浏览该文件的文档.
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 #ifndef SCALAR_RESULT_H_
11 #define SCALAR_RESULT_H_
12 
13 #include <shogun/lib/config.h>
14 
16 #include <shogun/io/SGIO.h>
17 
18 namespace shogun
19 {
20 
24 template<class T> class CScalarResult : public CJobResult
25 {
27 typedef bool supports_complex128_t;
28 
29 public:
32  : CJobResult()
33  {
34  init();
35 
36  SG_GCDEBUG("%s created (%p)\n", this->get_name(), this)
37  }
38 
44  CScalarResult(const T& scalar_result)
45  : CJobResult()
46  {
47  init();
48 
49  m_result=scalar_result;
50 
51  SG_GCDEBUG("%s created (%p)\n", this->get_name(), this)
52  }
53 
55  virtual ~CScalarResult()
56  {
57  SG_GCDEBUG("%s destroyed (%p)\n", this->get_name(), this)
58  }
59 
61  virtual const char* get_name() const
62  {
63  return "ScalarResult";
64  }
65 
67  const T get_result() const
68  {
69  return m_result;
70  }
71 
72 protected:
75 
76 private:
78  void init()
79  {
80  m_result=static_cast<T>(0);
81 
82  set_generic<T>();
83 
84  SG_ADD(&m_result, "scalar_result", "Scalar result of a computation job",
86  }
87 };
88 }
89 
90 #endif // SCALAR_RESULT_H_
Base class that stores the result of an independent job when the result is a scalar.
Definition: ScalarResult.h:24
CScalarResult(const T &scalar_result)
Definition: ScalarResult.h:44
Base class that stores the result of an independent job.
Definition: JobResult.h:21
#define SG_GCDEBUG(...)
Definition: SGIO.h:102
virtual const char * get_name() const
Definition: ScalarResult.h:61
all of classes and functions are contained in the shogun namespace
Definition: class_list.h:18
virtual ~CScalarResult()
Definition: ScalarResult.h:55
const T get_result() const
Definition: ScalarResult.h:67
#define SG_ADD(...)
Definition: SGObject.h:81

SHOGUN 机器学习工具包 - 项目文档