0023024: Update headers of OCCT files
[occt.git] / src / IGESDefs / IGESDefs_AttributeTable.cxx
CommitLineData
b311480e 1// Created by: CKY / Contract Toubro-Larsen
2// Copyright (c) 1993-1999 Matra Datavision
3// Copyright (c) 1999-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.
7fd59977 9//
b311480e 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.
7fd59977 12//
b311480e 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//--------------------------------------------------------------------
7fd59977 21//--------------------------------------------------------------------
22
23#include <IGESDefs_AttributeTable.ixx>
24#include <Standard_DimensionMismatch.hxx>
25#include <TColStd_HArray1OfReal.hxx>
26#include <TColStd_HArray1OfInteger.hxx>
27#include <Interface_HArray1OfHAsciiString.hxx>
28#include <IGESData_HArray1OfIGESEntity.hxx>
29#include <IGESDefs_AttributeDef.hxx>
30#include <TCollection_HAsciiString.hxx>
31#include <Interface_Macros.hxx>
32
33
34// ATTENTION ATTENTION : L Appellation "ROW" n est pas reconduite en l etat
35// Le Numero d Attribut est donne en 1er (donc, en colonne du HArray2 et non
36// en ligne), le numero de Colonne en 2e (donc, comme un numero de Ligne)
37
38
b311480e 39IGESDefs_AttributeTable::IGESDefs_AttributeTable () { }
7fd59977 40
41
42 void IGESDefs_AttributeTable::Init
43 (const Handle(TColStd_HArray2OfTransient)& attributes)
44{
45 if (attributes->LowerCol() != 1 || attributes->LowerRow() != 1)
46 Standard_DimensionMismatch::Raise("IGESDefs_AttributeTable : Init");
47 theAttributes = attributes;
48
49 Standard_Integer fn = FormNumber();
50 if (attributes->UpperCol() > 1) fn = 1;
51 else if (fn < 0 || fn > 1) fn = 0;
52 InitTypeAndForm(422,fn);
53// FormNumber : 0 SingleRow, 1 MultipleRows (can be reduced to one ...)
54}
55
56 void IGESDefs_AttributeTable::SetDefinition
57 (const Handle(IGESDefs_AttributeDef)& def)
58{
59 InitMisc (def,LabelDisplay(),LineWeightNumber());
60}
61
62 Handle(IGESDefs_AttributeDef) IGESDefs_AttributeTable::Definition () const
63{
64 return GetCasted(IGESDefs_AttributeDef,Structure());
65}
66
67
68 Standard_Integer IGESDefs_AttributeTable::NbRows () const
69{
70 return theAttributes->UpperCol();
71}
72
73 Standard_Integer IGESDefs_AttributeTable::NbAttributes () const
74{
75 return theAttributes->UpperRow();
76}
77
78 Standard_Integer IGESDefs_AttributeTable::DataType
79 (const Standard_Integer Atnum) const
80{
81 return Definition()->AttributeType(Atnum);
82}
83
84 Standard_Integer IGESDefs_AttributeTable::ValueCount
85 (const Standard_Integer Atnum) const
86{
87 return Definition()->AttributeValueCount(Atnum);
88}
89
90 Handle(Standard_Transient) IGESDefs_AttributeTable::AttributeList
91 (const Standard_Integer Atnum, const Standard_Integer Rownum) const
92{
93 return theAttributes->Value(Atnum,Rownum);
94}
95
96 Standard_Integer IGESDefs_AttributeTable::AttributeAsInteger
97 (const Standard_Integer Atnum, const Standard_Integer Rownum,
98 const Standard_Integer Valuenum) const
99{
100 return GetCasted(TColStd_HArray1OfInteger,theAttributes->Value(Atnum,Rownum))
101 ->Value(Valuenum);
102}
103
104 Standard_Real IGESDefs_AttributeTable::AttributeAsReal
105 (const Standard_Integer Atnum, const Standard_Integer Rownum,
106 const Standard_Integer Valuenum) const
107{
108 return GetCasted(TColStd_HArray1OfReal,theAttributes->Value(Atnum,Rownum))
109 ->Value(Valuenum);
110}
111
112 Handle(TCollection_HAsciiString) IGESDefs_AttributeTable::AttributeAsString
113 (const Standard_Integer Atnum, const Standard_Integer Rownum,
114 const Standard_Integer Valuenum) const
115{
116 return GetCasted(Interface_HArray1OfHAsciiString,theAttributes->Value(Atnum,Rownum))
117 ->Value(Valuenum);
118}
119
120 Handle(IGESData_IGESEntity) IGESDefs_AttributeTable::AttributeAsEntity
121 (const Standard_Integer Atnum, const Standard_Integer Rownum,
122 const Standard_Integer Valuenum) const
123{
124 return GetCasted(IGESData_HArray1OfIGESEntity,theAttributes->Value(Atnum,Rownum))
125 ->Value(Valuenum);
126}
127
128 Standard_Boolean IGESDefs_AttributeTable::AttributeAsLogical
129 (const Standard_Integer Atnum, const Standard_Integer Rownum,
130 const Standard_Integer Valuenum) const
131{
132 return (AttributeAsInteger(Atnum,Rownum,Valuenum) != 0); // raccourci
133}