Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-19 09:29:51

0001 // Created on: 1992-11-05
0002 // Created by: Gilles DEBARBOUILLE
0003 // Copyright (c) 1992-1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016 
0017 #ifndef _Units_ShiftedToken_HeaderFile
0018 #define _Units_ShiftedToken_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_Type.hxx>
0022 
0023 #include <Units_Token.hxx>
0024 #include <Standard_Integer.hxx>
0025 class Units_Dimensions;
0026 
0027 //! The ShiftedToken class inherits from Token and
0028 //! describes tokens which have a gap in addition of
0029 //! the multiplicative factor. This kind of token
0030 //! allows the description of linear functions which
0031 //! do not pass through the origin, of the form:
0032 //!
0033 //! y = ax +b
0034 //!
0035 //! where <x> and <y> are the unknown variables, <a>
0036 //! the mutiplicative factor, and <b> the gap relative
0037 //! to the ordinate axis.
0038 //!
0039 //! An example is the translation between the Celsius
0040 //! and Fahrenheit degree of temperature.
0041 class Units_ShiftedToken : public Units_Token
0042 {
0043 
0044 public:
0045   //! Creates and returns a shifted token. <aword> is a
0046   //! string containing the available word, <amean> gives
0047   //! the signification of the token, <avalue> is the
0048   //! numeric value of the dimension, <amove> is the gap,
0049   //! and <adimensions> is the dimension of the given word
0050   //! <aword>.
0051   Standard_EXPORT Units_ShiftedToken(const char* const                    aword,
0052                                      const char* const                    amean,
0053                                      const double                         avalue,
0054                                      const double                         amove,
0055                                      const occ::handle<Units_Dimensions>& adimensions);
0056 
0057   //! Creates and returns a token, which is a ShiftedToken.
0058   Standard_EXPORT occ::handle<Units_Token> Creates() const override;
0059 
0060   //! Returns the gap <themove>
0061   Standard_EXPORT double Move() const;
0062 
0063   //! This virtual method is called by the Measurement
0064   //! methods, to compute the measurement during a
0065   //! conversion.
0066   Standard_EXPORT double Multiplied(const double avalue) const override;
0067 
0068   //! This virtual method is called by the Measurement
0069   //! methods, to compute the measurement during a
0070   //! conversion.
0071   Standard_EXPORT double Divided(const double avalue) const override;
0072 
0073   Standard_EXPORT void Dump(const int ashift, const int alevel) const override;
0074 
0075   DEFINE_STANDARD_RTTIEXT(Units_ShiftedToken, Units_Token)
0076 
0077 private:
0078   double themove;
0079 };
0080 
0081 #endif // _Units_ShiftedToken_HeaderFile