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
6 // This file is part of Open CASCADE Technology software library.
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.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #ifndef _Units_ShiftedToken_HeaderFile
18 #define _Units_ShiftedToken_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
23 #include <Standard_Real.hxx>
24 #include <Units_Token.hxx>
25 #include <Standard_CString.hxx>
26 #include <Standard_Integer.hxx>
27 class Units_Dimensions;
31 class Units_ShiftedToken;
32 DEFINE_STANDARD_HANDLE(Units_ShiftedToken, Units_Token)
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 :
42 //! where <x> and <y> are the unknown variables, <a>
43 //! the mutiplicative factor, and <b> the gap relative
44 //! to the ordinate axis.
46 //! An example is the tranlation between the Celsius
47 //! and Fahrenheit degree of temperature.
48 class Units_ShiftedToken : public Units_Token
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
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);
62 //! Creates and returns a token, which is a ShiftedToken.
63 Standard_EXPORT virtual Handle(Units_Token) Creates() const Standard_OVERRIDE;
65 //! Returns the gap <themove>
66 Standard_EXPORT Standard_Real Move() const;
68 //! This virtual method is called by the Measurement
69 //! methods, to compute the measurement during a
71 Standard_EXPORT virtual Standard_Real Multiplied (const Standard_Real avalue) const Standard_OVERRIDE;
73 //! This virtual method is called by the Measurement
74 //! methods, to compute the measurement during a
76 Standard_EXPORT virtual Standard_Real Divided (const Standard_Real avalue) const Standard_OVERRIDE;
78 Standard_EXPORT virtual void Dump (const Standard_Integer ashift, const Standard_Integer alevel) const Standard_OVERRIDE;
82 DEFINE_STANDARD_RTTIEXT(Units_ShiftedToken,Units_Token)
92 Standard_Real themove;
103 #endif // _Units_ShiftedToken_HeaderFile