0031687: Draw Harness, ViewerTest - extend command vrenderparams with option updating...
[occt.git] / src / Units / Units_Unit.hxx
CommitLineData
42cf5bc1 1// Created on: 1992-10-29
2// Created by: Gilles DEBARBOUILLE
3// Copyright (c) 1992-1999 Matra Datavision
4// Copyright (c) 1999-2014 OPEN CASCADE SAS
5//
6// This file is part of Open CASCADE Technology software library.
7//
8// This library is free software; you can redistribute it and/or modify it under
9// the terms of the GNU Lesser General Public License version 2.1 as published
10// by the Free Software Foundation, with special exception defined in the file
11// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12// distribution for complete text of the license and disclaimer of any warranty.
13//
14// Alternatively, this file may be used under the terms of Open CASCADE
15// commercial license or contractual agreement.
16
17#ifndef _Units_Unit_HeaderFile
18#define _Units_Unit_HeaderFile
19
20#include <Standard.hxx>
21#include <Standard_Type.hxx>
22
23#include <TColStd_HSequenceOfHAsciiString.hxx>
24#include <Standard_Real.hxx>
25e59720 25#include <Standard_Transient.hxx>
42cf5bc1 26#include <Standard_CString.hxx>
27#include <TCollection_AsciiString.hxx>
28#include <Standard_Boolean.hxx>
29#include <Standard_Integer.hxx>
30class TCollection_HAsciiString;
31class Units_Quantity;
32class Units_Token;
33
34
35class Units_Unit;
25e59720 36DEFINE_STANDARD_HANDLE(Units_Unit, Standard_Transient)
42cf5bc1 37
38//! This class defines an elementary word contained in
39//! a physical quantity.
25e59720 40class Units_Unit : public Standard_Transient
42cf5bc1 41{
42
43public:
44
45
46 //! Creates and returns a unit. <aname> is the name of
47 //! the unit, <asymbol> is the usual abbreviation of the
48 //! unit, and <avalue> is the value in relation to the
49 //! International System of Units.
50 Standard_EXPORT Units_Unit(const Standard_CString aname, const Standard_CString asymbol, const Standard_Real avalue, const Handle(Units_Quantity)& aquantity);
51
52 //! Creates and returns a unit. <aname> is the name of
53 //! the unit, <asymbol> is the usual abbreviation of the
54 //! unit.
55 Standard_EXPORT Units_Unit(const Standard_CString aname, const Standard_CString asymbol);
56
57 //! Creates and returns a unit. <aname> is the name of
58 //! the unit.
59 Standard_EXPORT Units_Unit(const Standard_CString aname);
60
61 //! Returns the name of the unit <thename>
62 TCollection_AsciiString Name() const;
63
64 //! Adds a new symbol <asymbol> attached to <me>.
65 Standard_EXPORT void Symbol (const Standard_CString asymbol);
66
67 //! Returns the value in relation with the International
68 //! System of Units.
69 Standard_Real Value() const;
70
71 //! Returns <thequantity> contained in <me>.
72 Handle(Units_Quantity) Quantity() const;
73
74 //! Returns the sequence of symbols <thesymbolssequence>
75 Handle(TColStd_HSequenceOfHAsciiString) SymbolsSequence() const;
76
77 //! Sets the value <avalue> to <me>.
78 void Value (const Standard_Real avalue);
79
80 //! Sets the physical Quantity <aquantity> to <me>.
81 void Quantity (const Handle(Units_Quantity)& aquantity);
82
83 //! Starting with <me>, returns a new Token object.
84 Standard_EXPORT virtual Handle(Units_Token) Token() const;
85
86 //! Compares all the symbols linked within <me> with the
87 //! name of <atoken>, and returns True if there is one
88 //! symbol equal to the name, False otherwise.
89 Standard_EXPORT Standard_Boolean IsEqual (const Standard_CString astring) const;
90
91 //! Useful for debugging
92 Standard_EXPORT virtual void Dump (const Standard_Integer ashift, const Standard_Integer alevel) const;
93
94
95
96
25e59720 97 DEFINE_STANDARD_RTTIEXT(Units_Unit,Standard_Transient)
42cf5bc1 98
99protected:
100
101
102 Handle(TColStd_HSequenceOfHAsciiString) thesymbolssequence;
103 Standard_Real thevalue;
104
105
106private:
107
108
109 Handle(TCollection_HAsciiString) thename;
110 Handle(Units_Quantity) thequantity;
111
112
113};
114
115
116#include <Units_Unit.lxx>
117
118
119
120
121
122#endif // _Units_Unit_HeaderFile