(file) Return to ArrayInter.h CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / Common

  1 karl  1.25 //%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 karl  1.25 // 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 kumpf 1.26 /**
 44                This class is used to represent arrays of intrinsic data types in CIM.
 45 mike  1.5  */
 46 kumpf 1.11 template<class PEGASUS_ARRAY_T> class Array
 47 mike  1.5  #else
 48 kumpf 1.26 PEGASUS_TEMPLATE_SPECIALIZATION
 49                class PEGASUS_COMMON_LINKAGE Array<PEGASUS_ARRAY_T>
 50 mike  1.5  #endif
 51            {
 52            public:
 53            
 54 kumpf 1.26     /**
 55                    Constructs an array object with null values (default constructor).
 56                */
 57 mike  1.5      Array();
 58            
 59 kumpf 1.26     /**
 60                    Creates a new Array object using the parameters and values in the
 61                    Array object.
 62                    @param x Specifies the new Array object name.
 63                */
 64 mike  1.5      Array(const Array<PEGASUS_ARRAY_T>& x);
 65            
 66 kumpf 1.26     /**
 67                    Constructs an array with size elements. The elements are
 68 kumpf 1.11         initialized with their copy constructor.
 69 karl  1.21         @param size Defines the number of elements.
 70 mike  1.5      */
 71                Array(Uint32 size);
 72            
 73 kumpf 1.26     /**
 74                    Constructs an array with size elements. The elements are
 75 karl  1.21         initialized with array x.
 76 kumpf 1.26         @param size Defines the number of elements.
 77                    @param x Specifies the new array object name.
 78 mike  1.5      */
 79                Array(Uint32 size, const PEGASUS_ARRAY_T& x);
 80            
 81 kumpf 1.26     /**
 82                    Constructs an array with size elements. The values come from
 83 kumpf 1.11         the items pointer.
 84 kumpf 1.26         @param items References the values of the specified array.
 85                    @param size Uint32 representing how many elements are in the array.
 86 mike  1.5      */
 87                Array(const PEGASUS_ARRAY_T* items, Uint32 size);
 88            
 89 kumpf 1.26     /**
 90                    Destroys the objects, freeing any resources.
 91 karl  1.21     */
 92 mike  1.5      ~Array();
 93            
 94 kumpf 1.26     /**
 95                    The values of one array object are assigned to another (assignment
 96                    operator).
 97                    @param x Array object to assign the Array parameters to.
 98 karl  1.21     */
 99 mike  1.5      Array<PEGASUS_ARRAY_T>& operator=(const Array<PEGASUS_ARRAY_T>& x);
100            
101 kumpf 1.26     /**
102                    Clears the contents of the array. After calling this, size()
103 kumpf 1.11         returns zero.
104 mike  1.5      */
105                void clear();
106            
107 kumpf 1.26     /**
108                    Reserves memory for capacity elements. Notice that this does not
109 kumpf 1.11         change the size of the array (size() returns what it did before).
110                    If the capacity of the array is already greater or equal to the
111 kumpf 1.14         capacity argument, this method has no effect. After calling
112                    reserveCapacity(), getCapacity() returns a value which is greater
113                    or equal to the capacity argument.
114 karl  1.21         @param capacity Defines the size that is to be reserved
115 mike  1.5      */
116 kumpf 1.14     void reserveCapacity(Uint32 capacity);
117 mike  1.5  
118 kumpf 1.26     /**
119                    Make the size of the array grow by size elements. The new size will
120 kumpf 1.11         be size() + size. The new elements (there are size of them) are
121                    initialized with x.
122 karl  1.21         @param size Defines the number of elements by which the array is to
123 kumpf 1.11         grow.
124 mike  1.5      */
125                void grow(Uint32 size, const PEGASUS_ARRAY_T& x);
126            
127 kumpf 1.26     /**
128                    Swaps the contents of two arrays.  After the swap, Array x references
129                    the original values of this Array object and this Array object
130                    references the original values of Array x.
131                    @param x The Array with which to swap values.
132 karl  1.21     */
133 mike  1.5      void swap(Array<PEGASUS_ARRAY_T>& x);
134            
135 kumpf 1.26     /**
136                    Returns the number of elements in the array.
137 karl  1.21         @return The number of elements in the array.
138 mike  1.5      */
139 kumpf 1.8      Uint32 size() const;
140 mike  1.5  
141 kumpf 1.26     /**
142                    Returns the capacity of the array.
143                    @return The capacity of the array.
144 karl  1.21     */
145 kumpf 1.8      Uint32 getCapacity() const;
146 mike  1.5  
147 kumpf 1.26     /**
148                    Returns a pointer to the first element of the array.
149                    @return A pointer to the first element of the array.
150                */
151 kumpf 1.8      const PEGASUS_ARRAY_T* getData() const;
152 mike  1.5  
153 kumpf 1.26     /**
154                    Returns the element indicated by the index argument.
155 kumpf 1.18         @return A reference to the element defined by index so that it may be
156 kumpf 1.11         modified.
157 mike  1.5      */
158 kumpf 1.18     PEGASUS_ARRAY_T& operator[](Uint32 index);
159 mike  1.5  
160 kumpf 1.26     /**
161                    Returns the element in the const array specified as the index argument.
162                    The return value cannot be modified since it is constant.
163                    @return A reference to the element defined by index but the reference
164                    cannot be modified.
165 mike  1.5      */
166 kumpf 1.18     const PEGASUS_ARRAY_T& operator[](Uint32 index) const;
167 mike  1.5  
168 kumpf 1.26     /**
169                    Appends an element to the end of the array. This increases the size
170 kumpf 1.11         of the array by one.
171                    @param x Element to append.
172 mike  1.5      */
173                void append(const PEGASUS_ARRAY_T& x);
174            
175 kumpf 1.26     /**
176                    Appends size elements at x to the end of this array.
177                    @param size Uint32 value to append to the size of the array.
178                */
179 mike  1.5      void append(const PEGASUS_ARRAY_T* x, Uint32 size);
180            
181 kumpf 1.26     /**
182                    Appends one array to another. The size of this array grows by the
183 kumpf 1.11         size of the other.
184 kumpf 1.26         @param x Array to add to the appended array.
185 mike  1.5      */
186 kumpf 1.8      void appendArray(const Array<PEGASUS_ARRAY_T>& x);
187 mike  1.5  
188 kumpf 1.26     /**
189                    Appends one element to the beginning of the array. This increases
190 kumpf 1.11         the size by one.
191 karl  1.21         @param x The element to pre pend.
192 mike  1.5      */
193                void prepend(const PEGASUS_ARRAY_T& x);
194            
195 kumpf 1.26     /**
196                    Appends size elements to the array starting at the memory address
197 kumpf 1.11         given by x. The array grows by size elements.
198 kumpf 1.26         @param size Uint32 size to add to the array at address x.
199                    @param x Specifies where to begin increasing size elements of the array.
200 mike  1.5      */
201                void prepend(const PEGASUS_ARRAY_T* x, Uint32 size);
202            
203 kumpf 1.26     /**
204                    Inserts the element at the given index in the array. Subsequent
205 kumpf 1.11         elements are moved down. The size of the array grows by one.
206 kumpf 1.26         @param x Specifies the element to add to the array.
207 mike  1.5      */
208 kumpf 1.18     void insert(Uint32 index, const PEGASUS_ARRAY_T& x);
209 mike  1.5  
210 kumpf 1.26     /**
211                    Inserts size elements at x into the array at the given index.
212 kumpf 1.11         Subsequent elements are moved down. The size of the array grows
213                    by size elements.
214 kumpf 1.26         @param x Specifies where to begin adding elements in the array.
215                    @param size Uint32 size to add to the array starting at element x.
216 mike  1.5      */
217 kumpf 1.18     void insert(Uint32 index, const PEGASUS_ARRAY_T* x, Uint32 size);
218 mike  1.5  
219 kumpf 1.26     /**
220                    Removes the element at the given index from the array. The
221 kumpf 1.11         size of the array shrinks by one.
222 kumpf 1.26         @param index Specifies the array element to remove.
223 mike  1.5      */
224 kumpf 1.18     void remove(Uint32 index);
225 mike  1.5  
226 kumpf 1.26     /**
227                    Removes size elements starting at the given index. The size of
228 kumpf 1.11         the array shrinks by size elements.
229 kumpf 1.26         @param index Specifies where in the array to begin removing elements.
230                    @param size Uint32 size that specifies how many elements to remove
231                    from the array.
232 mike  1.5      */
233 kumpf 1.18     void remove(Uint32 index, Uint32 size);
234 mike  1.6  
235 mike  1.5  private:
236            
237 kumpf 1.8      PEGASUS_ARRAY_T* _data() const;
238 mike  1.5  
239 kumpf 1.11     void* _rep;
240 mike  1.5  };
241            
242 kumpf 1.11 #endif //!defined(Pegasus_ArrayInter_h) || !defined(PEGASUS_ARRAY_T)

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2