0023024: Update headers of OCCT files
[occt.git] / src / StepElement / StepElement_MeasureOrUnspecifiedValue.cxx
1 // Created on: 2002-12-10
2 // Created by: data exchange team
3 // Copyright (c) 2002-2012 OPEN CASCADE SAS
4 //
5 // The content of this file is subject to the Open CASCADE Technology Public
6 // License Version 6.5 (the "License"). You may not use the content of this file
7 // except in compliance with the License. Please obtain a copy of the License
8 // at http://www.opencascade.org and read it completely before using this file.
9 //
10 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
11 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
12 //
13 // The Original Code and all software distributed under the License is
14 // distributed on an "AS IS" basis, without warranty of any kind, and the
15 // Initial Developer hereby disclaims all such warranties, including without
16 // limitation, any warranties of merchantability, fitness for a particular
17 // purpose or non-infringement. Please see the License for the specific terms
18 // and conditions governing the rights and limitations under the License.
19
20 // Generator:   ExpToCas (EXPRESS -> CASCADE/XSTEP Translator) V2.0
21
22 #include <StepElement_MeasureOrUnspecifiedValue.ixx>
23 #include <StepElement_MeasureOrUnspecifiedValueMember.hxx>
24 #include <TCollection_HAsciiString.hxx>
25
26 static Standard_CString aCDM = "CONTEXT_DEPENDENT_MEASURE";
27 static Standard_CString anUV = "UNSPECIFIED_VALUE";
28
29
30 //=======================================================================
31 //function : StepElement_MeasureOrUnspecifiedValue
32 //purpose  : 
33 //=======================================================================
34
35 StepElement_MeasureOrUnspecifiedValue::StepElement_MeasureOrUnspecifiedValue ()
36 {
37 }
38
39 //=======================================================================
40 //function : CaseNum
41 //purpose  : 
42 //=======================================================================
43
44 Standard_Integer StepElement_MeasureOrUnspecifiedValue::CaseNum (const Handle(Standard_Transient)& ent) const
45 {
46   return 0;
47 }
48
49 //=======================================================================
50 //function : CaseMem
51 //purpose  : 
52 //=======================================================================
53
54 Standard_Integer StepElement_MeasureOrUnspecifiedValue::CaseMem (const Handle(StepData_SelectMember)& ent) const
55 {
56  if(ent.IsNull()) return 0;
57  if(ent->Matches(aCDM)) return 1;
58  else if(ent->Matches(anUV)) return 2;
59  else return 0;
60 }
61
62 //=======================================================================
63 //function : NewMember
64 //purpose  : 
65 //=======================================================================
66
67 Handle(StepData_SelectMember) StepElement_MeasureOrUnspecifiedValue::NewMember() const
68 {
69  return new StepElement_MeasureOrUnspecifiedValueMember;
70 }
71
72 //=======================================================================
73 //function : SetContextDependentMeasure
74 //purpose  : 
75 //=======================================================================
76
77 void StepElement_MeasureOrUnspecifiedValue::SetContextDependentMeasure (const Standard_Real val)
78 {
79   Handle(StepElement_MeasureOrUnspecifiedValueMember) SelMem = Handle(StepElement_MeasureOrUnspecifiedValueMember)::DownCast(Value());
80   if(SelMem.IsNull()) return;
81  Handle(TCollection_HAsciiString) name = new TCollection_HAsciiString("CONTEXT_DEPENDENT_MEASURE");
82  SelMem->SetName(name->ToCString());
83  SelMem->SetReal(val);
84 }
85
86 //=======================================================================
87 //function : ContextDependentMeasure
88 //purpose  : 
89 //=======================================================================
90
91 Standard_Real StepElement_MeasureOrUnspecifiedValue::ContextDependentMeasure () const
92 {
93   Handle(StepElement_MeasureOrUnspecifiedValueMember) SelMem = Handle(StepElement_MeasureOrUnspecifiedValueMember)::DownCast(Value());
94   if(SelMem.IsNull()) return 0;
95  Handle(TCollection_HAsciiString) name = new TCollection_HAsciiString;
96  name->AssignCat(SelMem->Name());
97  Handle(TCollection_HAsciiString) nameitem = new TCollection_HAsciiString("CONTEXT_DEPENDENT_MEASURE");
98  if(name->IsDifferent(nameitem)) return 0;
99  Standard_Real val = SelMem->Real();
100  return val;
101 }
102
103 //=======================================================================
104 //function : SetUnspecifiedValue
105 //purpose  : 
106 //=======================================================================
107
108 void StepElement_MeasureOrUnspecifiedValue::SetUnspecifiedValue (const StepElement_UnspecifiedValue val)
109 {
110   Handle(StepElement_MeasureOrUnspecifiedValueMember) SelMem = Handle(StepElement_MeasureOrUnspecifiedValueMember)::DownCast(Value());
111   if(SelMem.IsNull()) return;
112  Handle(TCollection_HAsciiString) name = new TCollection_HAsciiString("UNSPECIFIED_VALUE");
113  SelMem->SetName(name->ToCString());
114  SelMem->SetEnum((Standard_Integer)val);
115 }
116
117 //=======================================================================
118 //function : UnspecifiedValue
119 //purpose  : 
120 //=======================================================================
121
122 StepElement_UnspecifiedValue StepElement_MeasureOrUnspecifiedValue::UnspecifiedValue () const
123 {
124   Handle(StepElement_MeasureOrUnspecifiedValueMember) SelMem = Handle(StepElement_MeasureOrUnspecifiedValueMember)::DownCast(Value());
125   if(SelMem.IsNull()) return StepElement_Unspecified;
126  Handle(TCollection_HAsciiString) name = new TCollection_HAsciiString;
127  name->AssignCat(SelMem->Name());
128  Handle(TCollection_HAsciiString) nameitem = new TCollection_HAsciiString("UNSPECIFIED_VALUE");
129  if(name->IsDifferent(nameitem)) return StepElement_Unspecified;
130  Standard_Integer numit = SelMem->Enum();
131   StepElement_UnspecifiedValue val;
132  switch(numit) {
133     case 1 : val = StepElement_Unspecified; break;
134     default : return StepElement_Unspecified;break;
135   }
136  return val;
137 }