version 1.12, 2002/05/17 22:33:30
|
version 1.15, 2002/06/13 21:32:03
|
|
|
//%///////////////////////////////////////////////////////////////////////////// | //%///////////////////////////////////////////////////////////////////////////// |
// | // |
// Copyright (c) 2000, 2001 The Open group, BMC Software, Tivoli Systems, IBM |
// Copyright (c) 2000, 2001, 2002 BMC Software, Hewlett-Packard Company, IBM, |
|
// The Open Group, Tivoli Systems |
// | // |
// Permission is hereby granted, free of charge, to any person obtaining a copy | // Permission is hereby granted, free of charge, to any person obtaining a copy |
// of this software and associated documentation files (the "Software"), to | // of this software and associated documentation files (the "Software"), to |
|
|
// | // |
//%///////////////////////////////////////////////////////////////////////////// | //%///////////////////////////////////////////////////////////////////////////// |
| |
#if defined(PEGASUS_EXPLICIT_INSTANTIATION) || !defined(PEGASUS_ARRAY_T) |
//#if defined(PEGASUS_EXPLICIT_INSTANTIATION) || !defined(PEGASUS_ARRAY_T) |
|
// Only include if not included as general template or if explicit instantiation |
|
#if !defined(Pegasus_ArrayImpl_h) || defined(PEGASUS_ARRAY_T) |
|
#if !defined(PEGASUS_ARRAY_T) |
|
#define Pegasus_ArrayImpl_h |
|
#endif |
|
|
|
PEGASUS_NAMESPACE_END |
|
|
|
#include <Pegasus/Common/Memory.h> |
|
#include <Pegasus/Common/ArrayRep.h> |
|
|
|
#ifdef PEGASUS_HAS_EBCDIC |
|
#include <unistd.h> |
|
#endif |
|
|
|
PEGASUS_NAMESPACE_BEGIN |
| |
#ifndef PEGASUS_ARRAY_T | #ifndef PEGASUS_ARRAY_T |
template<class PEGASUS_ARRAY_T> | template<class PEGASUS_ARRAY_T> |
#else |
|
PEGASUS_TEMPLATE_SPECIALIZATION |
|
#endif | #endif |
Array<PEGASUS_ARRAY_T>::Array() | Array<PEGASUS_ARRAY_T>::Array() |
{ | { |
_rep = Rep::create(0); |
_rep = ArrayRep<PEGASUS_ARRAY_T>::create(0); |
} | } |
| |
#ifndef PEGASUS_ARRAY_T | #ifndef PEGASUS_ARRAY_T |
template<class PEGASUS_ARRAY_T> | template<class PEGASUS_ARRAY_T> |
#else |
|
PEGASUS_TEMPLATE_SPECIALIZATION |
|
#endif | #endif |
Array<PEGASUS_ARRAY_T>::Array(const Array<PEGASUS_ARRAY_T>& x) | Array<PEGASUS_ARRAY_T>::Array(const Array<PEGASUS_ARRAY_T>& x) |
{ | { |
_rep = x._rep->clone(); |
_rep = static_cast<ArrayRep<PEGASUS_ARRAY_T>*>(x._rep)->clone(); |
} | } |
| |
#ifndef PEGASUS_ARRAY_T | #ifndef PEGASUS_ARRAY_T |
template<class PEGASUS_ARRAY_T> | template<class PEGASUS_ARRAY_T> |
#else |
|
PEGASUS_TEMPLATE_SPECIALIZATION |
|
#endif | #endif |
Array<PEGASUS_ARRAY_T>::Array(Uint32 size) | Array<PEGASUS_ARRAY_T>::Array(Uint32 size) |
{ | { |
_rep = Rep::create(size); |
_rep = ArrayRep<PEGASUS_ARRAY_T>::create(size); |
#if defined(PEGASUS_PLATFORM_HPUX_PARISC_ACC) || defined(PEGASUS_PLATFORM_LINUX_GENERIC_GNU) |
InitializeRaw(static_cast<ArrayRep<PEGASUS_ARRAY_T>*>(_rep)->data(), size); |
InitializeRaw<PEGASUS_ARRAY_T>(_rep->data(), size); |
|
#else |
|
InitializeRaw(_rep->data(), size); |
|
#endif |
|
} | } |
| |
#ifndef PEGASUS_ARRAY_T | #ifndef PEGASUS_ARRAY_T |
template<class PEGASUS_ARRAY_T> | template<class PEGASUS_ARRAY_T> |
#else |
|
PEGASUS_TEMPLATE_SPECIALIZATION |
|
#endif | #endif |
Array<PEGASUS_ARRAY_T>::Array(Uint32 size, const PEGASUS_ARRAY_T& x) | Array<PEGASUS_ARRAY_T>::Array(Uint32 size, const PEGASUS_ARRAY_T& x) |
{ | { |
_rep = Rep::create(size); |
_rep = ArrayRep<PEGASUS_ARRAY_T>::create(size); |
| |
PEGASUS_ARRAY_T* data = _rep->data(); |
PEGASUS_ARRAY_T* data = static_cast<ArrayRep<PEGASUS_ARRAY_T>*>(_rep)->data(); |
| |
while (size--) | while (size--) |
new(data++) PEGASUS_ARRAY_T(x); | new(data++) PEGASUS_ARRAY_T(x); |
|
|
| |
#ifndef PEGASUS_ARRAY_T | #ifndef PEGASUS_ARRAY_T |
template<class PEGASUS_ARRAY_T> | template<class PEGASUS_ARRAY_T> |
#else |
|
PEGASUS_TEMPLATE_SPECIALIZATION |
|
#endif | #endif |
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 = ArrayRep<PEGASUS_ARRAY_T>::create(size); |
#if defined(PEGASUS_PLATFORM_HPUX_PARISC_ACC) || defined(PEGASUS_PLATFORM_LINUX_GENERIC_GNU) |
CopyToRaw(static_cast<ArrayRep<PEGASUS_ARRAY_T>*>(_rep)->data(), items, size); |
CopyToRaw<PEGASUS_ARRAY_T>(_rep->data(), items, size); |
|
#else |
|
CopyToRaw(_rep->data(), items, size); |
|
#endif |
|
} | } |
| |
#ifndef PEGASUS_ARRAY_T | #ifndef PEGASUS_ARRAY_T |
template<class PEGASUS_ARRAY_T> | template<class PEGASUS_ARRAY_T> |
#else |
|
PEGASUS_TEMPLATE_SPECIALIZATION |
|
#endif | #endif |
Array<PEGASUS_ARRAY_T>::~Array() | Array<PEGASUS_ARRAY_T>::~Array() |
{ | { |
Rep::destroy(_rep); |
ArrayRep<PEGASUS_ARRAY_T>::destroy(static_cast<ArrayRep<PEGASUS_ARRAY_T>*>(_rep)); |
} | } |
| |
#ifndef PEGASUS_ARRAY_T | #ifndef PEGASUS_ARRAY_T |
template<class PEGASUS_ARRAY_T> | template<class PEGASUS_ARRAY_T> |
#else |
|
PEGASUS_TEMPLATE_SPECIALIZATION |
|
#endif | #endif |
Array<PEGASUS_ARRAY_T>& Array<PEGASUS_ARRAY_T>::operator=( | Array<PEGASUS_ARRAY_T>& Array<PEGASUS_ARRAY_T>::operator=( |
const Array<PEGASUS_ARRAY_T>& x) | const Array<PEGASUS_ARRAY_T>& x) |
{ | { |
if (x._rep != _rep) |
if (static_cast<ArrayRep<PEGASUS_ARRAY_T>*>(x._rep) != |
|
static_cast<ArrayRep<PEGASUS_ARRAY_T>*>(_rep)) |
{ | { |
Rep::destroy(_rep); |
ArrayRep<PEGASUS_ARRAY_T>::destroy(static_cast<ArrayRep<PEGASUS_ARRAY_T>*>(_rep)); |
_rep = x._rep->clone(); |
_rep = static_cast<ArrayRep<PEGASUS_ARRAY_T>*>(x._rep)->clone(); |
} | } |
return *this; | return *this; |
} | } |
| |
#ifndef PEGASUS_ARRAY_T | #ifndef PEGASUS_ARRAY_T |
template<class PEGASUS_ARRAY_T> | template<class PEGASUS_ARRAY_T> |
#else |
|
PEGASUS_TEMPLATE_SPECIALIZATION |
|
#endif | #endif |
void Array<PEGASUS_ARRAY_T>::clear() | void Array<PEGASUS_ARRAY_T>::clear() |
{ | { |
Rep::destroy(_rep); |
ArrayRep<PEGASUS_ARRAY_T>::destroy(static_cast<ArrayRep<PEGASUS_ARRAY_T>*>(_rep)); |
_rep = Rep::create(0); |
_rep = ArrayRep<PEGASUS_ARRAY_T>::create(0); |
} | } |
| |
#ifndef PEGASUS_ARRAY_T | #ifndef PEGASUS_ARRAY_T |
template<class PEGASUS_ARRAY_T> | template<class PEGASUS_ARRAY_T> |
#else |
|
PEGASUS_TEMPLATE_SPECIALIZATION |
|
#endif | #endif |
void Array<PEGASUS_ARRAY_T>::reserve(Uint32 capacity) | void Array<PEGASUS_ARRAY_T>::reserve(Uint32 capacity) |
{ | { |
if (capacity > _rep->capacity) |
if (capacity > static_cast<ArrayRep<PEGASUS_ARRAY_T>*>(_rep)->capacity) |
{ | { |
Uint32 size = this->size(); | Uint32 size = this->size(); |
Rep* rep = Rep::create(capacity); |
ArrayRep<PEGASUS_ARRAY_T>* rep = ArrayRep<PEGASUS_ARRAY_T>::create(capacity); |
rep->size = size; | rep->size = size; |
#if defined(PEGASUS_PLATFORM_HPUX_PARISC_ACC) || defined(PEGASUS_PLATFORM_LINUX_GENERIC_GNU) |
CopyToRaw(rep->data(), static_cast<ArrayRep<PEGASUS_ARRAY_T>*>(_rep)->data(), size); |
CopyToRaw<PEGASUS_ARRAY_T>(rep->data(), _rep->data(), size); |
ArrayRep<PEGASUS_ARRAY_T>::destroy(static_cast<ArrayRep<PEGASUS_ARRAY_T>*>(_rep)); |
#else |
|
CopyToRaw(rep->data(), _rep->data(), size); |
|
#endif |
|
Rep::destroy(_rep); |
|
_rep = rep; | _rep = rep; |
} | } |
} | } |
| |
#ifndef PEGASUS_ARRAY_T | #ifndef PEGASUS_ARRAY_T |
template<class PEGASUS_ARRAY_T> | template<class PEGASUS_ARRAY_T> |
#else |
|
PEGASUS_TEMPLATE_SPECIALIZATION |
|
#endif | #endif |
void Array<PEGASUS_ARRAY_T>::grow(Uint32 size, const PEGASUS_ARRAY_T& x) | void Array<PEGASUS_ARRAY_T>::grow(Uint32 size, const PEGASUS_ARRAY_T& x) |
{ | { |
Uint32 oldSize = _rep->size; |
Uint32 oldSize = static_cast<ArrayRep<PEGASUS_ARRAY_T>*>(_rep)->size; |
reserve(oldSize + size); | reserve(oldSize + size); |
| |
PEGASUS_ARRAY_T* p = _rep->data() + oldSize; |
PEGASUS_ARRAY_T* p = static_cast<ArrayRep<PEGASUS_ARRAY_T>*>(_rep)->data() + oldSize; |
Uint32 n = size; | Uint32 n = size; |
| |
while (n--) | while (n--) |
new(p++) PEGASUS_ARRAY_T(x); | new(p++) PEGASUS_ARRAY_T(x); |
| |
_rep->size += size; |
static_cast<ArrayRep<PEGASUS_ARRAY_T>*>(_rep)->size += size; |
} | } |
| |
#ifndef PEGASUS_ARRAY_T | #ifndef PEGASUS_ARRAY_T |
template<class PEGASUS_ARRAY_T> | template<class PEGASUS_ARRAY_T> |
#else |
|
PEGASUS_TEMPLATE_SPECIALIZATION |
|
#endif | #endif |
void Array<PEGASUS_ARRAY_T>::swap(Array<PEGASUS_ARRAY_T>& x) | void Array<PEGASUS_ARRAY_T>::swap(Array<PEGASUS_ARRAY_T>& x) |
{ | { |
Rep* tmp = _rep; |
ArrayRep<PEGASUS_ARRAY_T>* tmp = static_cast<ArrayRep<PEGASUS_ARRAY_T>*>(_rep); |
_rep = x._rep; |
_rep = static_cast<ArrayRep<PEGASUS_ARRAY_T>*>(x._rep); |
x._rep = tmp; | x._rep = tmp; |
} | } |
| |
#ifndef PEGASUS_ARRAY_T | #ifndef PEGASUS_ARRAY_T |
template<class PEGASUS_ARRAY_T> | template<class PEGASUS_ARRAY_T> |
#else |
|
PEGASUS_TEMPLATE_SPECIALIZATION |
|
#endif | #endif |
Uint32 Array<PEGASUS_ARRAY_T>::size() const | Uint32 Array<PEGASUS_ARRAY_T>::size() const |
{ | { |
return _rep->size; |
return static_cast<ArrayRep<PEGASUS_ARRAY_T>*>(_rep)->size; |
} | } |
| |
#ifndef PEGASUS_ARRAY_T | #ifndef PEGASUS_ARRAY_T |
template<class PEGASUS_ARRAY_T> | template<class PEGASUS_ARRAY_T> |
#else |
|
PEGASUS_TEMPLATE_SPECIALIZATION |
|
#endif | #endif |
Uint32 Array<PEGASUS_ARRAY_T>::getCapacity() const | Uint32 Array<PEGASUS_ARRAY_T>::getCapacity() const |
{ | { |
return _rep->capacity; |
return static_cast<ArrayRep<PEGASUS_ARRAY_T>*>(_rep)->capacity; |
} | } |
| |
#ifndef PEGASUS_ARRAY_T | #ifndef PEGASUS_ARRAY_T |
template<class PEGASUS_ARRAY_T> | template<class PEGASUS_ARRAY_T> |
#else |
|
PEGASUS_TEMPLATE_SPECIALIZATION |
|
#endif | #endif |
const PEGASUS_ARRAY_T* Array<PEGASUS_ARRAY_T>::getData() const | const PEGASUS_ARRAY_T* Array<PEGASUS_ARRAY_T>::getData() const |
{ | { |
return _rep->data(); |
return static_cast<ArrayRep<PEGASUS_ARRAY_T>*>(_rep)->data(); |
|
} |
|
|
|
#ifndef PEGASUS_ARRAY_T |
|
template<class PEGASUS_ARRAY_T> |
|
#endif |
|
PEGASUS_ARRAY_T& Array<PEGASUS_ARRAY_T>::operator[](Uint32 pos) |
|
{ |
|
if (pos >= size()) |
|
ThrowOutOfBounds(); |
|
|
|
return static_cast<ArrayRep<PEGASUS_ARRAY_T>*>(_rep)->data()[pos]; |
|
} |
|
|
|
#ifndef PEGASUS_ARRAY_T |
|
template<class PEGASUS_ARRAY_T> |
|
#endif |
|
const PEGASUS_ARRAY_T& Array<PEGASUS_ARRAY_T>::operator[](Uint32 pos) const |
|
{ |
|
if (pos >= size()) |
|
ThrowOutOfBounds(); |
|
|
|
return static_cast<ArrayRep<PEGASUS_ARRAY_T>*>(_rep)->data()[pos]; |
} | } |
| |
#ifndef PEGASUS_ARRAY_T | #ifndef PEGASUS_ARRAY_T |
template<class PEGASUS_ARRAY_T> | template<class PEGASUS_ARRAY_T> |
#else |
|
PEGASUS_TEMPLATE_SPECIALIZATION |
|
#endif | #endif |
void Array<PEGASUS_ARRAY_T>::append(const PEGASUS_ARRAY_T& x) | void Array<PEGASUS_ARRAY_T>::append(const PEGASUS_ARRAY_T& x) |
{ | { |
reserve(size() + 1); | reserve(size() + 1); |
new (_data() + size()) PEGASUS_ARRAY_T(x); | new (_data() + size()) PEGASUS_ARRAY_T(x); |
_rep->size++; |
static_cast<ArrayRep<PEGASUS_ARRAY_T>*>(_rep)->size++; |
} | } |
| |
#ifndef PEGASUS_ARRAY_T | #ifndef PEGASUS_ARRAY_T |
template<class PEGASUS_ARRAY_T> | template<class PEGASUS_ARRAY_T> |
#else |
|
PEGASUS_TEMPLATE_SPECIALIZATION |
|
#endif | #endif |
void Array<PEGASUS_ARRAY_T>::append(const PEGASUS_ARRAY_T* x, Uint32 size) | void Array<PEGASUS_ARRAY_T>::append(const PEGASUS_ARRAY_T* x, Uint32 size) |
{ | { |
reserve(this->size() + size); | reserve(this->size() + size); |
#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 |
static_cast<ArrayRep<PEGASUS_ARRAY_T>*>(_rep)->size += size; |
_rep->size += size; |
|
} | } |
| |
#ifndef PEGASUS_ARRAY_T | #ifndef PEGASUS_ARRAY_T |
template<class PEGASUS_ARRAY_T> | template<class PEGASUS_ARRAY_T> |
#else |
|
PEGASUS_TEMPLATE_SPECIALIZATION |
|
#endif | #endif |
void Array<PEGASUS_ARRAY_T>::appendArray(const Array<PEGASUS_ARRAY_T>& x) | void Array<PEGASUS_ARRAY_T>::appendArray(const Array<PEGASUS_ARRAY_T>& x) |
{ | { |
|
|
| |
#ifndef PEGASUS_ARRAY_T | #ifndef PEGASUS_ARRAY_T |
template<class PEGASUS_ARRAY_T> | template<class PEGASUS_ARRAY_T> |
#else |
|
PEGASUS_TEMPLATE_SPECIALIZATION |
|
#endif | #endif |
void Array<PEGASUS_ARRAY_T>::prepend(const PEGASUS_ARRAY_T& x) | void Array<PEGASUS_ARRAY_T>::prepend(const PEGASUS_ARRAY_T& x) |
{ | { |
|
|
| |
#ifndef PEGASUS_ARRAY_T | #ifndef PEGASUS_ARRAY_T |
template<class PEGASUS_ARRAY_T> | template<class PEGASUS_ARRAY_T> |
#else |
|
PEGASUS_TEMPLATE_SPECIALIZATION |
|
#endif | #endif |
void Array<PEGASUS_ARRAY_T>::prepend(const PEGASUS_ARRAY_T* x, Uint32 size) | void Array<PEGASUS_ARRAY_T>::prepend(const PEGASUS_ARRAY_T* x, Uint32 size) |
{ | { |
reserve(this->size() + size); | reserve(this->size() + size); |
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 |
static_cast<ArrayRep<PEGASUS_ARRAY_T>*>(_rep)->size += size; |
_rep->size += size; |
|
} | } |
| |
#ifndef PEGASUS_ARRAY_T | #ifndef PEGASUS_ARRAY_T |
template<class PEGASUS_ARRAY_T> | template<class PEGASUS_ARRAY_T> |
#else |
|
PEGASUS_TEMPLATE_SPECIALIZATION |
|
#endif | #endif |
void Array<PEGASUS_ARRAY_T>::insert(Uint32 pos, const PEGASUS_ARRAY_T& x) | void Array<PEGASUS_ARRAY_T>::insert(Uint32 pos, const PEGASUS_ARRAY_T& x) |
{ | { |
|
|
| |
#ifndef PEGASUS_ARRAY_T | #ifndef PEGASUS_ARRAY_T |
template<class PEGASUS_ARRAY_T> | template<class PEGASUS_ARRAY_T> |
#else |
|
PEGASUS_TEMPLATE_SPECIALIZATION |
|
#endif | #endif |
void Array<PEGASUS_ARRAY_T>::insert(Uint32 pos, const PEGASUS_ARRAY_T* x, Uint32 size) | void Array<PEGASUS_ARRAY_T>::insert(Uint32 pos, const PEGASUS_ARRAY_T* x, Uint32 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 |
static_cast<ArrayRep<PEGASUS_ARRAY_T>*>(_rep)->size += size; |
_rep->size += size; |
|
} | } |
| |
#ifndef PEGASUS_ARRAY_T | #ifndef PEGASUS_ARRAY_T |
template<class PEGASUS_ARRAY_T> | template<class PEGASUS_ARRAY_T> |
#else |
|
PEGASUS_TEMPLATE_SPECIALIZATION |
|
#endif | #endif |
void Array<PEGASUS_ARRAY_T>::remove(Uint32 pos) | void Array<PEGASUS_ARRAY_T>::remove(Uint32 pos) |
{ | { |
|
|
| |
#ifndef PEGASUS_ARRAY_T | #ifndef PEGASUS_ARRAY_T |
template<class PEGASUS_ARRAY_T> | template<class PEGASUS_ARRAY_T> |
#else |
|
PEGASUS_TEMPLATE_SPECIALIZATION |
|
#endif | #endif |
void Array<PEGASUS_ARRAY_T>::remove(Uint32 pos, Uint32 size) | void Array<PEGASUS_ARRAY_T>::remove(Uint32 pos, Uint32 size) |
{ | { |
if (pos + size - 1 > this->size()) | if (pos + size - 1 > this->size()) |
ThrowOutOfBounds(); | ThrowOutOfBounds(); |
| |
#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); |
| |
|
|
memmove( | memmove( |
_data() + pos, _data() + pos + size, sizeof(PEGASUS_ARRAY_T) * rem); | _data() + pos, _data() + pos + size, sizeof(PEGASUS_ARRAY_T) * rem); |
| |
_rep->size -= size; |
static_cast<ArrayRep<PEGASUS_ARRAY_T>*>(_rep)->size -= size; |
} | } |
| |
#ifdef PEGASUS_HAS_EBCDIC | #ifdef PEGASUS_HAS_EBCDIC |
| |
#ifndef PEGASUS_ARRAY_T | #ifndef PEGASUS_ARRAY_T |
template<class PEGASUS_ARRAY_T> | template<class PEGASUS_ARRAY_T> |
#else |
|
PEGASUS_TEMPLATE_SPECIALIZATION |
|
#endif | #endif |
void Array<PEGASUS_ARRAY_T>::etoa() | void Array<PEGASUS_ARRAY_T>::etoa() |
{ | { |
#if PEGASUS_ARRAY_T == Sint8 | #if PEGASUS_ARRAY_T == Sint8 |
__etoa_l((char *)_data(),_rep->size); |
__etoa_l((char *)_data(),static_cast<ArrayRep<PEGASUS_ARRAY_T>*>(_rep)->size); |
#endif | #endif |
} | } |
| |
#ifndef PEGASUS_ARRAY_T | #ifndef PEGASUS_ARRAY_T |
template<class PEGASUS_ARRAY_T> | template<class PEGASUS_ARRAY_T> |
#else |
|
PEGASUS_TEMPLATE_SPECIALIZATION |
|
#endif | #endif |
void Array<PEGASUS_ARRAY_T>::atoe() | void Array<PEGASUS_ARRAY_T>::atoe() |
{ | { |
#if PEGASUS_ARRAY_T == Sint8 | #if PEGASUS_ARRAY_T == Sint8 |
__atoe_l((char *)_data(),_rep->size); |
__atoe_l((char *)_data(),static_cast<ArrayRep<PEGASUS_ARRAY_T>*>(_rep)->size); |
#endif | #endif |
} | } |
| |
|
|
| |
#ifndef PEGASUS_ARRAY_T | #ifndef PEGASUS_ARRAY_T |
template<class PEGASUS_ARRAY_T> | template<class PEGASUS_ARRAY_T> |
#else |
|
PEGASUS_TEMPLATE_SPECIALIZATION |
|
#endif | #endif |
PEGASUS_ARRAY_T* Array<PEGASUS_ARRAY_T>::begin() | PEGASUS_ARRAY_T* Array<PEGASUS_ARRAY_T>::begin() |
{ | { |
return _rep->data(); |
return static_cast<ArrayRep<PEGASUS_ARRAY_T>*>(_rep)->data(); |
} | } |
| |
#ifndef PEGASUS_ARRAY_T | #ifndef PEGASUS_ARRAY_T |
template<class PEGASUS_ARRAY_T> | template<class PEGASUS_ARRAY_T> |
#else |
|
PEGASUS_TEMPLATE_SPECIALIZATION |
|
#endif | #endif |
PEGASUS_ARRAY_T* Array<PEGASUS_ARRAY_T>::end() | PEGASUS_ARRAY_T* Array<PEGASUS_ARRAY_T>::end() |
{ | { |
return _rep->data() + size(); |
return static_cast<ArrayRep<PEGASUS_ARRAY_T>*>(_rep)->data() + size(); |
} | } |
| |
#ifndef PEGASUS_ARRAY_T | #ifndef PEGASUS_ARRAY_T |
template<class PEGASUS_ARRAY_T> | template<class PEGASUS_ARRAY_T> |
#else |
|
PEGASUS_TEMPLATE_SPECIALIZATION |
|
#endif | #endif |
const PEGASUS_ARRAY_T* Array<PEGASUS_ARRAY_T>::begin() const | const PEGASUS_ARRAY_T* Array<PEGASUS_ARRAY_T>::begin() const |
{ | { |
|
|
| |
#ifndef PEGASUS_ARRAY_T | #ifndef PEGASUS_ARRAY_T |
template<class PEGASUS_ARRAY_T> | template<class PEGASUS_ARRAY_T> |
#else |
|
PEGASUS_TEMPLATE_SPECIALIZATION |
|
#endif | #endif |
const PEGASUS_ARRAY_T* Array<PEGASUS_ARRAY_T>::end() const | const PEGASUS_ARRAY_T* Array<PEGASUS_ARRAY_T>::end() const |
{ | { |
|
|
| |
#ifndef PEGASUS_ARRAY_T | #ifndef PEGASUS_ARRAY_T |
template<class PEGASUS_ARRAY_T> | template<class PEGASUS_ARRAY_T> |
#else |
|
PEGASUS_TEMPLATE_SPECIALIZATION |
|
#endif |
|
void Array<PEGASUS_ARRAY_T>::set(ArrayRep<PEGASUS_ARRAY_T>* rep) |
|
{ |
|
if (_rep != rep) |
|
{ |
|
Rep::destroy(_rep); |
|
_rep = rep->clone(); |
|
} |
|
} |
|
|
|
#ifndef PEGASUS_ARRAY_T |
|
template<class PEGASUS_ARRAY_T> |
|
#else |
|
PEGASUS_TEMPLATE_SPECIALIZATION |
|
#endif | #endif |
PEGASUS_ARRAY_T* Array<PEGASUS_ARRAY_T>::_data() const | PEGASUS_ARRAY_T* Array<PEGASUS_ARRAY_T>::_data() const |
{ | { |
return _rep->data(); |
return static_cast<ArrayRep<PEGASUS_ARRAY_T>*>(_rep)->data(); |
} |
|
|
|
|
|
#ifndef PEGASUS_ARRAY_T |
|
template<class PEGASUS_ARRAY_T> |
|
#else |
|
PEGASUS_TEMPLATE_SPECIALIZATION |
|
#endif |
|
Boolean operator==( |
|
const Array<PEGASUS_ARRAY_T>& x, |
|
const Array<PEGASUS_ARRAY_T>& y) |
|
{ |
|
return Equal(x, y); |
|
} |
|
|
|
#ifndef PEGASUS_ARRAY_T |
|
template<class PEGASUS_ARRAY_T> |
|
#else |
|
PEGASUS_TEMPLATE_SPECIALIZATION |
|
#endif |
|
PEGASUS_ARRAY_T& Array<PEGASUS_ARRAY_T>::operator[](Uint32 pos) |
|
{ |
|
if (pos >= size()) |
|
ThrowOutOfBounds(); |
|
|
|
return _rep->data()[pos]; |
|
} |
|
|
|
#ifndef PEGASUS_ARRAY_T |
|
template<class PEGASUS_ARRAY_T> |
|
#else |
|
PEGASUS_TEMPLATE_SPECIALIZATION |
|
#endif |
|
const PEGASUS_ARRAY_T& Array<PEGASUS_ARRAY_T>::operator[]( |
|
Uint32 pos) const |
|
{ |
|
if (pos >= size()) |
|
ThrowOutOfBounds(); |
|
|
|
return _rep->data()[pos]; |
|
} | } |
| |
#endif /*defined(PEGASUS_EXPLICIT_INSTANTIATION) || !defined(PEGASUS_ARRAY_T)*/ |
#endif //!defined(Pegasus_ArrayImpl_h) || !defined(PEGASUS_ARRAY_T) |
|
//#endif /*defined(PEGASUS_EXPLICIT_INSTANTIATION) || !defined(PEGASUS_ARRAY_T)*/ |