42cf5bc1 |
1 | // Created on: 1992-11-05 |
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_ShiftedToken_HeaderFile |
18 | #define _Units_ShiftedToken_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_Type.hxx> |
22 | |
23 | #include <Standard_Real.hxx> |
24 | #include <Units_Token.hxx> |
25 | #include <Standard_CString.hxx> |
26 | #include <Standard_Integer.hxx> |
27 | class Units_Dimensions; |
28 | class Units_Token; |
29 | |
30 | |
31 | class Units_ShiftedToken; |
32 | DEFINE_STANDARD_HANDLE(Units_ShiftedToken, Units_Token) |
33 | |
34 | //! The ShiftedToken class inherits from Token and |
35 | //! describes tokens which have a gap in addition of |
36 | //! the multiplicative factor. This kind of token |
37 | //! allows the description of linear functions which |
38 | //! do not pass through the origin, of the form : |
39 | //! |
40 | //! y = ax +b |
41 | //! |
42 | //! where <x> and <y> are the unknown variables, <a> |
43 | //! the mutiplicative factor, and <b> the gap relative |
44 | //! to the ordinate axis. |
45 | //! |
46 | //! An example is the tranlation between the Celsius |
47 | //! and Fahrenheit degree of temperature. |
48 | class Units_ShiftedToken : public Units_Token |
49 | { |
50 | |
51 | public: |
52 | |
53 | |
54 | //! Creates and returns a shifted token. <aword> is a |
55 | //! string containing the available word, <amean> gives |
56 | //! the signification of the token, <avalue> is the |
57 | //! numeric value of the dimension, <amove> is the gap, |
58 | //! and <adimensions> is the dimension of the given word |
59 | //! <aword>. |
60 | Standard_EXPORT Units_ShiftedToken(const Standard_CString aword, const Standard_CString amean, const Standard_Real avalue, const Standard_Real amove, const Handle(Units_Dimensions)& adimensions); |
61 | |
62 | //! Creates and returns a token, which is a ShiftedToken. |
63 | Standard_EXPORT virtual Handle(Units_Token) Creates() const Standard_OVERRIDE; |
64 | |
65 | //! Returns the gap <themove> |
66 | Standard_EXPORT Standard_Real Move() const; |
67 | |
68 | //! This virtual method is called by the Measurement |
69 | //! methods, to compute the measurement during a |
70 | //! conversion. |
71 | Standard_EXPORT virtual Standard_Real Multiplied (const Standard_Real avalue) const Standard_OVERRIDE; |
72 | |
73 | //! This virtual method is called by the Measurement |
74 | //! methods, to compute the measurement during a |
75 | //! conversion. |
76 | Standard_EXPORT virtual Standard_Real Divided (const Standard_Real avalue) const Standard_OVERRIDE; |
77 | |
42cf5bc1 |
78 | Standard_EXPORT virtual void Dump (const Standard_Integer ashift, const Standard_Integer alevel) const Standard_OVERRIDE; |
79 | |
80 | |
81 | |
92efcf78 |
82 | DEFINE_STANDARD_RTTIEXT(Units_ShiftedToken,Units_Token) |
42cf5bc1 |
83 | |
84 | protected: |
85 | |
86 | |
87 | |
88 | |
89 | private: |
90 | |
91 | |
92 | Standard_Real themove; |
93 | |
94 | |
95 | }; |
96 | |
97 | |
98 | |
99 | |
100 | |
101 | |
102 | |
103 | #endif // _Units_ShiftedToken_HeaderFile |