Salome HOME
CMake porting.
[modules/geom.git] / src / NMTTools / NMTTools_CommonBlockPool.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:        NMTTools_CommonBlockPool.hxx
21 // Created:
22 // Author:      Peter KURNEV
23 //              <pkv@irinox>
24 //
25
26 #ifndef _NMTTools_CommonBlockPool_HeaderFile
27 #define _NMTTools_CommonBlockPool_HeaderFile
28
29 #include <Standard.hxx>
30 #include <Standard_Macro.hxx>
31 #include <Standard_Address.hxx>
32 #include <Standard_Integer.hxx>
33 #include <Standard_Boolean.hxx>
34 #include <NMTTools_ListOfCommonBlock.hxx>
35
36 class Standard_OutOfRange;
37 class Standard_OutOfMemory;
38
39
40
41 //=======================================================================
42 //class : NMTTools_CommonBlockPool
43 //purpose  :
44 //=======================================================================
45 class NMTTools_CommonBlockPool
46 {
47  public:
48   Standard_EXPORT
49     NMTTools_CommonBlockPool(const Standard_Integer Length = 0,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   ~NMTTools_CommonBlockPool() {
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 NMTTools_ListOfCommonBlock& Value) ;
72
73   Standard_EXPORT
74     void Remove(const Standard_Integer Index) ;
75
76   Standard_EXPORT
77     const NMTTools_ListOfCommonBlock& Value(const Standard_Integer Index) const;
78
79   const NMTTools_ListOfCommonBlock& operator ()(const Standard_Integer Index) const {
80     return Value(Index);
81   }
82
83   Standard_EXPORT
84     NMTTools_ListOfCommonBlock& ChangeValue(const Standard_Integer Index) ;
85
86   NMTTools_ListOfCommonBlock& 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 protected:
100
101 private:
102   Standard_EXPORT
103     NMTTools_CommonBlockPool(const NMTTools_CommonBlockPool& AnArray);
104
105   Standard_EXPORT
106     NMTTools_CommonBlockPool& Assign(const NMTTools_CommonBlockPool& Other) ;
107
108   NMTTools_CommonBlockPool& operator =(const NMTTools_CommonBlockPool& Other) {
109     return Assign(Other);
110   }
111
112   Standard_EXPORT
113     Standard_Boolean IsInvalidIndex(const Standard_Integer Index) const;
114
115
116   Standard_Address myStart;
117   Standard_Integer myLength;
118   Standard_Integer myFactLength;
119   Standard_Integer myBlockLength;
120   Standard_Boolean myIsAllocated;
121 };
122 #endif