itom 1.4.0
|
00001 /* ******************************************************************** 00002 itom software 00003 URL: http://www.uni-stuttgart.de/ito 00004 Copyright (C) 2013, Institut für Technische Optik (ITO), 00005 Universität Stuttgart, Germany 00006 00007 This file is part of itom and its software development toolkit (SDK). 00008 00009 itom is free software; you can redistribute it and/or modify it 00010 under the terms of the GNU Library General Public Licence as published by 00011 the Free Software Foundation; either version 2 of the Licence, or (at 00012 your option) any later version. 00013 00014 In addition, as a special exception, the Institut für Technische 00015 Optik (ITO) gives you certain additional rights. 00016 These rights are described in the ITO LGPL Exception version 1.0, 00017 which can be found in the file LGPL_EXCEPTION.txt in this package. 00018 00019 itom is distributed in the hope that it will be useful, but 00020 WITHOUT ANY WARRANTY; without even the implied warranty of 00021 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library 00022 General Public Licence for more details. 00023 00024 You should have received a copy of the GNU Library General Public License 00025 along with itom. If not, see <http://www.gnu.org/licenses/>. 00026 *********************************************************************** */ 00027 00028 #ifndef PARAMMETA_H 00029 #define PARAMMETA_H 00030 00031 /* includes */ 00032 00033 #include "commonGlobal.h" 00034 #include "typeDefs.h" 00035 #include "byteArray.h" 00036 #include "retVal.h" 00037 00038 #include <limits> 00039 00040 00041 /* definition and macros */ 00042 /* global variables (avoid) */ 00043 /* content */ 00044 00045 namespace ito 00046 { 00058 class ITOMCOMMON_EXPORT ParamMeta 00059 { 00060 public: 00067 enum MetaRtti 00068 { 00069 rttiUnknown = 0, 00070 rttiCharMeta = 1, 00071 rttiIntMeta = 2, 00072 rttiDoubleMeta = 3, 00073 rttiStringMeta = 4, 00074 rttiHWMeta = 5, 00075 rttiDObjMeta = 6, 00076 rttiIntArrayMeta = 7, 00077 rttiDoubleArrayMeta = 8, 00078 rttiCharArrayMeta = 9, 00079 rttiIntervalMeta = 10, 00080 rttiDoubleIntervalMeta = 11, 00081 rttiRangeMeta = 12, 00082 rttiRectMeta = 13 00083 }; 00084 00085 ParamMeta() : m_type(rttiUnknown) {} 00086 ParamMeta(MetaRtti type) : m_type(type) {} 00087 virtual ~ParamMeta() {} 00088 inline MetaRtti getType() const { return m_type; } 00089 protected: 00090 MetaRtti m_type; 00091 }; 00092 00102 class ITOMCOMMON_EXPORT CharMeta : public ParamMeta 00103 { 00104 public: 00106 explicit CharMeta(char minVal, char maxVal, char stepSize = 1); 00107 static CharMeta* all(); 00108 inline char getMin() const { return m_minVal; } 00109 inline char getMax() const { return m_maxVal; } 00110 inline char getStepSize() const { return m_stepSize; } 00111 00113 00116 void setMin(char val); 00117 00119 00122 void setMax(char val); 00123 00125 00128 void setStepSize(char val); 00129 private: 00130 char m_minVal; 00131 char m_maxVal; 00132 char m_stepSize; // >= 1 00133 }; 00134 00144 class ITOMCOMMON_EXPORT IntMeta : public ParamMeta 00145 { 00146 public: 00147 explicit IntMeta(int minVal, int maxVal, int stepSize = 1); 00148 static IntMeta* all(); 00149 inline int getMin() const { return m_minVal; } 00150 inline int getMax() const { return m_maxVal; } 00151 inline int getStepSize() const { return m_stepSize; } 00152 00154 00157 void setMin(int val); 00158 00160 00163 void setMax(int val); 00164 00166 00169 void setStepSize(int val); 00170 private: 00171 int m_minVal; 00172 int m_maxVal; 00173 int m_stepSize; // >= 1 00174 }; 00175 00185 class ITOMCOMMON_EXPORT DoubleMeta : public ParamMeta 00186 { 00187 public: 00189 explicit DoubleMeta(double minVal, double maxVal, double stepSize = 0.0 /*0.0 means no specific step size*/); 00190 static DoubleMeta* all(); 00191 inline double getMin() const { return m_minVal; } 00192 inline double getMax() const { return m_maxVal; } 00193 inline double getStepSize() const { return m_stepSize; } 00194 00196 00199 void setMin(double val); 00200 00202 00205 void setMax(double val); 00206 00208 00211 void setStepSize(double val); 00212 private: 00213 double m_minVal; 00214 double m_maxVal; 00215 double m_stepSize; // >= 0, 0.0 means no specific step size 00216 }; 00217 00228 class ITOMCOMMON_EXPORT HWMeta : public ParamMeta 00229 { 00230 public: 00232 00238 explicit HWMeta(uint32 minType) : ParamMeta(rttiHWMeta), m_minType(minType) 00239 { 00240 } 00241 00243 00248 explicit HWMeta(const char *HWAddInName) : ParamMeta(rttiHWMeta), m_minType(0), m_HWName(HWAddInName) 00249 { 00250 } 00251 00252 HWMeta(const HWMeta& cpy) : ParamMeta(rttiHWMeta), m_minType(cpy.m_minType), m_HWName(cpy.m_HWName) 00253 { 00254 } 00255 00256 inline uint32 getMinType() const { return m_minType; } 00257 inline ito::ByteArray getHWAddInName() const { return m_HWName; } 00258 private: 00259 uint32 m_minType; 00260 ito::ByteArray m_HWName; 00261 }; 00262 00273 class ITOMCOMMON_EXPORT StringMeta : public ParamMeta 00274 { 00275 public: 00276 enum tType 00277 { 00278 String, 00279 Wildcard, 00280 RegExp 00281 }; 00282 00284 00289 StringMeta(tType type); 00290 00292 00298 StringMeta(tType type, const char* val); 00299 00301 StringMeta(const StringMeta& cpy); 00302 00304 virtual ~StringMeta(); 00305 00306 inline tType getStringType() const { return m_stringType; } 00307 inline int getLen() const { return m_len; } 00308 const char* getString(int idx = 0) const; 00309 bool addItem(const char *val); 00310 StringMeta & operator += (const char *val); 00311 00312 private: 00313 tType m_stringType; 00314 int m_len; 00315 char **m_val; 00316 }; 00317 00326 class ITOMCOMMON_EXPORT DObjMeta : public ParamMeta 00327 { 00328 public: 00329 explicit DObjMeta(uint32 allowedTypes = 0xFFFF, int minDim = 0, int maxDim = std::numeric_limits<int>::max()) : ParamMeta(rttiDObjMeta), m_allowedTypes(allowedTypes), m_minDim(minDim), m_maxDim(maxDim) {} 00330 inline int getAllowedTypes() const { return m_allowedTypes; } 00331 inline int getMinDim() const { return m_minDim; } 00332 inline int getMaxDim() const { return m_maxDim; } 00333 00334 private: 00335 uint32 m_allowedTypes; 00336 int m_minDim; 00337 int m_maxDim; 00338 }; 00339 00350 class ITOMCOMMON_EXPORT CharArrayMeta : public CharMeta 00351 { 00352 public: 00353 explicit CharArrayMeta(char minVal, char maxVal, char stepSize = 1); 00354 explicit CharArrayMeta(char minVal, char maxVal, char stepSize, size_t numMin, size_t numMax, size_t numStepSize = 1); 00355 inline size_t getNumMin() const { return m_numMin; } 00356 inline size_t getNumMax() const { return m_numMax; } 00357 inline size_t getNumStepSize() const { return m_numStep; } 00358 00360 00363 void setNumMin(size_t val); 00364 00366 00369 void setNumMax(size_t val); 00370 00372 00375 void setNumStepSize(size_t val); 00376 00377 private: 00378 size_t m_numMin; 00379 size_t m_numMax; 00380 size_t m_numStep; 00381 }; 00382 00393 class ITOMCOMMON_EXPORT IntArrayMeta : public IntMeta 00394 { 00395 public: 00396 explicit IntArrayMeta(int minVal, int maxVal, int stepSize = 1); 00397 explicit IntArrayMeta(int minVal, int maxVal, int stepSize, size_t numMin, size_t numMax, size_t numStepSize = 1); 00398 inline size_t getNumMin() const { return m_numMin; } 00399 inline size_t getNumMax() const { return m_numMax; } 00400 inline size_t getNumStepSize() const { return m_numStep; } 00401 00403 00406 void setNumMin(size_t val); 00407 00409 00412 void setNumMax(size_t val); 00413 00415 00418 void setNumStepSize(size_t val); 00419 00420 private: 00421 size_t m_numMin; 00422 size_t m_numMax; 00423 size_t m_numStep; 00424 }; 00425 00436 class ITOMCOMMON_EXPORT DoubleArrayMeta : public DoubleMeta 00437 { 00438 public: 00439 explicit DoubleArrayMeta(double minVal, double maxVal, double stepSize = 0.0); 00440 explicit DoubleArrayMeta(double minVal, double maxVal, double stepSize, size_t numMin, size_t numMax, size_t numStepSize = 1); 00441 inline size_t getNumMin() const { return m_numMin; } 00442 inline size_t getNumMax() const { return m_numMax; } 00443 inline size_t getNumStepSize() const { return m_numStep; } 00444 00446 00449 void setNumMin(size_t val); 00450 00452 00455 void setNumMax(size_t val); 00456 00458 00461 void setNumStepSize(size_t val); 00462 00463 private: 00464 size_t m_numMin; 00465 size_t m_numMax; 00466 size_t m_numStep; 00467 }; 00468 00469 00481 class ITOMCOMMON_EXPORT DoubleIntervalMeta : public DoubleMeta 00482 { 00483 public: 00484 explicit DoubleIntervalMeta(double minVal, double maxVal, double stepSize = 0.0); 00485 explicit DoubleIntervalMeta(double minVal, double maxVal, double stepSize, double sizeMin, double sizeMax, double sizeStep = 0.0); 00486 inline double getSizeMin() const { return m_sizeMin; } 00487 inline double getSizeMax() const { return m_sizeMax; } 00488 inline double getSizeStepSize() const { return m_sizeStep; } 00489 00491 00494 void setSizeMin(double val); 00495 00497 00500 void setSizeMax(double val); 00501 00503 00506 void setSizeStep(double val); 00507 00508 private: 00509 double m_sizeMin; 00510 double m_sizeMax; 00511 double m_sizeStep; 00512 }; 00513 00514 00528 class ITOMCOMMON_EXPORT IntervalMeta : public IntMeta 00529 { 00530 public: 00531 explicit IntervalMeta(int minVal, int maxVal, int stepSize = 1); 00532 explicit IntervalMeta(int minVal, int maxVal, int stepSize, int sizeMin, int sizeMax, int intervalStep = 1); 00533 inline int getSizeMin() const { return m_sizeMin; } 00534 inline int getSizeMax() const { return m_sizeMax; } 00535 inline int getSizeStepSize() const { return m_sizeStep; } 00536 inline bool isIntervalNotRange() const { return m_isIntervalNotRange; } 00537 00539 00542 void setIntervalMin(int val); 00543 00545 00548 void setIntervalMax(int val); 00549 00551 00554 void setIntervalStep(int val); 00555 00556 protected: 00557 int m_sizeMin; 00558 int m_sizeMax; 00559 int m_sizeStep; 00560 bool m_isIntervalNotRange; 00561 }; 00562 00563 00581 class ITOMCOMMON_EXPORT RangeMeta : public IntervalMeta 00582 { 00583 public: 00584 explicit RangeMeta(int minVal, int maxVal, int stepSize = 1); 00585 explicit RangeMeta(int minVal, int maxVal, int stepSize, int sizeMin, int sizeMax, int sizeStep = 1); 00586 }; 00587 00588 00600 class ITOMCOMMON_EXPORT RectMeta : public ParamMeta 00601 { 00602 public: 00603 explicit RectMeta(const ito::RangeMeta &widthMeta, const ito::RangeMeta &heightMeta); 00604 inline const ito::RangeMeta& getWidthRangeMeta() const { return m_widthMeta; } 00605 inline const ito::RangeMeta& getHeightRangeMeta() const { return m_heightMeta; } 00606 00607 void setWidthRangeMeta(const ito::RangeMeta &widthMeta); 00608 void setHeightRangeMeta(const ito::RangeMeta &heightMeta); 00609 00610 protected: 00611 ito::RangeMeta m_heightMeta; 00612 ito::RangeMeta m_widthMeta; 00613 }; 00614 00615 00616 00617 } //end namespace ito 00618 00619 #endif