ParameterMap.h

Go to the documentation of this file.
00001 /*
00002  * This program is free software; you can redistribute it and/or modify
00003  * it under the terms of the GNU General Public License as published by
00004  * the Free Software Foundation; either version 3 of the License, or
00005  * (at your option) any later version.
00006  *
00007  * Written (W) 2011 Heiko Strathmann
00008  * Copyright (C) 2011 Berlin Institute of Technology and Max-Planck-Society
00009  */
00010 
00011 #ifndef __PARAMETERMAP_
00012 #define __PARAMETERMAP_
00013 
00014 #include <shogun/base/DynArray.h>
00015 
00016 namespace shogun
00017 {
00018 
00026 class SGParamInfo
00027 {
00028 public:
00030     SGParamInfo();
00031 
00039     SGParamInfo(const char* name, EContainerType ctype, EStructType stype,
00040             EPrimitiveType ptype);
00041 
00043     virtual ~SGParamInfo();
00044 
00046     void print_param_info();
00047 
00049     SGParamInfo* duplicate() const;
00050 
00052     bool operator==(const SGParamInfo& other) const;
00053 
00055     bool operator<(const SGParamInfo& other) const;
00056 
00058     bool operator>(const SGParamInfo& other) const;
00059 
00060 private:
00061     void init();
00062 
00063 public:
00065     char* m_name;
00067     EContainerType m_ctype;
00069     EStructType m_stype;
00071     EPrimitiveType m_ptype;
00072 };
00073 
00078 class ParameterMapElement
00079 {
00080 public:
00082     ParameterMapElement();
00083 
00089     ParameterMapElement(SGParamInfo* key, SGParamInfo* value);
00090 
00092     virtual ~ParameterMapElement();
00093 
00095     bool operator==(const ParameterMapElement& other) const;
00096 
00098     bool operator<(const ParameterMapElement& other) const;
00099 
00101     bool operator>(const ParameterMapElement& other) const;
00102 
00104     inline virtual const char* get_name() const
00105     {
00106         return "ParameterMapElement";
00107     }
00108 
00109 private:
00110     void init();
00111 
00112 public:
00114     SGParamInfo* m_key;
00116     SGParamInfo* m_value;
00117 
00118 };
00119 
00130 class ParameterMap
00131 {
00132 public:
00134     ParameterMap();
00135 
00137     virtual ~ParameterMap();
00138 
00144     void put(SGParamInfo* key, SGParamInfo* value);
00145 
00153     SGParamInfo* get(SGParamInfo* key) const;
00154 
00157     void finalize_map();
00158 
00160     void print_map();
00161 
00162 private:
00163     void init();
00164 
00165 protected:
00167     DynArray<ParameterMapElement*> m_map_elements;
00168 
00171     bool m_finalized;
00172 };
00173 
00174 }
00175 
00176 #endif /* __PARAMETERMAP_ */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

SHOGUN Machine Learning Toolbox - Documentation