Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

array.h File Reference

Go to the source code of this file.

Classes

class  PAbstractArray
class  PCharArray
 Array of characters. More...

class  PShortArray
 Array of short integers. More...

class  PIntArray
 Array of integers. More...

class  PLongArray
 Array of long integers. More...

class  PBYTEArray
 Array of unsigned characters. More...

class  PWORDArray
 Array of unsigned short integers. More...

class  PUnsignedArray
 Array of unsigned integers. More...


Overrides from class PObject

virtual void PrintOn (ostream &strm) const
 Print the array.

virtual void ReadFrom (istream &strm)
 Read the array.


Defines

#define PBASEARRAY(cls, T)
#define PDECLARE_BASEARRAY(cls, T)
#define PSCALAR_ARRAY(cls, T)   PBASEARRAY(cls, T)
#define PARRAY(cls, T)
#define PDECLARE_ARRAY(cls, T)

Functions

 PSCALAR_ARRAY (PShortArray, short)
 PSCALAR_ARRAY (PIntArray, int)
 PSCALAR_ARRAY (PLongArray, long)
 PDECLARE_BASEARRAY (PBYTEArray, BYTE)
 PSCALAR_ARRAY (PWORDArray, WORD)
 PSCALAR_ARRAY (PUnsignedArray, unsigned)


Define Documentation

#define PARRAY cls,
 ) 
 

Value:

class cls : public PArrayObjects { \ PCLASSINFO(cls, PArrayObjects); \ protected: \ inline cls(int dummy, const cls * c) \ : PArrayObjects(dummy, c) { } \ public: \ inline cls(PINDEX initialSize = 0) \ : PArrayObjects(initialSize) { } \ virtual PObject * Clone() const \ { return PNEW cls(0, this); } \ inline T & operator[](PINDEX index) const\ { PObject * obj = GetAt(index); \ PAssert(obj != NULL, PInvalidArrayElement); \ /* want to do to this, but gcc 3.0 complains --> return *(T *)obj; } */ \ return (T &)*obj; } \ }

#define PBASEARRAY cls,
 ) 
 

Value:

typedef T P_##cls##_Base_Type; \ class cls : public PAbstractArray { \ PCLASSINFO(cls, PAbstractArray) \ public: \ inline cls(PINDEX initialSize = 0) \ : PAbstractArray(sizeof(P_##cls##_Base_Type), initialSize) { } \ inline cls(P_##cls##_Base_Type const * buffer, PINDEX length, BOOL dynamic = TRUE) \ : PAbstractArray(sizeof(P_##cls##_Base_Type), buffer, length, dynamic) { } \ virtual PObject * Clone() const \ { return PNEW cls(*this, GetSize()); } \ inline BOOL SetAt(PINDEX index, P_##cls##_Base_Type val) \ { return SetMinSize(index+1) && \ val==(((P_##cls##_Base_Type *)theArray)[index] = val); } \ inline P_##cls##_Base_Type GetAt(PINDEX index) const \ { PASSERTINDEX(index); return index < GetSize() ? \ ((P_##cls##_Base_Type*)theArray)[index] : (P_##cls##_Base_Type)0; } \ inline P_##cls##_Base_Type operator[](PINDEX index) const \ { PASSERTINDEX(index); return GetAt(index); } \ inline P_##cls##_Base_Type & operator[](PINDEX index) \ { PASSERTINDEX(index); PAssert(SetMinSize(index+1), POutOfMemory); \ return ((P_##cls##_Base_Type *)theArray)[index]; } \ inline void Attach(const P_##cls##_Base_Type * buffer, PINDEX bufferSize) \ { PAbstractArray::Attach(buffer, bufferSize); } \ inline P_##cls##_Base_Type * GetPointer(PINDEX minSize = 0) \ { return (P_##cls##_Base_Type *)PAbstractArray::GetPointer(minSize); } \ inline operator P_##cls##_Base_Type const *() const \ { return (P_##cls##_Base_Type const *)theArray; } \ inline BOOL Concatenate(cls const & array) \ { return PAbstractArray::Concatenate(array); } \ }

#define PDECLARE_ARRAY cls,
 ) 
 

Value:

PARRAY(cls##_PTemplate, T); \ PDECLARE_CLASS(cls, cls##_PTemplate) \ protected: \ inline cls(int dummy, const cls * c) \ : cls##_PTemplate(dummy, c) { } \ public: \ inline cls(PINDEX initialSize = 0) \ : cls##_PTemplate(initialSize) { } \ virtual PObject * Clone() const \ { return PNEW cls(0, this); } \

#define PDECLARE_BASEARRAY cls,
 ) 
 

Value:

PBASEARRAY(cls##_PTemplate, T); \ PDECLARE_CLASS(cls, cls##_PTemplate) \ cls(PINDEX initialSize = 0) \ : cls##_PTemplate(initialSize) { } \ cls(T const * buffer, PINDEX length, BOOL dynamic = TRUE) \ : cls##_PTemplate(buffer, length, dynamic) { } \ virtual PObject * Clone() const \ { return PNEW cls(*this, GetSize()); } \

#define PSCALAR_ARRAY cls,
 )     PBASEARRAY(cls, T)
 


Function Documentation

PDECLARE_BASEARRAY PBYTEArray  ,
BYTE 
 

virtual void PrintOn ostream &  strm  )  const [virtual]
 

Print the array.

Parameters:
strm  Stream to output to.

PSCALAR_ARRAY PUnsignedArray  ,
unsigned 
 

PSCALAR_ARRAY PWORDArray  ,
WORD 
 

PSCALAR_ARRAY PLongArray  ,
long 
 

PSCALAR_ARRAY PIntArray  ,
int 
 

PSCALAR_ARRAY PShortArray  ,
short 
 

virtual void ReadFrom istream &  strm  )  [virtual]
 

Read the array.


Generated on Sat Jul 24 15:35:57 2004 for PWLib by doxygen 1.3.7