ICF 3.1.1.10
Technical documentation of ICF Libraries
CGeneralUnitInfo.h
Go to the documentation of this file.
1/********************************************************************************
2** This file is part of the ICF Framework. Copyright (C) Witold Gantzke & Kirill Lepskiy
3** ICF Framework may be used under the terms of the LGPL License v. 2.1 by the Free Software Foundation.
4********************************************************************************/
5
6#ifndef imath_CGeneralUnitInfo_included
7#define imath_CGeneralUnitInfo_included
8
9
10// ICF includes
11#include <iser/ISerializable.h>
12#include <imath/IUnitInfo.h>
13
14
15namespace imath
16{
17
18
23 virtual public IUnitInfo,
24 virtual public iser::ISerializable
25{
26public:
28 int type = UT_UNKNOWN,
29 const QString& name = "",
30 double displayMultFactor = 1.0,
32 const imath::IDoubleManip* valueManipPtr = nullptr);
33
34 void SetUnitType(int type);
35 void SetUnitName(const QString& name);
36 void SetDisplayMultiplicationFactor(double factor);
37 void SetValueRange(const istd::CRange& range);
38
39 // reimplemented (iser::ISerializable)
40 virtual bool Serialize(iser::IArchive& archive);
41
42 // reimplemented (imath::IUnitInfo)
43 virtual int GetUnitType() const;
44 virtual QString GetUnitName() const;
45 virtual double GetDisplayMultiplicationFactor() const;
46 virtual istd::CRange GetValueRange() const;
47 virtual const imath::IDoubleManip& GetValueManip() const;
48
49private:
50 int m_type;
51 QString m_name;
52 double m_displayMultFactor;
53 istd::CRange m_range;
54 const imath::IDoubleManip* m_valueManipPtr;
55};
56
57
58} // namespace imath
59
60
61#endif // !imath_CGeneralUnitInfo_included
62
63
General implementation of the IUnitInfo interface.
virtual const imath::IDoubleManip & GetValueManip() const
Return number manipulator object for numeric value.
virtual bool Serialize(iser::IArchive &archive)
Load or store state of this object as a archive stream.
void SetUnitType(int type)
void SetValueRange(const istd::CRange &range)
void SetUnitName(const QString &name)
virtual double GetDisplayMultiplicationFactor() const
Get multiplication factor used to calculate user input values.
CGeneralUnitInfo(int type=UT_UNKNOWN, const QString &name="", double displayMultFactor=1.0, const istd::CRange &range=istd::CRange::GetInvalid(), const imath::IDoubleManip *valueManipPtr=nullptr)
void SetDisplayMultiplicationFactor(double factor)
virtual istd::CRange GetValueRange() const
Get range of possible values.
virtual QString GetUnitName() const
Get name of unit.
virtual int GetUnitType() const
Get type of unit.
Interface for all manipulation using values represent as double.
Common interface to get information about a measurement unit.
Definition IUnitInfo.h:27
@ UT_UNKNOWN
Unit type is unknown.
Definition IUnitInfo.h:37
Represent input/output persistence archive.
Definition IArchive.h:34
Common class for all classes which objects can be archived or restored from archive.
static constexpr TRange & GetInvalid()
Definition TRange.h:790
Package with mathematical functions and algebraical primitives.

© Witold Gantzke and Kirill Lepskiy