42cf5bc1 |
1 | // Created on: 1992-11-04 |
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_ShiftedUnit_HeaderFile |
18 | #define _Units_ShiftedUnit_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_Type.hxx> |
22 | |
23 | #include <Standard_Real.hxx> |
24 | #include <Units_Unit.hxx> |
25 | #include <Standard_CString.hxx> |
26 | #include <Standard_Integer.hxx> |
27 | class Units_Quantity; |
28 | class Units_Token; |
29 | |
30 | |
31 | class Units_ShiftedUnit; |
32 | DEFINE_STANDARD_HANDLE(Units_ShiftedUnit, Units_Unit) |
33 | |
34 | //! This class is useful to describe units with a |
35 | //! shifted origin in relation to another unit. A well |
36 | //! known example is the Celsius degrees in relation |
37 | //! to Kelvin degrees. The shift of the Celsius origin |
38 | //! is 273.15 Kelvin degrees. |
39 | class Units_ShiftedUnit : public Units_Unit |
40 | { |
41 | |
42 | public: |
43 | |
44 | |
45 | //! Creates and returns a shifted unit. <aname> is the |
46 | //! name of the unit, <asymbol> is the usual abbreviation |
47 | //! of the unit, <avalue> is the value in relation to the |
48 | //! International System of Units, and <amove> is the gap |
49 | //! in relation to another unit. |
50 | //! |
51 | //! For example Celcius dregee of temperature is an |
52 | //! instance of ShiftedUnit with <avalue> equal to 1. and |
53 | //! <amove> equal to 273.15. |
54 | Standard_EXPORT Units_ShiftedUnit(const Standard_CString aname, const Standard_CString asymbol, const Standard_Real avalue, const Standard_Real amove, const Handle(Units_Quantity)& aquantity); |
55 | |
56 | //! Creates and returns a unit. <aname> is the name of |
57 | //! the unit, <asymbol> is the usual abbreviation of the |
58 | //! unit. |
59 | Standard_EXPORT Units_ShiftedUnit(const Standard_CString aname, const Standard_CString asymbol); |
60 | |
61 | //! Creates and returns a unit. <aname> is the name of |
62 | //! the unit. |
63 | Standard_EXPORT Units_ShiftedUnit(const Standard_CString aname); |
64 | |
65 | //! Sets the field <themove> to <amove> |
66 | Standard_EXPORT void Move (const Standard_Real amove); |
67 | |
68 | //! Returns the shifted value <themove>. |
69 | Standard_EXPORT Standard_Real Move() const; |
70 | |
71 | //! This redefined method returns a ShiftedToken object. |
72 | Standard_EXPORT virtual Handle(Units_Token) Token() const Standard_OVERRIDE; |
73 | |
74 | Standard_EXPORT virtual void Dump (const Standard_Integer ashift, const Standard_Integer alevel) const Standard_OVERRIDE; |
75 | |
76 | |
77 | |
78 | |
92efcf78 |
79 | DEFINE_STANDARD_RTTIEXT(Units_ShiftedUnit,Units_Unit) |
42cf5bc1 |
80 | |
81 | protected: |
82 | |
83 | |
84 | |
85 | |
86 | private: |
87 | |
88 | |
89 | Standard_Real themove; |
90 | |
91 | |
92 | }; |
93 | |
94 | |
95 | |
96 | |
97 | |
98 | |
99 | |
100 | #endif // _Units_ShiftedUnit_HeaderFile |