1 a.dunfey 1.24.18.1 //%2006////////////////////////////////////////////////////////////////////////
|
2 mike 1.5 //
|
3 karl 1.23 // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
4 // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
5 // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
|
6 karl 1.20 // IBM Corp.; EMC Corporation, The Open Group.
|
7 karl 1.23 // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
8 // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
|
9 karl 1.24 // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
10 // EMC Corporation; VERITAS Software Corporation; The Open Group.
|
11 a.dunfey 1.24.18.1 // Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
12 // EMC Corporation; Symantec Corporation; The Open Group.
|
13 mike 1.5 //
14 // Permission is hereby granted, free of charge, to any person obtaining a copy
|
15 kumpf 1.12 // of this software and associated documentation files (the "Software"), to
16 // deal in the Software without restriction, including without limitation the
17 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
18 mike 1.5 // sell copies of the Software, and to permit persons to whom the Software is
19 // furnished to do so, subject to the following conditions:
20 //
|
21 kumpf 1.12 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
|
22 mike 1.5 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
23 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
|
24 kumpf 1.12 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
25 // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
26 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
27 mike 1.5 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29 //
30 //==============================================================================
31 //
32 //%/////////////////////////////////////////////////////////////////////////////
33
|
34 kumpf 1.11 // Only include if not included as general template or if explicit instantiation
35 #if !defined(Pegasus_ArrayInter_h) || defined(PEGASUS_ARRAY_T)
36 #if !defined(PEGASUS_ARRAY_T)
37 #define Pegasus_ArrayInter_h
38 #endif
|
39 mike 1.5
|
40 kumpf 1.16 #include <Pegasus/Common/Linkage.h>
41
|
42 kumpf 1.19 #ifndef PEGASUS_ARRAY_T
43 /** This class is used to represent arrays of intrinsic data types in CIM.
|
44 mike 1.5 */
|
45 kumpf 1.11 template<class PEGASUS_ARRAY_T> class Array
|
46 mike 1.5 #else
|
47 kumpf 1.11 PEGASUS_TEMPLATE_SPECIALIZATION class PEGASUS_COMMON_LINKAGE Array<PEGASUS_ARRAY_T>
|
48 mike 1.5 #endif
49 {
50 public:
51
|
52 karl 1.21 /** Constructs an array object with null values (default constructor).
53 */
|
54 mike 1.5 Array();
55
|
56 karl 1.21 /** Creates a new Array object using the parameters and values in the Array object.
57 @param x Specifies the new Array object name.
58 */
|
59 mike 1.5 Array(const Array<PEGASUS_ARRAY_T>& x);
60
61 /** Constructs an array with size elements. The elements are
|
62 kumpf 1.11 initialized with their copy constructor.
|
63 karl 1.21 @param size Defines the number of elements.
|
64 mike 1.5 */
65 Array(Uint32 size);
66
67 /** Constructs an array with size elements. The elements are
|
68 karl 1.21 initialized with array x.
69 @param size Defines the number of elements.
70 @param x Specifies the new array object name.
|
71 mike 1.5 */
72 Array(Uint32 size, const PEGASUS_ARRAY_T& x);
73
74 /** Constructs an array with size elements. The values come from
|
75 kumpf 1.11 the items pointer.
|
76 karl 1.21 @param items References the values of the specified array.
77 @param size Uint32 representing how many elements are in the array.
|
78 mike 1.5 */
79 Array(const PEGASUS_ARRAY_T* items, Uint32 size);
80
|
81 karl 1.21 /**Destroys the objects, freeing any resources.
82 */
|
83 mike 1.5 ~Array();
84
|
85 karl 1.21 /**The values of one array object are assigned to another (assignment operator).
86 @param x Array object to assign the Array parameters to.
87 */
|
88 mike 1.5 Array<PEGASUS_ARRAY_T>& operator=(const Array<PEGASUS_ARRAY_T>& x);
89
90 /** Clears the contents of the array. After calling this, size()
|
91 kumpf 1.11 returns zero.
|
92 mike 1.5 */
93 void clear();
94
95 /** Reserves memory for capacity elements. Notice that this does not
|
96 kumpf 1.11 change the size of the array (size() returns what it did before).
97 If the capacity of the array is already greater or equal to the
|
98 kumpf 1.14 capacity argument, this method has no effect. After calling
99 reserveCapacity(), getCapacity() returns a value which is greater
100 or equal to the capacity argument.
|
101 karl 1.21 @param capacity Defines the size that is to be reserved
|
102 mike 1.5 */
|
103 kumpf 1.14 void reserveCapacity(Uint32 capacity);
|
104 mike 1.5
|
105 kumpf 1.19 /** Make the size of the array grow by size elements. The new size will
|
106 kumpf 1.11 be size() + size. The new elements (there are size of them) are
107 initialized with x.
|
108 karl 1.21 @param size Defines the number of elements by which the array is to
|
109 kumpf 1.11 grow.
|
110 mike 1.5 */
111 void grow(Uint32 size, const PEGASUS_ARRAY_T& x);
112
|
113 karl 1.21 /** Swaps the contents of two arrays. Array x references the original values in the Array object (y) and the values of the Array object (y) reference the original values of Array x.
114 */
|
115 mike 1.5 void swap(Array<PEGASUS_ARRAY_T>& x);
116
117 /** Returns the number of elements in the array.
|
118 karl 1.21 @return The number of elements in the array.
|
119 mike 1.5 */
|
120 kumpf 1.8 Uint32 size() const;
|
121 mike 1.5
|
122 karl 1.21 /** Returns the capacity of the array.
123 @return The capacity of the array.
124 */
|
125 kumpf 1.8 Uint32 getCapacity() const;
|
126 mike 1.5
|
127 karl 1.21 /** Returns a pointer to the first element of the array.
128 @return A pointer to the first element of the array.
129 */
|
130 kumpf 1.8 const PEGASUS_ARRAY_T* getData() const;
|
131 mike 1.5
|
132 kumpf 1.18 /** Returns the element indicated by the index argument.
133 @return A reference to the element defined by index so that it may be
|
134 kumpf 1.11 modified.
|
135 mike 1.5 */
|
136 kumpf 1.18 PEGASUS_ARRAY_T& operator[](Uint32 index);
|
137 mike 1.5
|
138 karl 1.21 /** Returns the element in the const array specified as the index argument. The return value cannot be modified since it
|
139 kumpf 1.11 is constant.
|
140 karl 1.21 @return A reference to the element defined by index but the reference cannot be modified.
|
141 mike 1.5 */
|
142 kumpf 1.18 const PEGASUS_ARRAY_T& operator[](Uint32 index) const;
|
143 mike 1.5
144 /** Appends an element to the end of the array. This increases the size
|
145 kumpf 1.11 of the array by one.
146 @param x Element to append.
|
147 mike 1.5 */
148 void append(const PEGASUS_ARRAY_T& x);
149
|
150 karl 1.21 /** Appends size elements at x to the end of this array.
151 @param size Uint32 value to append to the size of the array.
152 */
|
153 mike 1.5 void append(const PEGASUS_ARRAY_T* x, Uint32 size);
154
155 /** Appends one array to another. The size of this array grows by the
|
156 kumpf 1.11 size of the other.
|
157 karl 1.21 @param x Array to add to the appended array.
|
158 mike 1.5 */
|
159 kumpf 1.8 void appendArray(const Array<PEGASUS_ARRAY_T>& x);
|
160 mike 1.5
161 /** Appends one element to the beginning of the array. This increases
|
162 kumpf 1.11 the size by one.
|
163 karl 1.21 @param x The element to pre pend.
|
164 mike 1.5 */
165 void prepend(const PEGASUS_ARRAY_T& x);
166
167 /** Appends size elements to the array starting at the memory address
|
168 kumpf 1.11 given by x. The array grows by size elements.
|
169 karl 1.21 @param size Uint32 size to add to the array at address x.
170 @param x Specifies where to begin increasing size elements of the array.
|
171 mike 1.5 */
172 void prepend(const PEGASUS_ARRAY_T* x, Uint32 size);
173
174 /** Inserts the element at the given index in the array. Subsequent
|
175 kumpf 1.11 elements are moved down. The size of the array grows by one.
|
176 karl 1.21 @param x Specifies the element to add to the array.
|
177 mike 1.5 */
|
178 kumpf 1.18 void insert(Uint32 index, const PEGASUS_ARRAY_T& x);
|
179 mike 1.5
|
180 kumpf 1.18 /** Inserts size elements at x into the array at the given index.
|
181 kumpf 1.11 Subsequent elements are moved down. The size of the array grows
182 by size elements.
|
183 karl 1.21 @param x Specifies where to begin adding elements in the array.
184 @param size Uint32 size to add to the array starting at element x.
|
185 mike 1.5 */
|
186 kumpf 1.18 void insert(Uint32 index, const PEGASUS_ARRAY_T* x, Uint32 size);
|
187 mike 1.5
|
188 kumpf 1.18 /** Removes the element at the given index from the array. The
|
189 kumpf 1.11 size of the array shrinks by one.
|
190 karl 1.21 @param index Specifies the array element to remove.
|
191 mike 1.5 */
|
192 kumpf 1.18 void remove(Uint32 index);
|
193 mike 1.5
|
194 kumpf 1.18 /** Removes size elements starting at the given index. The size of
|
195 kumpf 1.11 the array shrinks by size elements.
|
196 karl 1.21 @param index Specifies where in the array to begin removing elements.
197 @param size Uint32 size that specifies how many elements to remove from the array.
|
198 mike 1.5 */
|
199 kumpf 1.18 void remove(Uint32 index, Uint32 size);
|
200 mike 1.6
|
201 mike 1.5 private:
202
|
203 kumpf 1.8 PEGASUS_ARRAY_T* _data() const;
|
204 mike 1.5
|
205 kumpf 1.11 void* _rep;
|
206 mike 1.5 };
207
|
208 kumpf 1.11 #endif //!defined(Pegasus_ArrayInter_h) || !defined(PEGASUS_ARRAY_T)
|