0024002: Overall code and build procedure refactoring -- automatic
[occt.git] / src / IGESDefs / IGESDefs_AssociativityDef.cxx
1 // Created by: CKY / Contract Toubro-Larsen
2 // Copyright (c) 1993-1999 Matra Datavision
3 // Copyright (c) 1999-2014 OPEN CASCADE SAS
4 //
5 // This file is part of Open CASCADE Technology software library.
6 //
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.
12 //
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
15
16 //--------------------------------------------------------------------
17 //--------------------------------------------------------------------
18
19 #include <IGESBasic_HArray1OfHArray1OfInteger.hxx>
20 #include <IGESDefs_AssociativityDef.hxx>
21 #include <Standard_DimensionMismatch.hxx>
22 #include <Standard_OutOfRange.hxx>
23 #include <Standard_Type.hxx>
24
25 IGESDefs_AssociativityDef::IGESDefs_AssociativityDef ()    {  }
26
27
28     void  IGESDefs_AssociativityDef::Init
29   (const Handle(TColStd_HArray1OfInteger)& requirements,
30    const Handle(TColStd_HArray1OfInteger)& orders,
31    const Handle(TColStd_HArray1OfInteger)& numItems,
32    const Handle(IGESBasic_HArray1OfHArray1OfInteger)& items)
33 {
34   Standard_Integer len = requirements->Length();
35   if ( requirements->Lower() != 1 ||
36       (orders->Lower()       != 1 || orders->Length()   != len) ||
37       (numItems->Lower()     != 1 || numItems->Length() != len) ||
38       (items->Lower()        != 1 || items->Length()    != len) )
39     Standard_DimensionMismatch::Raise("IGESDefs_AssociativityDef : Init");
40
41   theBackPointerReqs = requirements;
42   theClassOrders     = orders;
43   theNbItemsPerClass = numItems;
44   theItems           = items;
45   InitTypeAndForm(302,FormNumber());
46 //  FormNumber is free over 5000
47 }
48
49     void IGESDefs_AssociativityDef::SetFormNumber (const Standard_Integer form)
50 {
51   InitTypeAndForm(302,form);
52 }
53
54     Standard_Integer  IGESDefs_AssociativityDef::NbClassDefs () const 
55 {
56   return theBackPointerReqs->Length();
57 }
58
59     Standard_Boolean  IGESDefs_AssociativityDef::IsBackPointerReq
60   (const Standard_Integer ClassNum) const 
61 {
62   return (theBackPointerReqs->Value(ClassNum) == 1);
63 //  1 True  2 False
64 }
65
66     Standard_Integer  IGESDefs_AssociativityDef::BackPointerReq
67   (const Standard_Integer ClassNum) const 
68 {
69   return theBackPointerReqs->Value(ClassNum);
70 }
71
72     Standard_Boolean  IGESDefs_AssociativityDef::IsOrdered
73   (const Standard_Integer ClassNum) const 
74 {
75   return (theClassOrders->Value(ClassNum) == 1);
76 //  1 True  2 False
77 }
78
79     Standard_Integer  IGESDefs_AssociativityDef::ClassOrder
80   (const Standard_Integer ClassNum) const 
81 {
82   return theClassOrders->Value(ClassNum);
83 }
84
85     Standard_Integer  IGESDefs_AssociativityDef::NbItemsPerClass
86   (const Standard_Integer ClassNum) const 
87 {
88   return theNbItemsPerClass->Value(ClassNum);
89 }
90
91     Standard_Integer  IGESDefs_AssociativityDef::Item
92   (const Standard_Integer ClassNum, const Standard_Integer ItemNum) const 
93 {
94   return theItems->Value(ClassNum)->Value(ItemNum);
95 }