version 1.28, 2005/11/03 03:19:28
|
version 1.29, 2005/11/04 19:11:59
|
|
|
_rep = ArrayRep<PEGASUS_ARRAY_T>::alloc(size); | _rep = ArrayRep<PEGASUS_ARRAY_T>::alloc(size); |
| |
if (!_rep) | if (!_rep) |
|
{ |
throw NullPointer(); | throw NullPointer(); |
|
} |
| |
InitializeRaw(Array_data, size); | InitializeRaw(Array_data, size); |
} | } |
|
|
_rep = ArrayRep<PEGASUS_ARRAY_T>::alloc(size); | _rep = ArrayRep<PEGASUS_ARRAY_T>::alloc(size); |
| |
if (!_rep) | if (!_rep) |
|
{ |
throw NullPointer(); | throw NullPointer(); |
|
} |
| |
PEGASUS_ARRAY_T* data = Array_data; | PEGASUS_ARRAY_T* data = Array_data; |
| |
|
|
_rep = ArrayRep<PEGASUS_ARRAY_T>::alloc(size); | _rep = ArrayRep<PEGASUS_ARRAY_T>::alloc(size); |
| |
if (!_rep) | if (!_rep) |
|
{ |
throw NullPointer(); | throw NullPointer(); |
|
} |
| |
CopyToRaw(Array_data, items, size); | CopyToRaw(Array_data, items, size); |
} | } |
|
|
if (Array_size) | if (Array_size) |
{ | { |
if (Array_refs.get() == 1) | if (Array_refs.get() == 1) |
|
{ |
|
Destroy(Array_data, Array_size); |
Array_size = 0; | Array_size = 0; |
|
} |
else | else |
{ | { |
ArrayRep<PEGASUS_ARRAY_T>::unref(Array_rep); | ArrayRep<PEGASUS_ARRAY_T>::unref(Array_rep); |
|
|
| |
rep->size = Array_size; | rep->size = Array_size; |
| |
|
#if 0 |
if (Array_refs.get() == 1) | if (Array_refs.get() == 1) |
{ | { |
memcpy(rep->data(), Array_data, Array_size*sizeof(PEGASUS_ARRAY_T)); | memcpy(rep->data(), Array_data, Array_size*sizeof(PEGASUS_ARRAY_T)); |
Array_size = 0; | Array_size = 0; |
} | } |
else | else |
|
#endif |
CopyToRaw(rep->data(), Array_data, Array_size); | CopyToRaw(rep->data(), Array_data, Array_size); |
| |
ArrayRep<PEGASUS_ARRAY_T>::unref(Array_rep); | ArrayRep<PEGASUS_ARRAY_T>::unref(Array_rep); |
|
|
Uint32 index, const PEGASUS_ARRAY_T* x, Uint32 size) | Uint32 index, const PEGASUS_ARRAY_T* x, Uint32 size) |
{ | { |
if (index > Array_size) | if (index > Array_size) |
|
{ |
throw IndexOutOfBoundsException(); | throw IndexOutOfBoundsException(); |
|
} |
| |
reserveCapacity(Array_size + size); | reserveCapacity(Array_size + size); |
| |
|
|
// Case 2: not attempting to remove last element: | // Case 2: not attempting to remove last element: |
| |
if (index + size - 1 > Array_size) | if (index + size - 1 > Array_size) |
|
{ |
throw IndexOutOfBoundsException(); | throw IndexOutOfBoundsException(); |
|
} |
| |
Destroy(Array_data + index, size); | Destroy(Array_data + index, size); |
Uint32 rem = Array_size - (index + size); | Uint32 rem = Array_size - (index + size); |