version 1.25, 2006/01/30 16:16:46
|
version 1.26, 2006/11/07 21:30:36
|
|
|
#include <Pegasus/Common/Linkage.h> | #include <Pegasus/Common/Linkage.h> |
| |
#ifndef PEGASUS_ARRAY_T | #ifndef PEGASUS_ARRAY_T |
/** This class is used to represent arrays of intrinsic data types in CIM. |
/** |
|
This class is used to represent arrays of intrinsic data types in CIM. |
*/ | */ |
template<class PEGASUS_ARRAY_T> class Array | template<class PEGASUS_ARRAY_T> class Array |
#else | #else |
PEGASUS_TEMPLATE_SPECIALIZATION class PEGASUS_COMMON_LINKAGE Array<PEGASUS_ARRAY_T> |
PEGASUS_TEMPLATE_SPECIALIZATION |
|
class PEGASUS_COMMON_LINKAGE Array<PEGASUS_ARRAY_T> |
#endif | #endif |
{ | { |
public: | public: |
| |
/** Constructs an array object with null values (default constructor). |
/** |
|
Constructs an array object with null values (default constructor). |
*/ | */ |
Array(); | Array(); |
| |
/** Creates a new Array object using the parameters and values in the Array object. |
/** |
|
Creates a new Array object using the parameters and values in the |
|
Array object. |
@param x Specifies the new Array object name. | @param x Specifies the new Array object name. |
*/ | */ |
Array(const Array<PEGASUS_ARRAY_T>& x); | Array(const Array<PEGASUS_ARRAY_T>& x); |
| |
/** Constructs an array with size elements. The elements are |
/** |
|
Constructs an array with size elements. The elements are |
initialized with their copy constructor. | initialized with their copy constructor. |
@param size Defines the number of elements. | @param size Defines the number of elements. |
*/ | */ |
Array(Uint32 size); | Array(Uint32 size); |
| |
/** Constructs an array with size elements. The elements are |
/** |
|
Constructs an array with size elements. The elements are |
initialized with array x. | initialized with array x. |
@param size Defines the number of elements. | @param size Defines the number of elements. |
@param x Specifies the new array object name. | @param x Specifies the new array object name. |
*/ | */ |
Array(Uint32 size, const PEGASUS_ARRAY_T& x); | Array(Uint32 size, const PEGASUS_ARRAY_T& x); |
| |
/** Constructs an array with size elements. The values come from |
/** |
|
Constructs an array with size elements. The values come from |
the items pointer. | the items pointer. |
@param items References the values of the specified array. | @param items References the values of the specified array. |
@param size Uint32 representing how many elements are in the array. | @param size Uint32 representing how many elements are in the array. |
*/ | */ |
Array(const PEGASUS_ARRAY_T* items, Uint32 size); | Array(const PEGASUS_ARRAY_T* items, Uint32 size); |
| |
/**Destroys the objects, freeing any resources. |
/** |
|
Destroys the objects, freeing any resources. |
*/ | */ |
~Array(); | ~Array(); |
| |
/**The values of one array object are assigned to another (assignment operator). |
/** |
|
The values of one array object are assigned to another (assignment |
|
operator). |
@param x Array object to assign the Array parameters to. | @param x Array object to assign the Array parameters to. |
*/ | */ |
Array<PEGASUS_ARRAY_T>& operator=(const Array<PEGASUS_ARRAY_T>& x); | Array<PEGASUS_ARRAY_T>& operator=(const Array<PEGASUS_ARRAY_T>& x); |
| |
/** Clears the contents of the array. After calling this, size() |
/** |
|
Clears the contents of the array. After calling this, size() |
returns zero. | returns zero. |
*/ | */ |
void clear(); | void clear(); |
| |
/** Reserves memory for capacity elements. Notice that this does not |
/** |
|
Reserves memory for capacity elements. Notice that this does not |
change the size of the array (size() returns what it did before). | change the size of the array (size() returns what it did before). |
If the capacity of the array is already greater or equal to the | If the capacity of the array is already greater or equal to the |
capacity argument, this method has no effect. After calling | capacity argument, this method has no effect. After calling |
|
|
*/ | */ |
void reserveCapacity(Uint32 capacity); | void reserveCapacity(Uint32 capacity); |
| |
/** Make the size of the array grow by size elements. The new size will |
/** |
|
Make the size of the array grow by size elements. The new size will |
be size() + size. The new elements (there are size of them) are | be size() + size. The new elements (there are size of them) are |
initialized with x. | initialized with x. |
@param size Defines the number of elements by which the array is to | @param size Defines the number of elements by which the array is to |
|
|
*/ | */ |
void grow(Uint32 size, const PEGASUS_ARRAY_T& x); | void grow(Uint32 size, const PEGASUS_ARRAY_T& x); |
| |
/** 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. |
/** |
|
Swaps the contents of two arrays. After the swap, Array x references |
|
the original values of this Array object and this Array object |
|
references the original values of Array x. |
|
@param x The Array with which to swap values. |
*/ | */ |
void swap(Array<PEGASUS_ARRAY_T>& x); | void swap(Array<PEGASUS_ARRAY_T>& x); |
| |
/** Returns the number of elements in the array. |
/** |
|
Returns the number of elements in the array. |
@return The number of elements in the array. | @return The number of elements in the array. |
*/ | */ |
Uint32 size() const; | Uint32 size() const; |
| |
/** Returns the capacity of the array. |
/** |
|
Returns the capacity of the array. |
@return The capacity of the array. | @return The capacity of the array. |
*/ | */ |
Uint32 getCapacity() const; | Uint32 getCapacity() const; |
| |
/** Returns a pointer to the first element of the array. |
/** |
|
Returns a pointer to the first element of the array. |
@return A pointer to the first element of the array. | @return A pointer to the first element of the array. |
*/ | */ |
const PEGASUS_ARRAY_T* getData() const; | const PEGASUS_ARRAY_T* getData() const; |
| |
/** Returns the element indicated by the index argument. |
/** |
|
Returns the element indicated by the index argument. |
@return A reference to the element defined by index so that it may be | @return A reference to the element defined by index so that it may be |
modified. | modified. |
*/ | */ |
PEGASUS_ARRAY_T& operator[](Uint32 index); | PEGASUS_ARRAY_T& operator[](Uint32 index); |
| |
/** Returns the element in the const array specified as the index argument. The return value cannot be modified since it |
/** |
is constant. |
Returns the element in the const array specified as the index argument. |
@return A reference to the element defined by index but the reference cannot be modified. |
The return value cannot be modified since it is constant. |
|
@return A reference to the element defined by index but the reference |
|
cannot be modified. |
*/ | */ |
const PEGASUS_ARRAY_T& operator[](Uint32 index) const; | const PEGASUS_ARRAY_T& operator[](Uint32 index) const; |
| |
/** Appends an element to the end of the array. This increases the size |
/** |
|
Appends an element to the end of the array. This increases the size |
of the array by one. | of the array by one. |
@param x Element to append. | @param x Element to append. |
*/ | */ |
void append(const PEGASUS_ARRAY_T& x); | void append(const PEGASUS_ARRAY_T& x); |
| |
/** Appends size elements at x to the end of this array. |
/** |
|
Appends size elements at x to the end of this array. |
@param size Uint32 value to append to the size of the array. | @param size Uint32 value to append to the size of the array. |
*/ | */ |
void append(const PEGASUS_ARRAY_T* x, Uint32 size); | void append(const PEGASUS_ARRAY_T* x, Uint32 size); |
| |
/** Appends one array to another. The size of this array grows by the |
/** |
|
Appends one array to another. The size of this array grows by the |
size of the other. | size of the other. |
@param x Array to add to the appended array. | @param x Array to add to the appended array. |
*/ | */ |
void appendArray(const Array<PEGASUS_ARRAY_T>& x); | void appendArray(const Array<PEGASUS_ARRAY_T>& x); |
| |
/** Appends one element to the beginning of the array. This increases |
/** |
|
Appends one element to the beginning of the array. This increases |
the size by one. | the size by one. |
@param x The element to pre pend. | @param x The element to pre pend. |
*/ | */ |
void prepend(const PEGASUS_ARRAY_T& x); | void prepend(const PEGASUS_ARRAY_T& x); |
| |
/** Appends size elements to the array starting at the memory address |
/** |
|
Appends size elements to the array starting at the memory address |
given by x. The array grows by size elements. | given by x. The array grows by size elements. |
@param size Uint32 size to add to the array at address x. | @param size Uint32 size to add to the array at address x. |
@param x Specifies where to begin increasing size elements of the array. | @param x Specifies where to begin increasing size elements of the array. |
*/ | */ |
void prepend(const PEGASUS_ARRAY_T* x, Uint32 size); | void prepend(const PEGASUS_ARRAY_T* x, Uint32 size); |
| |
/** Inserts the element at the given index in the array. Subsequent |
/** |
|
Inserts the element at the given index in the array. Subsequent |
elements are moved down. The size of the array grows by one. | elements are moved down. The size of the array grows by one. |
@param x Specifies the element to add to the array. | @param x Specifies the element to add to the array. |
*/ | */ |
void insert(Uint32 index, const PEGASUS_ARRAY_T& x); | void insert(Uint32 index, const PEGASUS_ARRAY_T& x); |
| |
/** Inserts size elements at x into the array at the given index. |
/** |
|
Inserts size elements at x into the array at the given index. |
Subsequent elements are moved down. The size of the array grows | Subsequent elements are moved down. The size of the array grows |
by size elements. | by size elements. |
@param x Specifies where to begin adding elements in the array. | @param x Specifies where to begin adding elements in the array. |
|
|
*/ | */ |
void insert(Uint32 index, const PEGASUS_ARRAY_T* x, Uint32 size); | void insert(Uint32 index, const PEGASUS_ARRAY_T* x, Uint32 size); |
| |
/** Removes the element at the given index from the array. The |
/** |
|
Removes the element at the given index from the array. The |
size of the array shrinks by one. | size of the array shrinks by one. |
@param index Specifies the array element to remove. | @param index Specifies the array element to remove. |
*/ | */ |
void remove(Uint32 index); | void remove(Uint32 index); |
| |
/** Removes size elements starting at the given index. The size of |
/** |
|
Removes size elements starting at the given index. The size of |
the array shrinks by size elements. | the array shrinks by size elements. |
@param index Specifies where in the array to begin removing elements. | @param index Specifies where in the array to begin removing elements. |
@param size Uint32 size that specifies how many elements to remove from the array. |
@param size Uint32 size that specifies how many elements to remove |
|
from the array. |
*/ | */ |
void remove(Uint32 index, Uint32 size); | void remove(Uint32 index, Uint32 size); |
| |