SHOGUN  3.2.1
 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/lib/config.h>
15 
16 #include <shogun/base/DynArray.h>
17 #include <shogun/lib/DataType.h>
18 #include <shogun/lib/common.h>
19 
20 namespace shogun
21 {
22 
23 struct TParameter;
24 
33 {
34 public:
36  SGParamInfo();
37 
46  SGParamInfo(const char* name, EContainerType ctype, EStructType stype,
47  EPrimitiveType ptype, int32_t param_version);
48 
54  SGParamInfo(const TParameter* param, int32_t param_version);
55 
59  SGParamInfo(const SGParamInfo& orig);
60 
62  virtual ~SGParamInfo();
63 
65  void print_param_info(const char* prefix="") const;
66 
68  char* to_string() const;
69 
71  SGParamInfo* duplicate() const;
72 
74  bool operator==(const SGParamInfo& other) const;
75 
77  bool operator!=(const SGParamInfo& other) const;
78 
80  bool operator<(const SGParamInfo& other) const;
81 
83  bool operator>(const SGParamInfo& other) const;
84 
87  bool is_empty() const;
88 
89 public:
91  char* m_name;
92 
94  EContainerType m_ctype;
95 
97  EStructType m_stype;
98 
100  EPrimitiveType m_ptype;
101 
104 };
105 
111 {
112 public:
115 
121  ParameterMapElement(const SGParamInfo* key,
123 
125  virtual ~ParameterMapElement();
126 
128  bool operator==(const ParameterMapElement& other) const;
129 
131  bool operator<(const ParameterMapElement& other) const;
132 
134  bool operator>(const ParameterMapElement& other) const;
135 
137  virtual const char* get_name() const
138  {
139  return "ParameterMapElement";
140  }
141 
142 public:
145 
148 
149 };
150 
166 {
167 public:
169  ParameterMap();
170 
172  virtual ~ParameterMap();
173 
184  void put(const SGParamInfo* key, const SGParamInfo* value);
185 
197  DynArray<const SGParamInfo*>* get(const SGParamInfo) const;
198 
208  DynArray<const SGParamInfo*>* get(const SGParamInfo* key) const;
209 
215  void finalize_map();
216 
218  void print_map();
219 
220 protected:
223 
227 
230 };
231 
232 }
233 
234 #endif /* __PARAMETERMAP_ */

SHOGUN Machine Learning Toolbox - Documentation