SHOGUN  v3.0.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ParameterMap.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) 2011 Heiko Strathmann
8  * Copyright (C) 2011 Berlin Institute of Technology and Max-Planck-Society
9  */
10 
11 #ifndef __PARAMETERMAP_
12 #define __PARAMETERMAP_
13 
14 #include <shogun/base/DynArray.h>
15 
16 namespace shogun
17 {
18 
19 struct TParameter;
20 
29 {
30 public:
32  SGParamInfo();
33 
42  SGParamInfo(const char* name, EContainerType ctype, EStructType stype,
43  EPrimitiveType ptype, int32_t param_version);
44 
50  SGParamInfo(const TParameter* param, int32_t param_version);
51 
55  SGParamInfo(const SGParamInfo& orig);
56 
58  virtual ~SGParamInfo();
59 
61  void print_param_info(const char* prefix="") const;
62 
64  char* to_string() const;
65 
67  SGParamInfo* duplicate() const;
68 
70  bool operator==(const SGParamInfo& other) const;
71 
73  bool operator!=(const SGParamInfo& other) const;
74 
76  bool operator<(const SGParamInfo& other) const;
77 
79  bool operator>(const SGParamInfo& other) const;
80 
83  bool is_empty() const;
84 
85 public:
87  char* m_name;
88 
90  EContainerType m_ctype;
91 
93  EStructType m_stype;
94 
96  EPrimitiveType m_ptype;
97 
99  int32_t m_param_version;
100 };
101 
107 {
108 public:
111 
117  ParameterMapElement(const SGParamInfo* key,
119 
121  virtual ~ParameterMapElement();
122 
124  bool operator==(const ParameterMapElement& other) const;
125 
127  bool operator<(const ParameterMapElement& other) const;
128 
130  bool operator>(const ParameterMapElement& other) const;
131 
133  virtual const char* get_name() const
134  {
135  return "ParameterMapElement";
136  }
137 
138 public:
141 
144 
145 };
146 
162 {
163 public:
165  ParameterMap();
166 
168  virtual ~ParameterMap();
169 
180  void put(const SGParamInfo* key, const SGParamInfo* value);
181 
193  DynArray<const SGParamInfo*>* get(const SGParamInfo) const;
194 
204  DynArray<const SGParamInfo*>* get(const SGParamInfo* key) const;
205 
211  void finalize_map();
212 
214  void print_map();
215 
216 protected:
219 
223 
226 };
227 
228 }
229 
230 #endif /* __PARAMETERMAP_ */

SHOGUN Machine Learning Toolbox - Documentation