1 // Created by: CKY / Contract Toubro-Larsen
2 // Copyright (c) 1993-1999 Matra Datavision
3 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 //--------------------------------------------------------------------
17 //--------------------------------------------------------------------
18 // rln 11.05.2000 BUC60660
20 #include <IGESData_HArray1OfIGESEntity.hxx>
21 #include <IGESData_IGESEntity.hxx>
22 #include <IGESDefs_GenericData.hxx>
23 #include <Interface_HArray1OfHAsciiString.hxx>
24 #include <Interface_Macros.hxx>
25 #include <Standard_DimensionMismatch.hxx>
26 #include <Standard_NullObject.hxx>
27 #include <Standard_OutOfRange.hxx>
28 #include <Standard_Transient.hxx>
29 #include <Standard_Type.hxx>
30 #include <TCollection_HAsciiString.hxx>
31 #include <TColStd_HArray1OfReal.hxx>
33 IMPLEMENT_STANDARD_RTTIEXT(IGESDefs_GenericData,IGESData_IGESEntity)
35 IGESDefs_GenericData::IGESDefs_GenericData () { }
38 void IGESDefs_GenericData::Init
39 (const Standard_Integer nbPropVal,
40 const Handle(TCollection_HAsciiString)& aName,
41 const Handle(TColStd_HArray1OfInteger)& allTypes,
42 const Handle(TColStd_HArray1OfTransient)& allValues)
44 // rln May 11, 2000 BUC60660
45 // Number of TYPE/VALUE pairs is 0 and arrays are null handles,
46 // this caused exception
47 if ( !allTypes.IsNull() && !allValues.IsNull() &&
48 (allValues->Lower() != 1 || allTypes->Lower() != 1 ||
49 allTypes->Length() != allValues->Length() ) )
50 throw Standard_DimensionMismatch("IGESDefs_GenericData: Init");
51 theNbPropertyValues = nbPropVal;
54 theValues = allValues;
55 InitTypeAndForm(406,27);
58 Standard_Integer IGESDefs_GenericData::NbPropertyValues () const
60 // return 2 * theTypes->Length() + 2;
61 return theNbPropertyValues;
64 Handle(TCollection_HAsciiString) IGESDefs_GenericData::Name () const
69 Standard_Integer IGESDefs_GenericData::NbTypeValuePairs () const
71 return theTypes->Length();
74 Standard_Integer IGESDefs_GenericData::Type (const Standard_Integer Index) const
76 return theTypes->Value(Index);
79 Handle(Standard_Transient) IGESDefs_GenericData::Value
80 (const Standard_Integer Index) const
82 return theValues->Value(Index);
85 Standard_Integer IGESDefs_GenericData::ValueAsInteger
86 (const Standard_Integer Index) const
88 return GetCasted(TColStd_HArray1OfInteger,theValues->Value(Index))->Value(1);
91 Standard_Real IGESDefs_GenericData::ValueAsReal
92 (const Standard_Integer Index) const
94 return GetCasted(TColStd_HArray1OfReal,theValues->Value(Index))->Value(1);
97 Handle(TCollection_HAsciiString) IGESDefs_GenericData::ValueAsString
98 (const Standard_Integer Index) const
100 return GetCasted(TCollection_HAsciiString,theValues->Value(Index));
103 Handle(IGESData_IGESEntity) IGESDefs_GenericData::ValueAsEntity
104 (const Standard_Integer Index) const
106 return GetCasted(IGESData_IGESEntity,theValues->Value(Index));
109 Standard_Boolean IGESDefs_GenericData::ValueAsLogical
110 (const Standard_Integer Index) const
112 return (GetCasted(TColStd_HArray1OfInteger,theValues->Value(Index))->Value(1)