version 1.4, 2001/07/10 06:43:21
|
version 1.9, 2002/05/13 23:07:52
|
|
|
Array<PEGASUS_ARRAY_T>::Array(Uint32 size) | Array<PEGASUS_ARRAY_T>::Array(Uint32 size) |
{ | { |
_rep = Rep::create(size); | _rep = Rep::create(size); |
|
#if defined(PEGASUS_PLATFORM_HPUX_PARISC_ACC) || defined(PEGASUS_PLATFORM_LINUX_GENERIC_GNU) |
|
InitializeRaw<PEGASUS_ARRAY_T>(_rep->data(), size); |
|
#else |
InitializeRaw(_rep->data(), size); | InitializeRaw(_rep->data(), size); |
|
#endif |
} | } |
| |
#ifndef PEGASUS_ARRAY_T | #ifndef PEGASUS_ARRAY_T |
|
|
Array<PEGASUS_ARRAY_T>::Array(const PEGASUS_ARRAY_T* items, Uint32 size) | Array<PEGASUS_ARRAY_T>::Array(const PEGASUS_ARRAY_T* items, Uint32 size) |
{ | { |
_rep = Rep::create(size); | _rep = Rep::create(size); |
|
#if defined(PEGASUS_PLATFORM_HPUX_PARISC_ACC) || defined(PEGASUS_PLATFORM_LINUX_GENERIC_GNU) |
|
CopyToRaw<PEGASUS_ARRAY_T>(_rep->data(), items, size); |
|
#else |
CopyToRaw(_rep->data(), items, size); | CopyToRaw(_rep->data(), items, size); |
|
#endif |
} | } |
| |
#ifndef PEGASUS_ARRAY_T | #ifndef PEGASUS_ARRAY_T |
|
|
Uint32 size = this->size(); | Uint32 size = this->size(); |
Rep* rep = Rep::create(capacity); | Rep* rep = Rep::create(capacity); |
rep->size = size; | rep->size = size; |
|
#if defined(PEGASUS_PLATFORM_HPUX_PARISC_ACC) || defined(PEGASUS_PLATFORM_LINUX_GENERIC_GNU) |
|
CopyToRaw<PEGASUS_ARRAY_T>(rep->data(), _rep->data(), size); |
|
#else |
CopyToRaw(rep->data(), _rep->data(), size); | CopyToRaw(rep->data(), _rep->data(), size); |
|
#endif |
Rep::dec(_rep); | Rep::dec(_rep); |
_rep = rep; | _rep = rep; |
} | } |
|
|
#else | #else |
PEGASUS_TEMPLATE_SPECIALIZATION | PEGASUS_TEMPLATE_SPECIALIZATION |
#endif | #endif |
void Array<PEGASUS_ARRAY_T>::_copyOnWriteAux() |
void Array<PEGASUS_ARRAY_T>::_copyOnWrite() |
{ | { |
if (_rep->ref != 1) | if (_rep->ref != 1) |
{ | { |
|
|
{ | { |
reserve(this->size() + size); | reserve(this->size() + size); |
_copyOnWrite(); | _copyOnWrite(); |
|
#if defined(PEGASUS_PLATFORM_HPUX_PARISC_ACC) || defined(PEGASUS_PLATFORM_LINUX_GENERIC_GNU) |
|
CopyToRaw<PEGASUS_ARRAY_T>(_data() + this->size(), x, size); |
|
#else |
CopyToRaw(_data() + this->size(), x, size); | CopyToRaw(_data() + this->size(), x, size); |
|
#endif |
_rep->size += size; | _rep->size += size; |
} | } |
| |
|
|
reserve(this->size() + size); | reserve(this->size() + size); |
_copyOnWrite(); | _copyOnWrite(); |
memmove(_data() + size, _data(), sizeof(PEGASUS_ARRAY_T) * this->size()); | memmove(_data() + size, _data(), sizeof(PEGASUS_ARRAY_T) * this->size()); |
|
#if defined(PEGASUS_PLATFORM_HPUX_PARISC_ACC) || defined(PEGASUS_PLATFORM_LINUX_GENERIC_GNU) |
|
CopyToRaw<PEGASUS_ARRAY_T>(_data(), x, size); |
|
#else |
CopyToRaw(_data(), x, size); | CopyToRaw(_data(), x, size); |
|
#endif |
_rep->size += size; | _rep->size += size; |
} | } |
| |
|
|
memmove( | memmove( |
_data() + pos + size, _data() + pos, sizeof(PEGASUS_ARRAY_T) * n); | _data() + pos + size, _data() + pos, sizeof(PEGASUS_ARRAY_T) * n); |
| |
|
#if defined(PEGASUS_PLATFORM_HPUX_PARISC_ACC) || defined(PEGASUS_PLATFORM_LINUX_GENERIC_GNU) |
|
CopyToRaw<PEGASUS_ARRAY_T>(_data() + pos, x, size); |
|
#else |
CopyToRaw(_data() + pos, x, size); | CopyToRaw(_data() + pos, x, size); |
|
#endif |
_rep->size += size; | _rep->size += size; |
} | } |
| |
|
|
| |
_copyOnWrite(); | _copyOnWrite(); |
| |
|
#if defined(PEGASUS_PLATFORM_HPUX_PARISC_ACC) || defined(PEGASUS_PLATFORM_LINUX_GENERIC_GNU) |
|
Destroy<PEGASUS_ARRAY_T>(_data() + pos); |
|
#else |
Destroy(_data() + pos); | Destroy(_data() + pos); |
|
#endif |
| |
Uint32 rem = this->size() - pos - 1; | Uint32 rem = this->size() - pos - 1; |
| |
|
|
| |
_copyOnWrite(); | _copyOnWrite(); |
| |
|
#if defined(PEGASUS_PLATFORM_HPUX_PARISC_ACC) || defined(PEGASUS_PLATFORM_LINUX_GENERIC_GNU) |
|
Destroy<PEGASUS_ARRAY_T>(_data() + pos, size); |
|
#else |
Destroy(_data() + pos, size); | Destroy(_data() + pos, size); |
|
#endif |
| |
Uint32 rem = this->size() - (pos + size); | Uint32 rem = this->size() - (pos + size); |
| |
|
|
_rep->size -= size; | _rep->size -= size; |
} | } |
| |
|
#ifdef PEGASUS_HAS_EBCDIC |
|
|
|
#ifndef PEGASUS_ARRAY_T |
|
template<class PEGASUS_ARRAY_T> |
|
#else |
|
PEGASUS_TEMPLATE_SPECIALIZATION |
|
#endif |
|
void Array<PEGASUS_ARRAY_T>::etoa() |
|
{ |
|
#if PEGASUS_ARRAY_T == Sint8 |
|
_copyOnWrite(); |
|
__etoa_l((char *)_data(),_rep->size); |
|
#endif |
|
} |
|
|
|
#ifndef PEGASUS_ARRAY_T |
|
template<class PEGASUS_ARRAY_T> |
|
#else |
|
PEGASUS_TEMPLATE_SPECIALIZATION |
|
#endif |
|
void Array<PEGASUS_ARRAY_T>::atoe() |
|
{ |
|
#if PEGASUS_ARRAY_T == Sint8 |
|
_copyOnWrite(); |
|
__atoe_l((char *)_data(),_rep->size); |
|
#endif |
|
} |
|
|
|
#endif |
|
|
#endif /*defined(PEGASUS_EXPLICIT_INSTANTIATION) || !defined(PEGASUS_ARRAY_T)*/ | #endif /*defined(PEGASUS_EXPLICIT_INSTANTIATION) || !defined(PEGASUS_ARRAY_T)*/ |