973c2be1 |
1 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
2 | // |
973c2be1 |
3 | // This file is part of Open CASCADE Technology software library. |
b311480e |
4 | // |
d5f74e42 |
5 | // This library is free software; you can redistribute it and/or modify it under |
6 | // the terms of the GNU Lesser General Public License version 2.1 as published |
973c2be1 |
7 | // by the Free Software Foundation, with special exception defined in the file |
8 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
9 | // distribution for complete text of the license and disclaimer of any warranty. |
b311480e |
10 | // |
973c2be1 |
11 | // Alternatively, this file may be used under the terms of Open CASCADE |
12 | // commercial license or contractual agreement. |
b311480e |
13 | |
7fd59977 |
14 | |
42cf5bc1 |
15 | #include <Standard_Type.hxx> |
16 | #include <StepBasic_MeasureValueMember.hxx> |
17 | #include <StepBasic_MeasureWithUnit.hxx> |
18 | #include <StepBasic_Unit.hxx> |
7fd59977 |
19 | |
25e59720 |
20 | IMPLEMENT_STANDARD_RTTIEXT(StepBasic_MeasureWithUnit,Standard_Transient) |
92efcf78 |
21 | |
7fd59977 |
22 | //======================================================================= |
23 | //function : StepBasic_MeasureWithUnit |
24 | //purpose : |
25 | //======================================================================= |
7fd59977 |
26 | StepBasic_MeasureWithUnit::StepBasic_MeasureWithUnit () {} |
27 | |
28 | //======================================================================= |
29 | //function : Init |
30 | //purpose : |
31 | //======================================================================= |
32 | |
33 | void StepBasic_MeasureWithUnit::Init( |
34 | const Handle(StepBasic_MeasureValueMember)& aValueComponent, |
35 | const StepBasic_Unit &aUnitComponent) |
36 | { |
37 | // --- classe own fields --- |
38 | valueComponent = aValueComponent; |
39 | unitComponent = aUnitComponent; |
40 | } |
41 | |
42 | |
43 | //======================================================================= |
44 | //function : SetValueComponent |
45 | //purpose : |
46 | //======================================================================= |
47 | |
48 | void StepBasic_MeasureWithUnit::SetValueComponent(const Standard_Real aValueComponent) |
49 | { |
50 | if (valueComponent.IsNull()) valueComponent = new StepBasic_MeasureValueMember; |
51 | valueComponent->SetReal(aValueComponent); |
52 | } |
53 | |
54 | //======================================================================= |
55 | //function : ValueComponent |
56 | //purpose : |
57 | //======================================================================= |
58 | |
59 | Standard_Real StepBasic_MeasureWithUnit::ValueComponent() const |
60 | { |
61 | return (valueComponent.IsNull() ? 0.0 : valueComponent->Real()); |
62 | } |
63 | |
64 | //======================================================================= |
65 | //function : ValueComponentMember |
66 | //purpose : |
67 | //======================================================================= |
68 | |
69 | Handle(StepBasic_MeasureValueMember) StepBasic_MeasureWithUnit::ValueComponentMember () const |
70 | { return valueComponent; } |
71 | |
72 | //======================================================================= |
73 | //function : SetValueComponentMember |
74 | //purpose : |
75 | //======================================================================= |
76 | |
77 | void StepBasic_MeasureWithUnit::SetValueComponentMember (const Handle(StepBasic_MeasureValueMember)& val) |
78 | { valueComponent = val; } |
79 | |
80 | //======================================================================= |
81 | //function : SetUnitComponent |
82 | //purpose : |
83 | //======================================================================= |
84 | |
85 | void StepBasic_MeasureWithUnit::SetUnitComponent(const StepBasic_Unit& aUnitComponent) |
86 | { |
87 | unitComponent = aUnitComponent; |
88 | } |
89 | |
90 | //======================================================================= |
91 | //function : UnitComponent |
92 | //purpose : |
93 | //======================================================================= |
94 | |
95 | StepBasic_Unit StepBasic_MeasureWithUnit::UnitComponent() const |
96 | { |
97 | return unitComponent; |
98 | } |