array.h

Go to the documentation of this file.
00001 /*
00002  * array.h
00003  *
00004  * Linear Array Container classes.
00005  *
00006  * Portable Windows Library
00007  *
00008  * Copyright (c) 1993-1998 Equivalence Pty. Ltd.
00009  *
00010  * The contents of this file are subject to the Mozilla Public License
00011  * Version 1.0 (the "License"); you may not use this file except in
00012  * compliance with the License. You may obtain a copy of the License at
00013  * http://www.mozilla.org/MPL/
00014  *
00015  * Software distributed under the License is distributed on an "AS IS"
00016  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
00017  * the License for the specific language governing rights and limitations
00018  * under the License.
00019  *
00020  * The Original Code is Portable Windows Library.
00021  *
00022  * The Initial Developer of the Original Code is Equivalence Pty. Ltd.
00023  *
00024  * Portions are Copyright (C) 1993 Free Software Foundation, Inc.
00025  * All Rights Reserved.
00026  *
00027  * Contributor(s): ______________________________________.
00028  *
00029  * $Log: array.h,v $
00030  * Revision 1.35  2006/06/30 00:56:31  csoutheren
00031  * Applied 1494931 - various pwlib bug fixes and enhancement
00032  * Thanks to Frederich Heem
00033  *
00034  * Revision 1.34  2005/11/25 03:43:47  csoutheren
00035  * Fixed function argument comments to be compatible with Doxygen
00036  *
00037  * Revision 1.33  2005/08/08 07:01:58  rjongbloed
00038  * Minor changes to remove possible ambiguity where virtual and non-virtual
00039  *   functions are overloaded.
00040  * Removed commented out code.
00041  *
00042  * Revision 1.32  2005/05/02 09:02:35  csoutheren
00043  * Fixed previous fix to contain.cxx which broke PString::MakeUnique
00044  *
00045  * Revision 1.31  2004/05/13 02:07:14  dereksmithies
00046  * Fixes, so it works with doc++
00047  *
00048  * Revision 1.30  2004/04/09 03:42:34  csoutheren
00049  * Removed all usages of "virtual inline" and "inline virtual"
00050  *
00051  * Revision 1.29  2004/04/03 06:54:21  rjongbloed
00052  * Many and various changes to support new Visual C++ 2003
00053  *
00054  * Revision 1.28  2004/03/02 10:29:59  rjongbloed
00055  * Changed base array declaration macro to be consistent with the
00056  *   object array one, thanks Guilhem Tardy
00057  *
00058  * Revision 1.27  2003/04/17 07:24:47  robertj
00059  * Fixed GNU 3.x problem (why no other compiler?)
00060  *
00061  * Revision 1.26  2003/04/15 07:08:36  robertj
00062  * Changed read and write from streams for base array classes so operates in
00063  *   the same way for both PIntArray and PArray<int> etc
00064  *
00065  * Revision 1.25  2003/03/31 01:23:56  robertj
00066  * Added ReadFrom functions for standard container classes such as
00067  *   PIntArray and PStringList etc
00068  *
00069  * Revision 1.24  2002/09/16 01:08:59  robertj
00070  * Added #define so can select if #pragma interface/implementation is used on
00071  *   platform basis (eg MacOS) rather than compiler, thanks Robert Monaghan.
00072  *
00073  * Revision 1.23  2002/06/20 06:08:59  robertj
00074  * Fixed GNU warning
00075  *
00076  * Revision 1.22  2002/06/14 13:20:37  robertj
00077  * Added PBitArray class.
00078  *
00079  * Revision 1.21  2002/02/14 23:37:53  craigs
00080  * Added fix for optimisation for PArray [] operator, thanks to Vyacheslav Frolov
00081  *
00082  * Revision 1.20  2002/02/14 05:11:50  robertj
00083  * Minor optimisation in the operator[] for arrays of PObjects.
00084  *
00085  * Revision 1.19  1999/11/30 00:22:54  robertj
00086  * Updated documentation for doc++
00087  *
00088  * Revision 1.18  1999/09/03 15:08:38  robertj
00089  * Fixed typo in ancestor class name
00090  *
00091  * Revision 1.17  1999/08/22 12:13:42  robertj
00092  * Fixed warning when using inlines on older GNU compiler
00093  *
00094  * Revision 1.16  1999/08/20 03:07:44  robertj
00095  * Fixed addded Concatenate function for non-template version.
00096  *
00097  * Revision 1.15  1999/08/18 01:45:12  robertj
00098  * Added concatenation function to "base type" arrays.
00099  *
00100  * Revision 1.14  1999/03/09 02:59:49  robertj
00101  * Changed comments to doc++ compatible documentation.
00102  *
00103  * Revision 1.13  1999/02/16 08:07:11  robertj
00104  * MSVC 6.0 compatibility changes.
00105  *
00106  * Revision 1.12  1998/09/23 06:20:16  robertj
00107  * Added open source copyright license.
00108  *
00109  * Revision 1.11  1998/08/21 05:23:57  robertj
00110  * Added hex dump capability to base array types.
00111  * Added ability to have base arrays of static memory blocks.
00112  *
00113  * Revision 1.10  1997/06/08 04:49:10  robertj
00114  * Fixed non-template class descendent order.
00115  *
00116  * Revision 1.9  1996/08/17 09:54:34  robertj
00117  * Optimised RemoveAll() for object arrays.
00118  *
00119  * Revision 1.8  1996/01/02 11:48:46  robertj
00120  * Removed requirement that PArray elements have parameterless constructor..
00121  *
00122  * Revision 1.7  1995/10/14 14:52:33  robertj
00123  * Changed arrays to not break references.
00124  *
00125  * Revision 1.6  1995/06/17 11:12:18  robertj
00126  * Documentation update.
00127  *
00128  * Revision 1.5  1995/03/14 12:40:58  robertj
00129  * Updated documentation to use HTML codes.
00130  *
00131  * Revision 1.4  1995/02/22  10:50:26  robertj
00132  * Changes required for compiling release (optimised) version.
00133  *
00134  * Revision 1.3  1995/01/15  04:49:09  robertj
00135  * Fixed errors in template version.
00136  *
00137  * Revision 1.2  1994/12/21  11:52:46  robertj
00138  * Documentation and variable normalisation.
00139  *
00140  * Revision 1.1  1994/12/12  09:59:29  robertj
00141  * Initial revision
00142  *
00143  */
00144 
00145 #ifndef _ARRAY_H_
00146 #define _ARRAY_H_
00147 
00148 #ifdef P_USE_PRAGMA
00149 #pragma interface
00150 #endif
00151 
00152 #include <ptlib/contain.h>
00153 
00155 // The abstract array class
00156 
00178 class PAbstractArray : public PContainer
00179 {
00180   PCONTAINERINFO(PAbstractArray, PContainer);
00181 
00182   public:
00194     PAbstractArray(
00195       PINDEX elementSizeInBytes,  
00196 
00197       PINDEX initialSize = 0      
00198     );
00199 
00217     PAbstractArray(
00218       PINDEX elementSizeInBytes,   
00219 
00220       const void *buffer,          
00221       PINDEX bufferSizeInElements, 
00222       BOOL dynamicAllocation       
00223     );
00225 
00234     virtual void PrintOn(
00235       ostream &strm   // Stream to print the object into.
00236     ) const;
00237 
00244     virtual void ReadFrom(
00245       istream &strm   // Stream to read the objects contents from.
00246     );
00247 
00268     virtual Comparison Compare(
00269       const PObject & obj   
00270     ) const;
00272 
00283     virtual BOOL SetSize(
00284       PINDEX newSize  
00285     );
00287 
00298     void Attach(
00299       const void *buffer, 
00300       PINDEX bufferSize   
00301     );
00302 
00316     void * GetPointer(
00317       PINDEX minSize = 1  
00318     );
00319 
00332     BOOL Concatenate(
00333       const PAbstractArray & array  
00334     );
00336 
00337   protected:
00338     BOOL InternalSetSize(PINDEX newSize, BOOL force);
00339 
00340     virtual void PrintElementOn(
00341       ostream & stream,
00342       PINDEX index
00343     ) const;
00344     virtual void ReadElementFrom(
00345       istream & stream,
00346       PINDEX index
00347     );
00348 
00350     PINDEX elementSize;
00351 
00353     char * theArray;
00354 
00356     BOOL allocatedDynamically;
00357 
00358   friend class PArrayObjects;
00359 };
00360 
00361 
00363 // An array of some base type
00364 
00365 #ifdef PHAS_TEMPLATES
00366 
00386 template <class T> class PBaseArray : public PAbstractArray
00387 {
00388   PCLASSINFO(PBaseArray, PAbstractArray);
00389 
00390   public:
00398     PBaseArray(
00399       PINDEX initialSize = 0  
00400     ) : PAbstractArray(sizeof(T), initialSize) { }
00401     
00404     PBaseArray(
00405       T const * buffer,   
00406       PINDEX length,      
00407       BOOL dynamic = TRUE 
00408     ) : PAbstractArray(sizeof(T), buffer, length, dynamic) { }
00410 
00415     virtual PObject * Clone() const
00416     { 
00417       return PNEW PBaseArray<T>(*this, GetSize());
00418     }
00420 
00429     BOOL SetAt(
00430       PINDEX index,   
00431       T val           
00432     ) {
00433       return SetMinSize(index+1) && val==(((T *)theArray)[index] = val);
00434     }
00435 
00442     T GetAt(
00443       PINDEX index  
00444     ) const {
00445       PASSERTINDEX(index);
00446       return index < GetSize() ? ((T *)theArray)[index] : (T)0;
00447     }
00448 
00457     void Attach(
00458       const T * buffer,   
00459       PINDEX bufferSize   
00460     ) {
00461       PAbstractArray::Attach(buffer, bufferSize);
00462     }
00463 
00477     T * GetPointer(
00478       PINDEX minSize = 0    
00479     ) {
00480       return (T *)PAbstractArray::GetPointer(minSize);
00481     }
00483 
00495     T operator[](
00496       PINDEX index  
00497     ) const {
00498       return GetAt(index);
00499     }
00500 
00511     T & operator[](
00512       PINDEX index  
00513     ) {
00514       PASSERTINDEX(index);
00515       PAssert(SetMinSize(index+1), POutOfMemory);
00516       return ((T *)theArray)[index];
00517     }
00518 
00532     operator T const *() const {
00533       return (T const *)theArray;
00534     }
00535 
00547     BOOL Concatenate(
00548       const PBaseArray & array  
00549     ) {
00550       return PAbstractArray::Concatenate(array);
00551     }
00553 
00554   protected:
00555     virtual void PrintElementOn(
00556       ostream & stream,
00557       PINDEX index
00558     ) const {
00559       stream << GetAt(index);
00560     }
00561 };
00562 
00563 /*Declare a dynamic array base type.
00564    This macro is used to declare a descendent of PAbstractArray class,
00565    customised for a particular element type {\bf T}. This macro closes the
00566    class declaration off so no additional members can be added.
00567 
00568    If the compilation is using templates then this macro produces a typedef
00569    of the #PBaseArray# template class.
00570  */
00571 #define PBASEARRAY(cls, T) typedef PBaseArray<T> cls
00572 
00585 #define PDECLARE_BASEARRAY(cls, T) \
00586   PDECLARE_CLASS(cls, PBaseArray<T>) \
00587     cls(PINDEX initialSize = 0) \
00588       : PBaseArray<T>(initialSize) { } \
00589     cls(T const * buffer, PINDEX length, BOOL dynamic = TRUE) \
00590       : PBaseArray<T>(buffer, length, dynamic) { } \
00591     virtual PObject * Clone() const \
00592       { return PNEW cls(*this, GetSize()); } \
00593 
00594 
00613 template <class T> class PScalarArray : public PBaseArray<T>
00614 {
00615   public:
00623     PScalarArray(
00624       PINDEX initialSize = 0  
00625     ) : PBaseArray<T>(initialSize) { }
00626     
00629     PScalarArray(
00630       T const * buffer,   
00631       PINDEX length,      
00632       BOOL dynamic = TRUE 
00633     ) : PBaseArray<T>(buffer, length, dynamic) { }
00635 
00636   protected:
00637     virtual void ReadElementFrom(
00638       istream & stream,
00639       PINDEX index
00640     ) {
00641       T t;
00642       stream >> t;
00643       if (!stream.fail())
00644         SetAt(index, t);
00645     }
00646 };
00647 
00648 
00649 /*Declare a dynamic array base type.
00650    This macro is used to declare a descendent of PAbstractArray class,
00651    customised for a particular element type {\bf T}. This macro closes the
00652    class declaration off so no additional members can be added.
00653 
00654    If the compilation is using templates then this macro produces a typedef
00655    of the #PBaseArray# template class.
00656  */
00657 #define PSCALAR_ARRAY(cls, T) typedef PScalarArray<T> cls
00658 
00659 #else // PHAS_TEMPLATES
00660 
00661 #define PBASEARRAY(cls, T) \
00662   typedef T P_##cls##_Base_Type; \
00663   class cls : public PAbstractArray { \
00664     PCLASSINFO(cls, PAbstractArray) \
00665   public: \
00666     inline cls(PINDEX initialSize = 0) \
00667       : PAbstractArray(sizeof(P_##cls##_Base_Type), initialSize) { } \
00668     inline cls(P_##cls##_Base_Type const * buffer, PINDEX length, BOOL dynamic = TRUE) \
00669       : PAbstractArray(sizeof(P_##cls##_Base_Type), buffer, length, dynamic) { } \
00670     virtual PObject * Clone() const \
00671       { return PNEW cls(*this, GetSize()); } \
00672     inline BOOL SetAt(PINDEX index, P_##cls##_Base_Type val) \
00673       { return SetMinSize(index+1) && \
00674                      val==(((P_##cls##_Base_Type *)theArray)[index] = val); } \
00675     inline P_##cls##_Base_Type GetAt(PINDEX index) const \
00676       { PASSERTINDEX(index); return index < GetSize() ? \
00677           ((P_##cls##_Base_Type*)theArray)[index] : (P_##cls##_Base_Type)0; } \
00678     inline P_##cls##_Base_Type operator[](PINDEX index) const \
00679       { PASSERTINDEX(index); return GetAt(index); } \
00680     inline P_##cls##_Base_Type & operator[](PINDEX index) \
00681       { PASSERTINDEX(index); PAssert(SetMinSize(index+1), POutOfMemory); \
00682         return ((P_##cls##_Base_Type *)theArray)[index]; } \
00683     inline void Attach(const P_##cls##_Base_Type * buffer, PINDEX bufferSize) \
00684       { PAbstractArray::Attach(buffer, bufferSize); } \
00685     inline P_##cls##_Base_Type * GetPointer(PINDEX minSize = 0) \
00686       { return (P_##cls##_Base_Type *)PAbstractArray::GetPointer(minSize); } \
00687     inline operator P_##cls##_Base_Type const *() const \
00688       { return (P_##cls##_Base_Type const *)theArray; } \
00689     inline BOOL Concatenate(cls const & array) \
00690       { return PAbstractArray::Concatenate(array); } \
00691   }
00692 
00693 #define PDECLARE_BASEARRAY(cls, T) \
00694   PBASEARRAY(cls##_PTemplate, T); \
00695   PDECLARE_CLASS(cls, cls##_PTemplate) \
00696     cls(PINDEX initialSize = 0) \
00697       : cls##_PTemplate(initialSize) { } \
00698     cls(T const * buffer, PINDEX length, BOOL dynamic = TRUE) \
00699       : cls##_PTemplate(buffer, length, dynamic) { } \
00700     virtual PObject * Clone() const \
00701       { return PNEW cls(*this, GetSize()); } \
00702 
00703 #define PSCALAR_ARRAY(cls, T) PBASEARRAY(cls, T)
00704 
00705 #endif // PHAS_TEMPLATES
00706 
00707 
00709 #ifdef DOC_PLUS_PLUS
00710 class PCharArray : public PBaseArray {
00711   public:
00717     PCharArray(
00718       PINDEX initialSize = 0  
00719     );
00720 
00723     PCharArray(
00724       char const * buffer,   
00725       PINDEX length,      
00726       BOOL dynamic = TRUE 
00727     );
00729 #endif
00730 PDECLARE_BASEARRAY(PCharArray, char);
00731   public:
00734 
00735     virtual void PrintOn(
00736       ostream & strm 
00737     ) const;
00739     virtual void ReadFrom(
00740       istream &strm   // Stream to read the objects contents from.
00741     );
00743 };
00744 
00746 #ifdef DOC_PLUS_PLUS
00747 class PShortArray : public PBaseArray {
00748   public:
00754     PShortArray(
00755       PINDEX initialSize = 0  
00756     );
00757 
00760     PShortArray(
00761       short const * buffer,   
00762       PINDEX length,      
00763       BOOL dynamic = TRUE 
00764     );
00766 };
00767 #endif
00768 PSCALAR_ARRAY(PShortArray, short);
00769 
00770 
00772 #ifdef DOC_PLUS_PLUS
00773 class PIntArray : public PBaseArray {
00774   public:
00780     PIntArray(
00781       PINDEX initialSize = 0  
00782     );
00783 
00786     PIntArray(
00787       int const * buffer,   
00788       PINDEX length,      
00789       BOOL dynamic = TRUE 
00790     );
00792 };
00793 #endif
00794 PSCALAR_ARRAY(PIntArray, int);
00795 
00796 
00798 #ifdef DOC_PLUS_PLUS
00799 class PLongArray : public PBaseArray {
00800   public:
00806     PLongArray(
00807       PINDEX initialSize = 0  
00808     );
00809 
00812     PLongArray(
00813       long const * buffer,   
00814       PINDEX length,      
00815       BOOL dynamic = TRUE 
00816     );
00818 };
00819 #endif
00820 PSCALAR_ARRAY(PLongArray, long);
00821 
00822 
00824 #ifdef DOC_PLUS_PLUS
00825 class PBYTEArray : public PBaseArray {
00826   public:
00832     PBYTEArray(
00833       PINDEX initialSize = 0  
00834     );
00835 
00838     PBYTEArray(
00839       BYTE const * buffer,   
00840       PINDEX length,      
00841       BOOL dynamic = TRUE 
00842     );
00844 };
00845 #endif
00846 PDECLARE_BASEARRAY(PBYTEArray, BYTE);
00847   public:
00850 
00851     virtual void PrintOn(
00852       ostream & strm 
00853     ) const;
00855     virtual void ReadFrom(
00856       istream &strm   
00857     );
00859 };
00860 
00861 
00863 #ifdef DOC_PLUS_PLUS
00864 class PWORDArray : public PBaseArray {
00865   public:
00871     PWORDArray(
00872       PINDEX initialSize = 0  
00873     );
00874 
00877     PWORDArray(
00878       WORD const * buffer,   
00879       PINDEX length,      
00880       BOOL dynamic = TRUE 
00881     );
00883 };
00884 #endif
00885 PSCALAR_ARRAY(PWORDArray, WORD);
00886 
00887 
00889 #ifdef DOC_PLUS_PLUS
00890 class PUnsignedArray : public PBaseArray {
00891   public:
00897     PUnsignedArray(
00898       PINDEX initialSize = 0  
00899     );
00900 
00903     PUnsignedArray(
00904       unsigned const * buffer,   
00905       PINDEX length,      
00906       BOOL dynamic = TRUE 
00907     );
00909 };
00910 #endif
00911 PSCALAR_ARRAY(PUnsignedArray, unsigned);
00912 
00913 
00915 #ifdef DOC_PLUS_PLUS
00916 class PDWORDArray : public PBaseArray {
00917   public:
00923     PDWORDArray(
00924       PINDEX initialSize = 0  
00925     );
00926 
00929     PDWORDArray(
00930       DWORD const * buffer,   
00931       PINDEX length,      
00932       BOOL dynamic = TRUE 
00933     );
00935 #endif
00936 PSCALAR_ARRAY(PDWORDArray, DWORD);
00937 
00938 
00940 // Linear array of objects
00941 
00963 class PArrayObjects : public PCollection
00964 {
00965   PCONTAINERINFO(PArrayObjects, PCollection);
00966 
00967   public:
00976     PINLINE PArrayObjects(
00977       PINDEX initialSize = 0  
00978     );
00980 
01013     virtual Comparison Compare(
01014       const PObject & obj   
01015     ) const;
01017 
01020 
01021     virtual PINDEX GetSize() const;
01022 
01031     virtual BOOL SetSize(
01032       PINDEX newSize  
01033     );
01035 
01044     virtual PINDEX Append(
01045       PObject * obj   
01046     );
01047 
01063     virtual PINDEX Insert(
01064       const PObject & before,   
01065       PObject * obj             
01066     );
01067 
01078     virtual PINDEX InsertAt(
01079       PINDEX index,   
01080       PObject * obj   
01081     );
01082 
01091     virtual BOOL Remove(
01092       const PObject * obj   
01093     );
01094 
01106     virtual PObject * RemoveAt(
01107       PINDEX index   
01108     );
01109 
01117     virtual BOOL SetAt(
01118       PINDEX index,   
01119       PObject * val   
01120     );
01121 
01128     virtual PObject * GetAt(
01129       PINDEX index  
01130     ) const;
01131 
01139     virtual PINDEX GetObjectsIndex(
01140       const PObject * obj  
01141     ) const;
01142 
01152     virtual PINDEX GetValuesIndex(
01153       const PObject & obj   // Object to find equal of.
01154     ) const;
01155 
01162     virtual void RemoveAll();
01164 
01165   protected:
01166     PBASEARRAY(ObjPtrArray, PObject *);
01167     ObjPtrArray * theArray;
01168 };
01169 
01170 
01171 #ifdef PHAS_TEMPLATES
01172 
01179 template <class T> class PArray : public PArrayObjects
01180 {
01181   PCLASSINFO(PArray, PArrayObjects);
01182 
01183   public:
01192     PArray( 
01193       PINDEX initialSize = 0  
01194     ) : PArrayObjects(initialSize) { }
01196 
01202     virtual PObject * Clone() const
01203       { return PNEW PArray(0, this); }
01205 
01215     T & operator[](
01216       PINDEX index  
01217     ) const {
01218       PObject * obj = GetAt(index);
01219       PAssert(obj != NULL, PInvalidArrayElement);
01220       return (T &)*obj;
01221     }
01223 
01224   protected:
01225     PArray(int dummy, const PArray * c) : PArrayObjects(dummy, c) { }
01226 };
01227 
01228 
01240 #define PARRAY(cls, T) typedef PArray<T> cls
01241 
01242 
01255 #define PDECLARE_ARRAY(cls, T) \
01256   PARRAY(cls##_PTemplate, T); \
01257   PDECLARE_CLASS(cls, cls##_PTemplate) \
01258   protected: \
01259     inline cls(int dummy, const cls * c) \
01260       : cls##_PTemplate(dummy, c) { } \
01261   public: \
01262     inline cls(PINDEX initialSize = 0) \
01263       : cls##_PTemplate(initialSize) { } \
01264     virtual PObject * Clone() const \
01265       { return PNEW cls(0, this); } \
01266 
01267 #else // PHAS_TEMPLATES
01268 
01269 
01270 #define PARRAY(cls, T) \
01271   class cls : public PArrayObjects { \
01272   PCLASSINFO(cls, PArrayObjects); \
01273   protected: \
01274     inline cls(int dummy, const cls * c) \
01275       : PArrayObjects(dummy, c) { } \
01276   public: \
01277     inline cls(PINDEX initialSize = 0) \
01278       : PArrayObjects(initialSize) { } \
01279     virtual PObject * Clone() const \
01280       { return PNEW cls(0, this); } \
01281     inline T & operator[](PINDEX index) const\
01282       { PObject * obj = GetAt(index); \
01283         PAssert(obj != NULL, PInvalidArrayElement); \
01284         /* want to do to this, but gcc 3.0 complains --> return *(T *)obj; } */ \
01285         return (T &)*obj; } \
01286   }
01287 
01288 #define PDECLARE_ARRAY(cls, T) \
01289   PARRAY(cls##_PTemplate, T); \
01290   PDECLARE_CLASS(cls, cls##_PTemplate) \
01291   protected: \
01292     inline cls(int dummy, const cls * c) \
01293       : cls##_PTemplate(dummy, c) { } \
01294   public: \
01295     inline cls(PINDEX initialSize = 0) \
01296       : cls##_PTemplate(initialSize) { } \
01297     virtual PObject * Clone() const \
01298       { return PNEW cls(0, this); } \
01299 
01300 #endif // PHAS_TEMPLATES
01301 
01302 
01305 class PBitArray : public PBYTEArray
01306 {
01307   PCLASSINFO(PBitArray, PBYTEArray);
01308 
01309   public:
01314     PBitArray(
01315       PINDEX initialSize = 0  
01316     );
01317     
01320     PBitArray(
01321       const void * buffer,   
01322       PINDEX length,         
01323       BOOL dynamic = TRUE    
01324     );
01326 
01331     virtual PObject * Clone() const;
01333 
01342     virtual PINDEX GetSize() const;
01343 
01352     virtual BOOL SetSize(
01353       PINDEX newSize  
01354     );
01355 
01362     BOOL SetAt(
01363       PINDEX index,   
01364       BOOL val           
01365     );
01366 
01373     BOOL GetAt(
01374       PINDEX index  
01375     ) const;
01376 
01385     void Attach(
01386       const void * buffer,   
01387       PINDEX bufferSize      
01388     );
01389 
01403     BYTE * GetPointer(
01404       PINDEX minSize = 0    
01405     );
01407 
01419     BOOL operator[](
01420       PINDEX index  
01421     ) const { return GetAt(index); }
01422 
01428     PBitArray & operator+=(
01429       PINDEX index  
01430     ) { SetAt(index, TRUE); return *this; }
01431 
01437     PBitArray & operator-=(
01438       PINDEX index  
01439     ) { SetAt(index, FALSE); return *this; }
01440 
01452     BOOL Concatenate(
01453       const PBitArray & array  
01454     );
01456 };
01457 
01458 
01459 #endif
01460 // End Of File ///////////////////////////////////////////////////////////////

Generated on Sun Sep 6 03:50:32 2009 for PWLib by  doxygen 1.6.1