Back to index

salome-geom  6.5.0
NMTTools_CommonBlockPool.hxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // This library is free software; you can redistribute it and/or
00004 // modify it under the terms of the GNU Lesser General Public
00005 // License as published by the Free Software Foundation; either
00006 // version 2.1 of the License.
00007 //
00008 // This library is distributed in the hope that it will be useful,
00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011 // Lesser General Public License for more details.
00012 //
00013 // You should have received a copy of the GNU Lesser General Public
00014 // License along with this library; if not, write to the Free Software
00015 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00016 //
00017 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00018 //
00019 
00020 // File:        NMTTools_CommonBlockPool.hxx
00021 // Created:
00022 // Author:      Peter KURNEV
00023 //              <pkv@irinox>
00024 //
00025 
00026 #ifndef _NMTTools_CommonBlockPool_HeaderFile
00027 #define _NMTTools_CommonBlockPool_HeaderFile
00028 
00029 #include <Standard.hxx>
00030 #include <Standard_Macro.hxx>
00031 #include <Standard_Address.hxx>
00032 #include <Standard_Integer.hxx>
00033 #include <Standard_Boolean.hxx>
00034 #include <NMTTools_ListOfCommonBlock.hxx>
00035 
00036 class Standard_OutOfRange;
00037 class Standard_OutOfMemory;
00038 
00039 
00040 
00041 //=======================================================================
00042 //class : NMTTools_CommonBlockPool
00043 //purpose  :
00044 //=======================================================================
00045 class NMTTools_CommonBlockPool
00046 {
00047  public:
00048   Standard_EXPORT
00049     NMTTools_CommonBlockPool(const Standard_Integer Length = 0,const Standard_Integer BlockLength = 5);
00050 
00051   Standard_EXPORT
00052     void Resize(const Standard_Integer theNewLength) ;
00053 
00054   Standard_EXPORT
00055     void Destroy() ;
00056 
00057   ~NMTTools_CommonBlockPool() {
00058     Destroy();
00059   }
00060 
00061   Standard_EXPORT
00062     Standard_Integer Length() const;
00063 
00064   Standard_EXPORT
00065     Standard_Integer Extent() const;
00066 
00067   Standard_EXPORT
00068     Standard_Integer FactLength() const;
00069 
00070   Standard_EXPORT
00071     Standard_Integer Append(const NMTTools_ListOfCommonBlock& Value) ;
00072 
00073   Standard_EXPORT
00074     void Remove(const Standard_Integer Index) ;
00075 
00076   Standard_EXPORT
00077     const NMTTools_ListOfCommonBlock& Value(const Standard_Integer Index) const;
00078 
00079   const NMTTools_ListOfCommonBlock& operator ()(const Standard_Integer Index) const {
00080     return Value(Index);
00081   }
00082 
00083   Standard_EXPORT
00084     NMTTools_ListOfCommonBlock& ChangeValue(const Standard_Integer Index) ;
00085 
00086   NMTTools_ListOfCommonBlock& operator ()(const Standard_Integer Index) {
00087     return ChangeValue(Index);
00088   }
00089 
00090   Standard_EXPORT
00091     void SetBlockLength(const Standard_Integer aBL) ;
00092 
00093   Standard_EXPORT
00094     Standard_Integer BlockLength() const;
00095 
00096   Standard_EXPORT
00097     void Purge() ;
00098 
00099 protected:
00100 
00101 private:
00102   Standard_EXPORT
00103     NMTTools_CommonBlockPool(const NMTTools_CommonBlockPool& AnArray);
00104 
00105   Standard_EXPORT
00106     NMTTools_CommonBlockPool& Assign(const NMTTools_CommonBlockPool& Other) ;
00107 
00108   NMTTools_CommonBlockPool& operator =(const NMTTools_CommonBlockPool& Other) {
00109     return Assign(Other);
00110   }
00111 
00112   Standard_EXPORT
00113     Standard_Boolean IsInvalidIndex(const Standard_Integer Index) const;
00114 
00115 
00116   Standard_Address myStart;
00117   Standard_Integer myLength;
00118   Standard_Integer myFactLength;
00119   Standard_Integer myBlockLength;
00120   Standard_Boolean myIsAllocated;
00121 };
00122 #endif