SHOGUN  4.2.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
WrappedSGVector.h
Go to the documentation of this file.
1 /*
2  * -*- coding: utf-8 -*-
3  * vim: set fileencoding=utf-8
4  *
5  * Copyright (c) 2016, Shogun-Toolbox e.V. <shogun-team@shogun-toolbox.org>
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions are met:
10  *
11  * 1. Redistributions of source code must retain the above copyright notice,
12  * this list of conditions and the following disclaimer.
13  *
14  * 2. Redistributions in binary form must reproduce the above copyright
15  * notice, this list of conditions and the following disclaimer in the
16  * documentation and/or other materials provided with the distribution.
17  *
18  * 3. Neither the name of the copyright holder nor the names of its
19  * contributors may be used to endorse or promote products derived from
20  * this software without specific prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
26  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32  * POSSIBILITY OF SUCH DAMAGE.
33  *
34  * Authors: Heiko Strathmann
35  */
36 #ifndef WRAPPED_SGVECTOR_H__
37 #define WRAPPED_SGVECTOR_H__
38 
39 #include <shogun/base/SGObject.h>
40 #include <shogun/lib/SGString.h>
41 #include <shogun/lib/SGVector.h>
42 
43 
44 namespace shogun
45 {
46 
52 template<class T> class CWrappedSGVector: public CSGObject
53 {
54 public:
57  {
58  set_generic<T>();
59  register_params();
60  }
61 
66  CWrappedSGVector(SGVector<T> value, const char* value_name="")
67  {
68  set_generic<T>();
69  register_params();
70  m_value = value;
71  m_value_name = value_name;
72  }
73 
75  virtual const char* get_name() const { return "WrappedSGVector"; }
76 
77 private:
78  void register_params()
79  {
80  m_value_name = "Unnamed";
81  m_value = SGVector<T>();
82 
83  SG_ADD(&m_value, "value", "Wrapped value", MS_NOT_AVAILABLE);
84  }
85 
86 protected:
89 
91  const char* m_value_name;
92 };
93 
94 template class CWrappedSGVector<bool>;
95 template class CWrappedSGVector<char>;
96 template class CWrappedSGVector<int8_t>;
97 template class CWrappedSGVector<uint8_t>;
98 template class CWrappedSGVector<int16_t>;
99 template class CWrappedSGVector<uint16_t>;
100 template class CWrappedSGVector<int32_t>;
101 template class CWrappedSGVector<uint32_t>;
102 template class CWrappedSGVector<int64_t>;
103 template class CWrappedSGVector<uint64_t>;
104 template class CWrappedSGVector<float32_t>;
105 template class CWrappedSGVector<float64_t>;
106 template class CWrappedSGVector<floatmax_t>;
107 
108 };
109 #endif // WRAPPED_SGVECTOR_H__
Class SGObject is the base class of all shogun objects.
Definition: SGObject.h:115
shogun vector
CWrappedSGVector(SGVector< T > value, const char *value_name="")
virtual const char * get_name() const
all of classes and functions are contained in the shogun namespace
Definition: class_list.h:18
#define SG_ADD(...)
Definition: SGObject.h:84
Simple wrapper class that allows to store any Shogun SGVector in a CSGObject, and therefore to mak...

SHOGUN Machine Learning Toolbox - Documentation