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.
18 #include <Standard_Type.hxx>
19 #include <TCollection_AsciiString.hxx>
20 #include <Units_Dimensions.hxx>
21 #include <Units_ShiftedToken.hxx>
22 #include <Units_Token.hxx>
24 IMPLEMENT_STANDARD_RTTIEXT(Units_ShiftedToken,Units_Token)
26 //=======================================================================
27 //function : Units_ShiftedToken
29 //=======================================================================
30 Units_ShiftedToken::Units_ShiftedToken(const Standard_CString aword,
31 const Standard_CString amean,
32 const Standard_Real avalue,
33 const Standard_Real amove,
34 const Handle(Units_Dimensions)& adimensions)
35 : Units_Token(aword,amean,avalue,adimensions)
40 //=======================================================================
43 //=======================================================================
45 Handle(Units_Token) Units_ShiftedToken::Creates() const
47 TCollection_AsciiString word = Word();
48 TCollection_AsciiString mean = Mean();
49 return new Units_ShiftedToken(word.ToCString(),mean.ToCString(),Value(),Move(),Dimensions());
52 //=======================================================================
55 //=======================================================================
57 Standard_Real Units_ShiftedToken::Move() const
62 //=======================================================================
63 //function : Multiplied
65 //=======================================================================
67 Standard_Real Units_ShiftedToken::Multiplied (const Standard_Real avalue) const
69 return (avalue + themove) * Value();
72 //=======================================================================
75 //=======================================================================
77 Standard_Real Units_ShiftedToken::Divided (const Standard_Real avalue) const
79 return (avalue / Value()) - themove;
82 //=======================================================================
85 //=======================================================================
87 void Units_ShiftedToken::Dump(const Standard_Integer ashift,
88 const Standard_Integer alevel) const
90 Units_Token::Dump(ashift,alevel);
91 for(int i=0; i<ashift; i++)cout<<" ";
92 cout<<" move : "<<themove<<endl;