SHOGUN  3.2.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ScalarResult.h
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 #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_

SHOGUN Machine Learning Toolbox - Documentation