CNumericConstraintsComp.h
Go to the documentation of this file.
1 
2 #ifndef imeas_CNumericConstraintsComp_included
3 #define imeas_CNumericConstraintsComp_included
4 
5 
6 // ACF includes
7 #include "iser/ISerializable.h"
8 #include "icomp/CComponentBase.h"
9 
10 // ACF-Solutions includes
11 #include "imath/IUnitInfo.h"
12 #include "imath/CDoubleManip.h"
13 
14 #include "imeas/INumericValue.h"
16 
17 
18 namespace imeas
19 {
20 
21 
27  public icomp::CComponentBase,
28  virtual public INumericConstraints,
29  virtual public imath::IUnitInfo,
30  protected imath::CDoubleManip
31 {
32 public:
34 
35  I_BEGIN_COMPONENT(CNumericConstraintsComp);
36  I_REGISTER_INTERFACE(INumericConstraints);
37  I_REGISTER_INTERFACE(imath::IUnitInfo);
38  I_ASSIGN(m_dimensionsCountAttrPtr, "ValuesCount", "Default number of numeric values", true, 1);
39  I_ASSIGN_MULTI_0(m_namesAttrPtr, "ValueName", "Name of each single value", true);
40  I_ASSIGN_MULTI_0(m_descriptionsAttrPtr, "ValueDescriptions", "Description of each single value", true);
41  I_ASSIGN_MULTI_0(m_valueIdsAttrPtr, "ValueIds", "ID of each single value", true);
42  I_ASSIGN(m_unitTypeAttrPtr, "UnitType", "Type of unit\n\t0 - unknown,\n\t1 - physical,\n\t2 - technical,\n\t3 - relative", true, 0);
43  I_ASSIGN(m_unitNameAttrPtr, "UnitName", "Name of unit", true, "");
44  I_ASSIGN(m_displayMultFactorAttrPtr, "DisplayMultFactor", "Scale factor used for display, e.g for unit name '%' it will be 100", true, 1);
45  I_ASSIGN(m_minValueAttrPtr, "MinValue", "Minimal value", true, 0);
46  I_ASSIGN(m_maxValueAttrPtr, "MaxValue", "Maximal value", true, 1);
47  I_ASSIGN(m_precisionAttrPtr, "Precision", "Typical values: 0 - integer, 15 - double", true, 15);
48  I_END_COMPONENT;
49 
50  // reimplemented (imeas::INumericConstraints)
51  virtual int GetNumericValuesCount() const;
52  virtual QString GetNumericValueName(int index) const;
53  virtual QString GetNumericValueDescription(int index) const;
54  virtual const imath::IUnitInfo& GetNumericValueUnitInfo(int index) const;
55 
56 protected:
57  // reimplemented (imath::IUnitInfo)
58  virtual int GetUnitType() const;
59  virtual QString GetUnitName() const;
60  virtual double GetDisplayMultiplicationFactor() const;
61  virtual istd::CRange GetValueRange() const;
62  virtual const imath::IDoubleManip& GetValueManip() const;
63 
64  // reimplemented (imath::IDoubleManip)
65  virtual int GetPrecision() const;
66 
67  // reimplemented (ibase::CComponentBase)
68  virtual void OnComponentCreated();
69 
70 private:
71  I_ATTR(int, m_dimensionsCountAttrPtr);
72  I_MULTIATTR(QString, m_namesAttrPtr);
73  I_MULTIATTR(QString, m_descriptionsAttrPtr);
74  I_MULTIATTR(QByteArray, m_valueIdsAttrPtr);
75  I_ATTR(int, m_unitTypeAttrPtr);
76  I_ATTR(QString, m_unitNameAttrPtr);
77  I_ATTR(double, m_displayMultFactorAttrPtr);
78  I_ATTR(double, m_minValueAttrPtr);
79  I_ATTR(double, m_maxValueAttrPtr);
80  I_ATTR(int, m_precisionAttrPtr);
81 
82  int m_precision;
83 };
84 
85 
86 } // namespace imeas
87 
88 
89 #endif // !imeas_CNumericConstraintsComp_included
90 
91 
virtual double GetDisplayMultiplicationFactor() const
Describe additional meta information for set of numeric values.
virtual int GetNumericValuesCount() const
Get number of expected numeric values.
virtual QString GetUnitName() const
virtual istd::CRange GetValueRange() const
virtual int GetPrecision() const
virtual const imath::IDoubleManip & GetValueManip() const
virtual QString GetNumericValueName(int index) const
Get human readable name of numeric value for specified list index.
virtual int GetUnitType() const
virtual QString GetNumericValueDescription(int index) const
Get human readable description of numeric value for specified list index.
virtual const imath::IUnitInfo & GetNumericValueUnitInfo(int index) const
Get range of possible numeric values for specified list index.
Simple implementation of imeas::INumericConstraints interface.

© 2007-2011 Witold Gantzke and Kirill Lepskiy