0031642: Visualization - crash in Graphic3d_Structure::SetVisual() on redisplaying...
[occt.git] / src / TCollection / TCollection_Array2.lxx
1 // Copyright (c) 1998-1999 Matra Datavision
2 // Copyright (c) 1999-2014 OPEN CASCADE SAS
3 //
4 // This file is part of Open CASCADE Technology software library.
5 //
6 // This library is free software; you can redistribute it and/or modify it under
7 // the terms of the GNU Lesser General Public License version 2.1 as published
8 // by the Free Software Foundation, with special exception defined in the file
9 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
10 // distribution for complete text of the license and disclaimer of any warranty.
11 //
12 // Alternatively, this file may be used under the terms of Open CASCADE
13 // commercial license or contractual agreement.
14
15 #include <Standard.hxx>
16 #include <Standard_OutOfRange.hxx>
17
18 #include Array2Item_hxx
19
20 //=======================================================================
21 //function : ColLength
22 //purpose  : 
23 //=======================================================================
24 inline Standard_Integer TCollection_Array2::ColLength () const
25 {
26         return myUpperRow - myLowerRow + 1 ;
27 }
28
29 //=======================================================================
30 //function : LowerCol
31 //purpose  : 
32 //=======================================================================
33 inline Standard_Integer TCollection_Array2::LowerCol () const
34 {
35         return myLowerColumn ;
36 }
37
38 //=======================================================================
39 //function : LowerRow
40 //purpose  : 
41 //=======================================================================
42 inline Standard_Integer TCollection_Array2::LowerRow () const
43 {
44         return myLowerRow;
45 }
46
47 //=======================================================================
48 //function : RowLength
49 //purpose  : 
50 //=======================================================================
51 inline Standard_Integer TCollection_Array2::RowLength () const
52 {
53         return myUpperColumn - myLowerColumn + 1 ;
54 }
55
56 //=======================================================================
57 //function : UpperRow
58 //purpose  : 
59 //=======================================================================
60 inline Standard_Integer TCollection_Array2::UpperRow () const
61 {
62         return myUpperRow ;
63 }
64
65 //=======================================================================
66 //function : UpperCol
67 //purpose  : 
68 //=======================================================================
69 inline Standard_Integer TCollection_Array2::UpperCol () const
70 {
71         return myUpperColumn ;
72 }
73
74 //=======================================================================
75 //function : SetValue
76 //purpose  : 
77 //=======================================================================
78
79 inline void TCollection_Array2::SetValue ( const Standard_Integer Row,
80                                     const Standard_Integer Col,
81                                     const Array2Item& Value )
82 {
83   Standard_OutOfRange_Raise_if((Row < myLowerRow || Row > myUpperRow ||
84                                 Col < myLowerColumn || Col > myUpperColumn),
85                                NULL);
86
87   ((Array2Item **)myData)[Row][Col] = Value ;
88 }
89
90 //=======================================================================
91 //function : Value
92 //purpose  : 
93 //=======================================================================
94 inline const Array2Item& TCollection_Array2::Value(const Standard_Integer Row,
95                                             const Standard_Integer Col) const
96 {
97   Standard_OutOfRange_Raise_if((Row < myLowerRow || Row > myUpperRow ||
98                                 Col < myLowerColumn || Col > myUpperColumn),
99                                NULL);
100
101   return ((Array2Item **)myData)[Row][Col];
102
103
104 //=======================================================================
105 //function : ChangeValue
106 //purpose  : 
107 //=======================================================================
108
109 inline Array2Item& TCollection_Array2::ChangeValue(const Standard_Integer Row,
110                                             const Standard_Integer Col)
111 {
112   Standard_OutOfRange_Raise_if((Row < myLowerRow || Row > myUpperRow ||
113                                 Col < myLowerColumn || Col > myUpperColumn),
114                                NULL);
115
116   return ((Array2Item **)myData)[Row][Col];
117
118
119
120