eLynx SDK
v3.0.1 C++ image processing API reference |
00001 //============================================================================ 00002 // CoreParameters.h Core.Component package 00003 //============================================================================ 00004 // Usage : definitions of modeler parameters for UI. 00005 //---------------------------------------------------------------------------- 00006 // Copyright (C) 2008 by eLynx project 00007 // 00008 // This library is free software; you can redistribute it and/or 00009 // modify it under the terms of the GNU Library General Public 00010 // License as published by the Free Software Foundation; either 00011 // version 2 of the License, or (at your option) any later version. 00012 // 00013 // This library is distributed in the hope that it will be useful, 00014 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00016 // See the GNU Library General Public License for more details. 00017 //---------------------------------------------------------------------------- 00018 #ifndef __CoreParameters_h__ 00019 #define __CoreParameters_h__ 00020 00021 #include "elx/core/CoreTypes.h" 00022 #include <string> 00023 #include <vector> 00024 00025 namespace eLynx { 00026 00027 enum EParameterType 00028 { 00029 PT_Boolean, 00030 PT_Enum, 00031 PT_Integer, 00032 PT_Double, 00033 PT_String, 00034 PT_StringList 00035 }; 00036 00037 //---------------------------------------------------------------------------- 00038 class ExportedByCore AbstractParameter 00039 { 00040 public: 00041 AbstractParameter(EParameterType iType, const std::string& iName); 00042 virtual ~AbstractParameter(); 00043 00044 virtual void Reset() = 0; 00045 00046 EParameterType GetType() const; 00047 std::string GetName() const; 00048 00049 protected: 00050 EParameterType _type; 00051 std::string _name; 00052 }; 00053 00054 typedef std::vector<AbstractParameter*> ParameterList; 00055 size_t ExportedByCore elxGetParameterIndex(const ParameterList& iList, const std::string& iName); 00056 00057 //---------------------------------------------------------------------------- 00058 struct ExportedByCore ParameterEnumItem 00059 { 00060 ParameterEnumItem(char*l, int32 v) { _label=l; _value=v; } 00061 char * _label; 00062 int32 _value; 00063 }; 00064 typedef std::vector<ParameterEnumItem> ParameterEnumItemList; 00065 00066 00067 class ExportedByCore ParameterEnum : public AbstractParameter 00068 { 00069 public: 00070 ParameterEnum(const std::string& iName, int32 iIndex, const ParameterEnumItemList& iList); 00071 ParameterEnum(); 00072 virtual ~ParameterEnum(); 00073 00074 virtual void Reset(); 00075 00076 size_t GetSize() const; 00077 00078 int32 GetIndex() const; 00079 void SetIndex(int32 iIndex); 00080 00081 int32 GetValue() const; 00082 int32 GetValue(int32 iIndex) const; 00083 00084 const char * GetLabel() const; 00085 const char * GetLabel(int32 iIndex) const; 00086 00087 protected: 00088 int32 _index, _default; 00089 const ParameterEnumItemList& _list; 00090 }; 00091 00092 //---------------------------------------------------------------------------- 00093 class ExportedByCore ParameterInteger : public AbstractParameter 00094 { 00095 public: 00096 ParameterInteger(const std::string& iName, 00097 int32 iMin, int32 iMax, int32 iValue, int32 iTick, int32 iDigits, 00098 const std::string& iFormat); 00099 virtual ~ParameterInteger(); 00100 00101 virtual void Reset(); 00102 00103 void SetValue(int32 iValue); 00104 00105 int32 GetMin() const; 00106 int32 GetMax() const; 00107 int32 GetValue() const; 00108 int32 GetTick() const; 00109 int32 GetDigits() const; 00110 std::string GetFormat() const; 00111 00112 protected: 00113 int32 _min, _max, _value, _default; 00114 int32 _tick, _digits; 00115 std::string _format; 00116 }; 00117 00118 //---------------------------------------------------------------------------- 00119 class ExportedByCore ParameterDouble : public AbstractParameter 00120 { 00121 public: 00122 ParameterDouble(const std::string& iName, 00123 double iMin, double iMax, double iValue, int32 iTick, int32 iDigits, 00124 const std::string& iFormat); 00125 virtual ~ParameterDouble(); 00126 00127 virtual void Reset(); 00128 00129 void SetValue(double iValue); 00130 00131 double GetMin() const; 00132 double GetMax() const; 00133 double GetValue() const; 00134 int32 GetTick() const; 00135 int32 GetDigits() const; 00136 std::string GetFormat() const; 00137 00138 protected: 00139 double _min, _max, _value, _default; 00140 int32 _tick, _digits; 00141 std::string _format; 00142 }; 00143 00144 } // namespace eLynx 00145 00146 #endif // __CoreParameters_h__