1 // Created on: 2000-05-18
2 // Created by: Peter KURNEV
3 // Copyright (c) 2000-2014 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 #ifndef _IntTools_CArray1OfInteger_HeaderFile
17 #define _IntTools_CArray1OfInteger_HeaderFile
19 #include <Standard.hxx>
20 #include <Standard_DefineAlloc.hxx>
21 #include <Standard_Handle.hxx>
23 #include <Standard_Address.hxx>
24 #include <Standard_Integer.hxx>
25 #include <Standard_Boolean.hxx>
26 class Standard_ConstructionError;
27 class Standard_OutOfRange;
28 class Standard_OutOfMemory;
32 class IntTools_CArray1OfInteger
40 //! Creates an array of given Length.
41 Standard_EXPORT IntTools_CArray1OfInteger(const Standard_Integer Length = 0);
44 //! Creates an array sharing datas with an other.
47 //! CArray1OfItem thetab (tab[0],100);
49 //! CArray1OfItem aArray1(100);
50 //! CArray1OfItem anSharedArray1(aArray1.ChangeValue(0),aArray1.Length());
53 //! The validity of length are under the responsibility
55 //! The sahred array must have a valid address during the life of
57 Standard_EXPORT IntTools_CArray1OfInteger(const Standard_Integer& Item, const Standard_Integer Length);
60 //! Initializes the array with a given value.
61 Standard_EXPORT void Init (const Standard_Integer& V);
64 //! destroy current content and realloc the new size
65 //! does nothing if Length() == theLength
66 Standard_EXPORT void Resize (const Standard_Integer theNewLength);
69 //! Frees the allocated area corresponding to the
71 Standard_EXPORT void Destroy();
72 ~IntTools_CArray1OfInteger()
78 //! Returns the number of elements of <me>.
79 Standard_Integer Length() const;
81 Standard_EXPORT void Append (const Standard_Integer& Value);
84 //! Sets the <Index>th element of the array to
86 Standard_EXPORT void SetValue (const Standard_Integer Index, const Standard_Integer& Value);
89 //! Returns the value of the <Index>th element of the
91 Standard_EXPORT const Standard_Integer& Value (const Standard_Integer Index) const;
92 const Standard_Integer& operator () (const Standard_Integer Index) const
98 //! Returns the value of the <Index>th element of the
100 Standard_EXPORT Standard_Integer& ChangeValue (const Standard_Integer Index);
101 Standard_Integer& operator () (const Standard_Integer Index)
103 return ChangeValue(Index);
107 //! Applyies the == operator on each array item
108 Standard_EXPORT Standard_Boolean IsEqual (const IntTools_CArray1OfInteger& Other) const;
109 Standard_Boolean operator == (const IntTools_CArray1OfInteger& Other) const
111 return IsEqual(Other);
127 //! Prohibits the creator by copy
128 Standard_EXPORT IntTools_CArray1OfInteger(const IntTools_CArray1OfInteger& AnArray);
131 Standard_Address myStart;
132 Standard_Integer myLength;
133 Standard_Boolean myIsAllocated;
138 #define Array1Item Standard_Integer
139 #define Array1Item_hxx <Standard_Integer.hxx>
140 #define IntTools_CArray1 IntTools_CArray1OfInteger
141 #define IntTools_CArray1_hxx <IntTools_CArray1OfInteger.hxx>
143 #include <IntTools_CArray1.lxx>
146 #undef Array1Item_hxx
147 #undef IntTools_CArray1
148 #undef IntTools_CArray1_hxx
153 #endif // _IntTools_CArray1OfInteger_HeaderFile