Salome HOME
Merge from V6_main 01/04/2013
[modules/geom.git] / src / NMTDS / NMTDS_CArray1OfIndexRange.hxx
1 // Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 // File:        NMTDS_BndSphere.hxx
21 // Created:     
22 // Author:      Peter KURNEV
23 //              <pkv@irinox>
24
25 #ifndef _NMTDS_CArray1OfIndexRange_HeaderFile
26 #define _NMTDS_CArray1OfIndexRange_HeaderFile
27
28 #include <Standard.hxx>
29 #include <Standard_Macro.hxx>
30 #include <Standard_Address.hxx>
31 #include <Standard_Integer.hxx>
32 #include <Standard_Boolean.hxx>
33 #include <NMTDS_IndexRange.hxx>
34
35 class Standard_OutOfRange;
36 class Standard_OutOfMemory;
37
38
39
40 //=======================================================================
41 //function : NMTDS_CArray1OfIndexRange
42 //purpose  : 
43 //=======================================================================
44 class NMTDS_CArray1OfIndexRange  {
45  public:
46
47   Standard_EXPORT
48     NMTDS_CArray1OfIndexRange(const Standard_Integer Length = 0,
49                               const Standard_Integer BlockLength = 5);
50   
51   Standard_EXPORT   
52     void Resize(const Standard_Integer theNewLength) ;
53   
54   Standard_EXPORT     
55     void Destroy() ;
56
57   ~NMTDS_CArray1OfIndexRange() {
58     Destroy();
59   }
60   
61   Standard_EXPORT
62     Standard_Integer Length() const;
63   
64   Standard_EXPORT
65     Standard_Integer Extent() const;
66   
67   Standard_EXPORT
68     Standard_Integer FactLength() const;
69   
70   Standard_EXPORT
71     Standard_Integer Append(const NMTDS_IndexRange& Value) ;
72   
73   Standard_EXPORT
74     void Remove(const Standard_Integer Index) ;
75   
76   Standard_EXPORT
77     const NMTDS_IndexRange& Value(const Standard_Integer Index) const;
78    
79   const NMTDS_IndexRange& operator ()(const Standard_Integer Index) const {
80     return Value(Index);
81   }
82   
83   Standard_EXPORT
84     NMTDS_IndexRange& ChangeValue(const Standard_Integer Index) ;
85
86     NMTDS_IndexRange& operator ()(const Standard_Integer Index) {
87       return ChangeValue(Index);
88     }
89   
90   Standard_EXPORT
91     void SetBlockLength(const Standard_Integer aBL) ;
92   
93   Standard_EXPORT
94     Standard_Integer BlockLength() const;
95   
96   Standard_EXPORT
97     void Purge() ;
98
99  private:
100   Standard_EXPORT
101     NMTDS_CArray1OfIndexRange(const NMTDS_CArray1OfIndexRange& AnArray);
102   
103   Standard_EXPORT
104     NMTDS_CArray1OfIndexRange& Assign(const NMTDS_CArray1OfIndexRange& Other) ;
105   
106   NMTDS_CArray1OfIndexRange& operator =(const NMTDS_CArray1OfIndexRange& Other) {
107     return Assign(Other);
108   }
109   
110   Standard_EXPORT
111     Standard_Boolean IsInvalidIndex(const Standard_Integer Index) const;
112
113
114   Standard_Address myStart;
115   Standard_Integer myLength;
116   Standard_Integer myFactLength;
117   Standard_Integer myBlockLength;
118   Standard_Boolean myIsAllocated;
119 };
120
121 #endif