Parameter.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) 2010 Soeren Sonnenburg
00008  * Copyright (C) 2010 Berlin Institute of Technology
00009  */
00010 #ifndef __PARAMETER_H__
00011 #define __PARAMETER_H__
00012 
00013 #include "base/SGObject.h"
00014 #include "lib/common.h"
00015 #include "lib/DynamicArray.h"
00016 #include "lib/io.h"
00017 #include "lib/DataType.h"
00018 
00019 namespace shogun
00020 {
00021 
00022 class CRange
00023 {
00024     public:
00025     CRange()
00026     {
00027     }
00028 
00029     ~CRange()
00030     {
00031     }
00032 
00033 protected:
00034     double lower_limit;
00035     double default_value;
00036     double upper_limit;
00037 };
00038 
00039 struct TParameter
00040 {
00041     void* parameter;
00042     SGDataType datatype;
00043     char* name;
00044     char* description;
00046     CRange* range;
00047 };
00048 
00049 class CParameter: public CSGObject
00050 {
00051 public:
00052     CParameter()
00053     {
00054         m_parameters = new CDynamicArray<TParameter*>();
00055     }
00056 
00058     virtual ~CParameter()
00059     {
00060         free_parameters();
00061     }
00062 
00063     void add(float64_t* parameter, const char* name,
00064             CRange* range=NULL, const char* description=NULL);
00065 
00066     void list_parameters();
00067 
00068     inline int32_t get_num_parameters()
00069     {
00070         return m_parameters->get_num_elements();
00071     }
00072 
00074     inline virtual const char* get_name() const { return "Parameter"; }
00075 
00076 protected:
00077     void free_parameters();
00078 
00079 protected:
00080     CDynamicArray<TParameter*>* m_parameters;
00081 };
00082 }
00083 #endif //__PARAMETER_H__
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

SHOGUN Machine Learning Toolbox - Documentation