CNumericConstraintsComp.h
Go to the documentation of this file.
1 #ifndef imeas_CNumericConstraintsComp_included
2 #define imeas_CNumericConstraintsComp_included
3 
4 
5 // ACF includes
6 #include <iser/ISerializable.h>
7 #include <icomp/CComponentBase.h>
8 
9 // ACF-Solutions includes
10 #include <imath/IUnitInfo.h>
11 #include <imath/CDoubleManip.h>
12 
13 #include <imeas/INumericValue.h>
15 
16 
17 namespace imeas
18 {
19 
20 
26  public icomp::CComponentBase,
27  virtual public INumericConstraints,
28  virtual public imath::IUnitInfo,
29  protected imath::CDoubleManip,
30  protected iprm::IOptionsList
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 const iprm::IOptionsList& GetValueListInfo() const;
52  virtual const imath::IUnitInfo* GetNumericValueUnitInfo(int index) const;
53 
54 protected:
55  // reimplemented (imath::IUnitInfo)
56  virtual int GetUnitType() const;
57  virtual QString GetUnitName() const;
58  virtual double GetDisplayMultiplicationFactor() const;
59  virtual istd::CRange GetValueRange() const;
60  virtual const imath::IDoubleManip& GetValueManip() const;
61 
62  // reimplemented (imath::IDoubleManip)
63  virtual int GetPrecision() const;
64 
65  // reimplemented (iprm::IOptionsList)
66  virtual int GetOptionsFlags() const;
67  virtual int GetOptionsCount() const;
68  virtual QString GetOptionName(int index) const;
69  virtual QString GetOptionDescription(int index) const;
70  virtual QByteArray GetOptionId(int index) const;
71  virtual bool IsOptionEnabled(int index) const;
72 
73  // reimplemented (ibase::CComponentBase)
74  virtual void OnComponentCreated();
75 
76 private:
77  I_ATTR(int, m_dimensionsCountAttrPtr);
78  I_MULTITEXTATTR(m_namesAttrPtr);
79  I_MULTITEXTATTR(m_descriptionsAttrPtr);
80  I_MULTIATTR(QByteArray, m_valueIdsAttrPtr);
81  I_ATTR(int, m_unitTypeAttrPtr);
82  I_TEXTATTR(m_unitNameAttrPtr);
83  I_ATTR(double, m_displayMultFactorAttrPtr);
84  I_ATTR(double, m_minValueAttrPtr);
85  I_ATTR(double, m_maxValueAttrPtr);
86  I_ATTR(int, m_precisionAttrPtr);
87 
88  int m_precision;
89 };
90 
91 
92 } // namespace imeas
93 
94 
95 #endif // !imeas_CNumericConstraintsComp_included
96 
97 
virtual double GetDisplayMultiplicationFactor() const
virtual const iprm::IOptionsList & GetValueListInfo() const
Get general information about the "content" of the numeric value.
virtual int GetOptionsFlags() const
Describe additional meta information for set of numeric values.
virtual int GetOptionsCount() const
virtual QString GetOptionDescription(int index) const
virtual QString GetUnitName() const
virtual istd::CRange GetValueRange() const
virtual int GetPrecision() const
virtual const imath::IDoubleManip & GetValueManip() const
virtual bool IsOptionEnabled(int index) const
virtual int GetUnitType() const
Simple implementation of imeas::INumericConstraints interface.
virtual QByteArray GetOptionId(int index) const
virtual QString GetOptionName(int index) const
virtual const imath::IUnitInfo * GetNumericValueUnitInfo(int index) const
Get range of possible numeric values for specified list index.

© 2007-2017 Witold Gantzke and Kirill Lepskiy