0027067: Avoid use of virtual methods for implementation of destructors in legacy...
[occt.git] / src / Units / Units_ShiftedToken.cxx
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
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>
23
24 IMPLEMENT_STANDARD_RTTIEXT(Units_ShiftedToken,Units_Token)
25
26 //=======================================================================
27 //function : Units_ShiftedToken
28 //purpose  : 
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)
36 {
37   themove = amove;
38 }
39
40 //=======================================================================
41 //function : Creates
42 //purpose  : 
43 //=======================================================================
44
45 Handle(Units_Token) Units_ShiftedToken::Creates() const
46 {
47   TCollection_AsciiString word = Word();
48   TCollection_AsciiString mean = Mean();
49   return new Units_ShiftedToken(word.ToCString(),mean.ToCString(),Value(),Move(),Dimensions());
50 }
51
52 //=======================================================================
53 //function : Move
54 //purpose  : 
55 //=======================================================================
56
57 Standard_Real Units_ShiftedToken::Move() const
58 {
59   return themove;
60 }
61
62 //=======================================================================
63 //function : Multiplied
64 //purpose  : 
65 //=======================================================================
66
67 Standard_Real Units_ShiftedToken::Multiplied (const Standard_Real avalue) const
68 {
69   return (avalue + themove) * Value();
70 }
71
72 //=======================================================================
73 //function : Divided
74 //purpose  : 
75 //=======================================================================
76
77 Standard_Real Units_ShiftedToken::Divided (const Standard_Real avalue) const
78 {
79   return (avalue / Value()) - themove;
80 }
81
82 //=======================================================================
83 //function : Dump
84 //purpose  : 
85 //=======================================================================
86
87 void Units_ShiftedToken::Dump(const Standard_Integer ashift,
88                               const Standard_Integer alevel) const
89 {
90   Units_Token::Dump(ashift,alevel);
91   for(int i=0; i<ashift; i++)cout<<"  ";
92   cout<<"  move  : "<<themove<<endl;
93 }