b311480e |
1 | // Created on: 1992-11-05 |
2 | // Created by: Gilles DEBARBOUILLE |
3 | // Copyright (c) 1992-1999 Matra Datavision |
973c2be1 |
4 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
5 | // |
973c2be1 |
6 | // This file is part of Open CASCADE Technology software library. |
b311480e |
7 | // |
d5f74e42 |
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 |
973c2be1 |
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. |
b311480e |
13 | // |
973c2be1 |
14 | // Alternatively, this file may be used under the terms of Open CASCADE |
15 | // commercial license or contractual agreement. |
7fd59977 |
16 | |
42cf5bc1 |
17 | |
18 | #include <Standard_Type.hxx> |
7fd59977 |
19 | #include <TCollection_AsciiString.hxx> |
42cf5bc1 |
20 | #include <Units_Dimensions.hxx> |
21 | #include <Units_ShiftedToken.hxx> |
22 | #include <Units_Token.hxx> |
7fd59977 |
23 | |
92efcf78 |
24 | IMPLEMENT_STANDARD_RTTIEXT(Units_ShiftedToken,Units_Token) |
25 | |
7fd59977 |
26 | //======================================================================= |
27 | //function : Units_ShiftedToken |
28 | //purpose : |
29 | //======================================================================= |
7fd59977 |
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; |
7fd59977 |
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); |
04232180 |
91 | for(int i=0; i<ashift; i++)std::cout<<" "; |
92 | std::cout<<" move : "<<themove<<std::endl; |
7fd59977 |
93 | } |