1 // Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 #ifndef _NMTTools_CommonBlockPool_HeaderFile
23 #define _NMTTools_CommonBlockPool_HeaderFile
25 #include <Basics_OCCTVersion.hxx>
27 #ifndef _Standard_Address_HeaderFile
28 #include <Standard_Address.hxx>
30 #ifndef _Standard_Integer_HeaderFile
31 #include <Standard_Integer.hxx>
33 #ifndef _Standard_Boolean_HeaderFile
34 #include <Standard_Boolean.hxx>
37 class Standard_OutOfRange;
38 class Standard_OutOfMemory;
39 class NMTTools_ListOfCommonBlock;
41 #ifndef _Standard_HeaderFile
42 #include <Standard.hxx>
44 #ifndef _Standard_Macro_HeaderFile
45 #include <Standard_Macro.hxx>
49 class NMTTools_CommonBlockPool {
53 void* operator new(size_t,void* anAddress)
57 void* operator new(size_t size)
59 return Standard::Allocate(size);
61 void operator delete(void *anAddress)
63 if (anAddress) Standard::Free((Standard_Address&)anAddress);
69 Standard_EXPORT NMTTools_CommonBlockPool(const Standard_Integer Length = 0,const Standard_Integer BlockLength = 5);
72 Standard_EXPORT void Resize(const Standard_Integer theNewLength) ;
75 Standard_EXPORT void Destroy() ;
76 ~NMTTools_CommonBlockPool()
83 Standard_EXPORT Standard_Integer Length() const;
86 Standard_EXPORT Standard_Integer Extent() const;
89 Standard_EXPORT Standard_Integer FactLength() const;
92 Standard_EXPORT Standard_Integer Append(const NMTTools_ListOfCommonBlock& Value) ;
95 Standard_EXPORT void Remove(const Standard_Integer Index) ;
98 Standard_EXPORT const NMTTools_ListOfCommonBlock& Value(const Standard_Integer Index) const;
99 const NMTTools_ListOfCommonBlock& operator ()(const Standard_Integer Index) const
106 Standard_EXPORT NMTTools_ListOfCommonBlock& ChangeValue(const Standard_Integer Index) ;
107 NMTTools_ListOfCommonBlock& operator ()(const Standard_Integer Index)
109 return ChangeValue(Index);
112 Standard_EXPORT void SetBlockLength(const Standard_Integer aBL) ;
113 Standard_EXPORT Standard_Integer BlockLength() const;
115 #if OCC_VERSION_LARGE > 0x06050200
116 Standard_EXPORT void Purge();
131 Standard_EXPORT NMTTools_CommonBlockPool(const NMTTools_CommonBlockPool& AnArray);
133 Standard_EXPORT NMTTools_CommonBlockPool& Assign(const NMTTools_CommonBlockPool& Other) ;
134 NMTTools_CommonBlockPool& operator =(const NMTTools_CommonBlockPool& Other)
136 return Assign(Other);
139 Standard_EXPORT Standard_Boolean IsInvalidIndex(const Standard_Integer Index) const;
143 Standard_Address myStart;
144 Standard_Integer myLength;
145 Standard_Integer myFactLength;
146 Standard_Integer myBlockLength;
147 Standard_Boolean myIsAllocated;
152 // other Inline functions and methods (like "C++: function call" methods)