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