83 PINDEX elementSizeInBytes,
84 PINDEX initialSize = 0
106 PINDEX elementSizeInBytes,
109 PINDEX bufferSizeInElements,
238 PINDEX elementSizeInBytes
286 PINDEX initialSize = 0
419 operator T
const *()
const {
446 stream << GetAt(index);
460 #define PBASEARRAY(cls, T) typedef PBaseArray<T> cls 474 #define PDECLARE_BASEARRAY(cls, T) \ 475 PDECLARE_CLASS(cls, PBaseArray<T>) \ 476 cls(PINDEX initialSize = 0) \ 477 : PBaseArray<T>(initialSize) { } \ 478 cls(PContainerReference & reference) \ 479 : PBaseArray<T>(reference) { } \ 480 cls(T const * buffer, PINDEX length, PBoolean dynamic = true) \ 481 : PBaseArray<T>(buffer, length, dynamic) { } \ 482 virtual PObject * Clone() const \ 483 { return PNEW cls(*this, GetSize()); } \ 513 PINDEX initialSize = 0
522 ) :
PBaseArray<T>(buffer, length, dynamic) { }
533 this->SetAt(index, t);
546 #define PSCALAR_ARRAY(cls, T) typedef PScalarArray<T> cls 559 PINDEX initialSize = 0
597 PINDEX initialSize = 0
603 short const * buffer,
624 PINDEX initialSize = 0
651 PINDEX initialSize = 0
678 PINDEX initialSize = 0
718 PINDEX initialSize = 0
745 PINDEX initialSize = 0
751 unsigned const * buffer,
772 PINDEX initialSize = 0
778 DWORD
const * buffer,
826 PINDEX initialSize = 0
866 virtual PINDEX
GetSize()
const;
890 virtual PINDEX Append(
909 virtual PINDEX Insert(
924 virtual PINDEX InsertAt(
985 virtual PINDEX GetObjectsIndex(
998 virtual PINDEX GetValuesIndex(
1008 virtual void RemoveAll();
1037 PINDEX initialSize = 0
1084 #define PARRAY(cls, T) typedef PArray<T> cls 1099 #define PDECLARE_ARRAY(cls, T) \ 1100 PARRAY(cls##_PTemplate, T); \ 1101 PDECLARE_CLASS(cls, cls##_PTemplate) \ 1103 inline cls(int dummy, const cls * c) \ 1104 : cls##_PTemplate(dummy, c) { } \ 1106 inline cls(PINDEX initialSize = 0) \ 1107 : cls##_PTemplate(initialSize) { } \ 1108 virtual PObject * Clone() const \ 1109 { return PNEW cls(0, this); } \ 1124 PINDEX initialSize = 0
1130 const void * buffer,
1151 virtual PINDEX
GetSize()
const;
1195 const void * buffer,
1230 )
const {
return GetAt(index); }
1239 ) { SetAt(index,
true);
return *
this; }
1248 ) { SetAt(index,
false);
return *
this; }
1268 #endif // PTLIB_ARRAY_H virtual PObject * Clone() const
Create a copy of the class on the heap.
virtual void PrintElementOn(ostream &stream, PINDEX index) const
Definition: array.h:442
T & operator[](PINDEX index) const
Retrieve a reference to the object in the array.
Definition: array.h:1059
An array of objects.
Definition: array.h:813
virtual void ReadElementFrom(istream &stream, PINDEX index)
Definition: array.h:526
Array of characters.
Definition: array.h:551
#define PCLASSINFO(cls, par)
Declare all the standard PTLib class information.
Definition: object.h:1049
PBitArray & operator+=(PINDEX index)
Set a bit to the array.
Definition: array.h:1237
T & operator[](PINDEX index)
Get a reference to value from the array.
Definition: array.h:398
This template class maps the PAbstractArray to a specific element type.
Definition: array.h:274
PBaseArray(PINDEX initialSize=0)
Construct a new dynamic array of elements of the specified type.
Definition: array.h:285
void Attach(const T *buffer, PINDEX bufferSize)
Attach a pointer to a static block to the base array type.
Definition: array.h:344
void * GetPointer(PINDEX minSize=1)
Get a pointer to the internal array and assure that it is of at least the specified size...
virtual PObject * Clone() const
Clone the object.
Definition: array.h:302
#define PINLINE
Definition: object.h:127
T operator[](PINDEX index) const
Get a value from the array.
Definition: array.h:382
#define PSCALAR_ARRAY(cls, T)
Declare a dynamic array base type.
Definition: array.h:546
PBoolean SetAt(PINDEX index, T val)
Set the specific element in the array.
Definition: array.h:316
Comparison
Result of the comparison operation performed by the Compare() function.
Definition: object.h:1184
A new or malloc failed.
Definition: object.h:152
T GetAt(PINDEX index) const
Get a value from the array.
Definition: array.h:329
virtual void PrintElementOn(ostream &stream, PINDEX index) const
virtual void ReadElementFrom(istream &stream, PINDEX index)
PScalarArray(PINDEX initialSize=0)
Construct a new dynamic array of elements of the specified type.
Definition: array.h:512
Array of unsigned long integers.
Definition: array.h:764
PBaseArray(T const *buffer, PINDEX length, PBoolean dynamic=true)
Construct a new dynamic array of elements of the specified type.
Definition: array.h:291
This class contains a variable length array of arbitrary memory blocks.
Definition: array.h:67
BOOL PBoolean
Definition: object.h:102
PBaseArray< PObject * > * theArray
Definition: array.h:1013
Array of unsigned characters.
Definition: array.h:670
Array of unsigned short integers.
Definition: array.h:710
void Attach(const void *buffer, PINDEX bufferSize)
Attach a pointer to a static block to the base array type.
char * theArray
Pointer to the allocated block of memory.
Definition: array.h:245
PINDEX elementSize
Size of an element in bytes.
Definition: array.h:242
virtual PObject * Clone() const
Make a complete duplicate of the array.
Definition: array.h:1046
PBaseArray(PContainerReference &reference)
Definition: array.h:449
virtual void ReadFrom(istream &strm)
Input the contents of the object from the stream.
#define PDECLARE_BASEARRAY(cls, T)
Begin a declaration of an array of base types.
Definition: array.h:474
This class represents a dynamic bit array.
Definition: array.h:1114
Array of unsigned integers.
Definition: array.h:737
T * GetPointer(PINDEX minSize=0)
Get a pointer to the internal array and assure that it is of at least the specified size...
Definition: array.h:364
#define PCONTAINERINFO(cls, par)
Macro to declare funtions required in a container.
Definition: contain.h:343
Array of short integers.
Definition: array.h:589
Abstract class to embody the base functionality of a container.
Definition: contain.h:104
PBoolean InternalSetSize(PINDEX newSize, PBoolean force)
Array of long integers.
Definition: array.h:643
PArray(int dummy, const PArray *c)
Definition: array.h:1069
PBitArray & operator-=(PINDEX index)
Set a bit to the array.
Definition: array.h:1246
virtual void PrintOn(ostream &strm) const
Output the contents of the object to the stream.
PBoolean allocatedDynamically
Flag indicating the array was allocated on the heap.
Definition: array.h:248
PBoolean SetMinSize(PINDEX minSize)
Set the minimum size of container.
This template class maps the PArrayObjects to a specific object type.
Definition: array.h:1024
#define PAssert(b, msg)
This macro is used to assert that a condition must be true.
Definition: object.h:192
This template class maps the PAbstractArray to a specific element type.
Definition: array.h:502
PArray(PINDEX initialSize=0)
Create a new array of objects.
Definition: array.h:1036
A NULL array element object was accessed.
Definition: object.h:156
virtual PINDEX GetSize() const
Get the current size of the container.
virtual Comparison Compare(const PObject &obj) const
Get the relative rank of the two arrays.
virtual PBoolean SetSize(PINDEX newSize)
Set the size of the array in elements.
PContainerReference * reference
Definition: contain.h:291
Array of integers.
Definition: array.h:616
PBoolean Concatenate(const PBaseArray &array)
Concatenate one array to the end of this array.
Definition: array.h:434
Ultimate parent class for all objects in the class library.
Definition: object.h:1118
A collection is a container that collects together descendents of the PObject class.
Definition: contain.h:395
friend class PArrayObjects
Definition: array.h:250
PScalarArray(T const *buffer, PINDEX length, PBoolean dynamic=true)
Construct a new dynamic array of elements of the specified type.
Definition: array.h:518
PBoolean operator[](PINDEX index) const
Get a value from the array.
Definition: array.h:1228
PBoolean Concatenate(const PAbstractArray &array)
Concatenate one array to the end of this array.
#define PNEW
Macro for overriding system default new operator.
Definition: object.h:890
PAbstractArray(PINDEX elementSizeInBytes, PINDEX initialSize=0)
Create a new dynamic array of initalSize elements of elementSizeInBytes bytes each.