ACF $AcfVersion:0$
CGeneralUnitInfo.h
Go to the documentation of this file.
1// SPDX-License-Identifier: LGPL-2.1-or-later OR GPL-2.0-or-later OR GPL-3.0-or-later OR LicenseRef-ACF-Commercial
2#pragma once
3
4
5// ACF includes
7#include <imath/IUnitInfo.h>
8
9
10namespace imath
11{
12
13
18 virtual public IUnitInfo,
19 virtual public iser::ISerializable
20{
21public:
23 int type = UT_UNKNOWN,
24 const QString& name = "",
25 double displayMultFactor = 1.0,
27 const imath::IDoubleManip* valueManipPtr = NULL);
28
29 void SetUnitType(int type);
30 void SetUnitName(const QString& name);
31 void SetDisplayMultiplicationFactor(double factor);
32 void SetValueRange(const istd::CRange& range);
33
34 // reimplemented (iser::ISerializable)
35 virtual bool Serialize(iser::IArchive& archive) override;
36
37 // reimplemented (imath::IUnitInfo)
38 virtual int GetUnitType() const override;
39 virtual QString GetUnitName() const override;
40 virtual double GetDisplayMultiplicationFactor() const override;
41 virtual istd::CRange GetValueRange() const override;
42 virtual const imath::IDoubleManip& GetValueManip() const override;
43
44private:
45 int m_type;
46 QString m_name;
47 double m_displayMultFactor;
48 istd::CRange m_range;
49 const imath::IDoubleManip* m_valueManipPtr;
50};
51
52
53} // namespace imath
54
55
General implementation of the IUnitInfo interface.
virtual int GetUnitType() const override
Get type of unit.
void SetUnitType(int type)
void SetValueRange(const istd::CRange &range)
virtual istd::CRange GetValueRange() const override
Get range of possible values.
void SetUnitName(const QString &name)
virtual double GetDisplayMultiplicationFactor() const override
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=NULL)
void SetDisplayMultiplicationFactor(double factor)
virtual bool Serialize(iser::IArchive &archive) override
Load or store state of this object as a archive stream.
virtual const imath::IDoubleManip & GetValueManip() const override
Return number manipulator object for numeric value.
virtual QString GetUnitName() const override
Get name of unit.
Interface for all manipulation using values represent as double.
Common interface to get information about a measurement unit.
Definition IUnitInfo.h:22
@ UT_UNKNOWN
Unit type is unknown.
Definition IUnitInfo.h:32
Represents an input/output persistence archive for object serialization.
Definition IArchive.h:164
Common class for all classes which objects can be archived or restored from archive.
static const TRange & GetInvalid()
Return invalid range.
Definition TRange.h:853
#define NULL
Definition istd.h:74
Package with mathematical functions and algebraical primitives.