0030675: Visualization - remove redundant proxy classes in hierarchy of PrsMgr_Presen...
[occt.git] / src / IntTools / IntTools_CArray1OfInteger.hxx
CommitLineData
42cf5bc1 1// Created on: 2000-05-18
2// Created by: Peter KURNEV
3// Copyright (c) 2000-2014 OPEN CASCADE SAS
4//
5// This file is part of Open CASCADE Technology software library.
6//
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.
12//
13// Alternatively, this file may be used under the terms of Open CASCADE
14// commercial license or contractual agreement.
15
16#ifndef _IntTools_CArray1OfInteger_HeaderFile
17#define _IntTools_CArray1OfInteger_HeaderFile
18
19#include <Standard.hxx>
20#include <Standard_DefineAlloc.hxx>
21#include <Standard_Handle.hxx>
22
23#include <Standard_Address.hxx>
24#include <Standard_Integer.hxx>
25#include <Standard_Boolean.hxx>
26class Standard_ConstructionError;
27class Standard_OutOfRange;
28class Standard_OutOfMemory;
29
30
31
32class IntTools_CArray1OfInteger
33{
34public:
35
36 DEFINE_STANDARD_ALLOC
37
38
36b9ff75 39
40 //! Creates an array of given Length.
42cf5bc1 41 Standard_EXPORT IntTools_CArray1OfInteger(const Standard_Integer Length = 0);
42
36b9ff75 43
44 //! Creates an array sharing datas with an other.
45 //! Example:
46 //! Item tab[100];
47 //! CArray1OfItem thetab (tab[0],100);
48 //!
49 //! CArray1OfItem aArray1(100);
50 //! CArray1OfItem anSharedArray1(aArray1.ChangeValue(0),aArray1.Length());
51 //!
52 //! Warning:
53 //! The validity of length are under the responsability
54 //! of the user.
55 //! The sahred array must have a valid address during the life of
56 //! the Array1.
42cf5bc1 57 Standard_EXPORT IntTools_CArray1OfInteger(const Standard_Integer& Item, const Standard_Integer Length);
58
36b9ff75 59
60 //! Initializes the array with a given value.
42cf5bc1 61 Standard_EXPORT void Init (const Standard_Integer& V);
62
36b9ff75 63
64 //! destroy current content and realloc the new size
65 //! does nothing if Length() == theLength
42cf5bc1 66 Standard_EXPORT void Resize (const Standard_Integer theNewLength);
67
36b9ff75 68
69 //! Frees the allocated area corresponding to the
70 //! array.
42cf5bc1 71 Standard_EXPORT void Destroy();
72~IntTools_CArray1OfInteger()
73{
74 Destroy();
75}
76
36b9ff75 77
78 //! Returns the number of elements of <me>.
42cf5bc1 79 Standard_Integer Length() const;
80
81 Standard_EXPORT void Append (const Standard_Integer& Value);
82
36b9ff75 83
84 //! Sets the <Index>th element of the array to
85 //! <Value>.
42cf5bc1 86 Standard_EXPORT void SetValue (const Standard_Integer Index, const Standard_Integer& Value);
87
36b9ff75 88
89 //! Returns the value of the <Index>th element of the
90 //! array.
42cf5bc1 91 Standard_EXPORT const Standard_Integer& Value (const Standard_Integer Index) const;
92const Standard_Integer& operator () (const Standard_Integer Index) const
93{
94 return Value(Index);
95}
96
36b9ff75 97
98 //! Returns the value of the <Index>th element of the
99 //! array.
42cf5bc1 100 Standard_EXPORT Standard_Integer& ChangeValue (const Standard_Integer Index);
101Standard_Integer& operator () (const Standard_Integer Index)
102{
103 return ChangeValue(Index);
104}
105
36b9ff75 106
107 //! Applys the == operator on each array item
42cf5bc1 108 Standard_EXPORT Standard_Boolean IsEqual (const IntTools_CArray1OfInteger& Other) const;
109Standard_Boolean operator == (const IntTools_CArray1OfInteger& Other) const
110{
111 return IsEqual(Other);
112}
113
114
115
116
117protected:
118
119
120
121
122
123private:
124
125
36b9ff75 126
127 //! Prohibits the creator by copy
42cf5bc1 128 Standard_EXPORT IntTools_CArray1OfInteger(const IntTools_CArray1OfInteger& AnArray);
129
130
131 Standard_Address myStart;
132 Standard_Integer myLength;
133 Standard_Boolean myIsAllocated;
134
135
136};
137
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>
142
143#include <IntTools_CArray1.lxx>
144
145#undef Array1Item
146#undef Array1Item_hxx
147#undef IntTools_CArray1
148#undef IntTools_CArray1_hxx
149
150
151
152
153#endif // _IntTools_CArray1OfInteger_HeaderFile