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.36  2007/08/01 05:20:48  rjongbloed
00031  * Changes to container classes to become compatible with advanced DevStudio 2005 "Visualizers".
00032  *
00033  * Revision 1.35  2006/06/30 00:56:31  csoutheren
00034  * Applied 1494931 - various pwlib bug fixes and enhancement
00035  * Thanks to Frederich Heem
00036  *
00037  * Revision 1.34  2005/11/25 03:43:47  csoutheren
00038  * Fixed function argument comments to be compatible with Doxygen
00039  *
00040  * Revision 1.33  2005/08/08 07:01:58  rjongbloed
00041  * Minor changes to remove possible ambiguity where virtual and non-virtual
00042  *   functions are overloaded.
00043  * Removed commented out code.
00044  *
00045  * Revision 1.32  2005/05/02 09:02:35  csoutheren
00046  * Fixed previous fix to contain.cxx which broke PString::MakeUnique
00047  *
00048  * Revision 1.31  2004/05/13 02:07:14  dereksmithies
00049  * Fixes, so it works with doc++
00050  *
00051  * Revision 1.30  2004/04/09 03:42:34  csoutheren
00052  * Removed all usages of "virtual inline" and "inline virtual"
00053  *
00054  * Revision 1.29  2004/04/03 06:54:21  rjongbloed
00055  * Many and various changes to support new Visual C++ 2003
00056  *
00057  * Revision 1.28  2004/03/02 10:29:59  rjongbloed
00058  * Changed base array declaration macro to be consistent with the
00059  *   object array one, thanks Guilhem Tardy
00060  *
00061  * Revision 1.27  2003/04/17 07:24:47  robertj
00062  * Fixed GNU 3.x problem (why no other compiler?)
00063  *
00064  * Revision 1.26  2003/04/15 07:08:36  robertj
00065  * Changed read and write from streams for base array classes so operates in
00066  *   the same way for both PIntArray and PArray<int> etc
00067  *
00068  * Revision 1.25  2003/03/31 01:23:56  robertj
00069  * Added ReadFrom functions for standard container classes such as
00070  *   PIntArray and PStringList etc
00071  *
00072  * Revision 1.24  2002/09/16 01:08:59  robertj
00073  * Added #define so can select if #pragma interface/implementation is used on
00074  *   platform basis (eg MacOS) rather than compiler, thanks Robert Monaghan.
00075  *
00076  * Revision 1.23  2002/06/20 06:08:59  robertj
00077  * Fixed GNU warning
00078  *
00079  * Revision 1.22  2002/06/14 13:20:37  robertj
00080  * Added PBitArray class.
00081  *
00082  * Revision 1.21  2002/02/14 23:37:53  craigs
00083  * Added fix for optimisation for PArray [] operator, thanks to Vyacheslav Frolov
00084  *
00085  * Revision 1.20  2002/02/14 05:11:50  robertj
00086  * Minor optimisation in the operator[] for arrays of PObjects.
00087  *
00088  * Revision 1.19  1999/11/30 00:22:54  robertj
00089  * Updated documentation for doc++
00090  *
00091  * Revision 1.18  1999/09/03 15:08:38  robertj
00092  * Fixed typo in ancestor class name
00093  *
00094  * Revision 1.17  1999/08/22 12:13:42  robertj
00095  * Fixed warning when using inlines on older GNU compiler
00096  *
00097  * Revision 1.16  1999/08/20 03:07:44  robertj
00098  * Fixed addded Concatenate function for non-template version.
00099  *
00100  * Revision 1.15  1999/08/18 01:45:12  robertj
00101  * Added concatenation function to "base type" arrays.
00102  *
00103  * Revision 1.14  1999/03/09 02:59:49  robertj
00104  * Changed comments to doc++ compatible documentation.
00105  *
00106  * Revision 1.13  1999/02/16 08:07:11  robertj
00107  * MSVC 6.0 compatibility changes.
00108  *
00109  * Revision 1.12  1998/09/23 06:20:16  robertj
00110  * Added open source copyright license.
00111  *
00112  * Revision 1.11  1998/08/21 05:23:57  robertj
00113  * Added hex dump capability to base array types.
00114  * Added ability to have base arrays of static memory blocks.
00115  *
00116  * Revision 1.10  1997/06/08 04:49:10  robertj
00117  * Fixed non-template class descendent order.
00118  *
00119  * Revision 1.9  1996/08/17 09:54:34  robertj
00120  * Optimised RemoveAll() for object arrays.
00121  *
00122  * Revision 1.8  1996/01/02 11:48:46  robertj
00123  * Removed requirement that PArray elements have parameterless constructor..
00124  *
00125  * Revision 1.7  1995/10/14 14:52:33  robertj
00126  * Changed arrays to not break references.
00127  *
00128  * Revision 1.6  1995/06/17 11:12:18  robertj
00129  * Documentation update.
00130  *
00131  * Revision 1.5  1995/03/14 12:40:58  robertj
00132  * Updated documentation to use HTML codes.
00133  *
00134  * Revision 1.4  1995/02/22  10:50:26  robertj
00135  * Changes required for compiling release (optimised) version.
00136  *
00137  * Revision 1.3  1995/01/15  04:49:09  robertj
00138  * Fixed errors in template version.
00139  *
00140  * Revision 1.2  1994/12/21  11:52:46  robertj
00141  * Documentation and variable normalisation.
00142  *
00143  * Revision 1.1  1994/12/12  09:59:29  robertj
00144  * Initial revision
00145  *
00146  */
00147 
00148 #ifndef _ARRAY_H_
00149 #define _ARRAY_H_
00150 
00151 #ifdef P_USE_PRAGMA
00152 #pragma interface
00153 #endif
00154 
00155 #include <ptlib/contain.h>
00156 
00158 // The abstract array class
00159 
00181 class PAbstractArray : public PContainer
00182 {
00183   PCONTAINERINFO(PAbstractArray, PContainer);
00184 
00185   public:
00197     PAbstractArray(
00198       PINDEX elementSizeInBytes,  
00199 
00200       PINDEX initialSize = 0      
00201     );
00202 
00220     PAbstractArray(
00221       PINDEX elementSizeInBytes,   
00222 
00223       const void *buffer,          
00224       PINDEX bufferSizeInElements, 
00225       BOOL dynamicAllocation       
00226     );
00228 
00237     virtual void PrintOn(
00238       ostream &strm   // Stream to print the object into.
00239     ) const;
00240 
00247     virtual void ReadFrom(
00248       istream &strm   // Stream to read the objects contents from.
00249     );
00250 
00271     virtual Comparison Compare(
00272       const PObject & obj   
00273     ) const;
00275 
00286     virtual BOOL SetSize(
00287       PINDEX newSize  
00288     );
00290 
00301     void Attach(
00302       const void *buffer, 
00303       PINDEX bufferSize   
00304     );
00305 
00319     void * GetPointer(
00320       PINDEX minSize = 1  
00321     );
00322 
00335     BOOL Concatenate(
00336       const PAbstractArray & array  
00337     );
00339 
00340   protected:
00341     BOOL InternalSetSize(PINDEX newSize, BOOL force);
00342 
00343     virtual void PrintElementOn(
00344       ostream & stream,
00345       PINDEX index
00346     ) const;
00347     virtual void ReadElementFrom(
00348       istream & stream,
00349       PINDEX index
00350     );
00351 
00353     PINDEX elementSize;
00354 
00356     char * theArray;
00357 
00359     BOOL allocatedDynamically;
00360 
00361   friend class PArrayObjects;
00362 };
00363 
00364 
00366 // An array of some base type
00367 
00368 #ifdef PHAS_TEMPLATES
00369 
00389 template <class T> class PBaseArray : public PAbstractArray
00390 {
00391   PCLASSINFO(PBaseArray, PAbstractArray);
00392 
00393   public:
00401     PBaseArray(
00402       PINDEX initialSize = 0  
00403     ) : PAbstractArray(sizeof(T), initialSize) { }
00404     
00407     PBaseArray(
00408       T const * buffer,   
00409       PINDEX length,      
00410       BOOL dynamic = TRUE 
00411     ) : PAbstractArray(sizeof(T), buffer, length, dynamic) { }
00413 
00418     virtual PObject * Clone() const
00419     { 
00420       return PNEW PBaseArray<T>(*this, GetSize());
00421     }
00423 
00432     BOOL SetAt(
00433       PINDEX index,   
00434       T val           
00435     ) {
00436       return SetMinSize(index+1) && val==(((T *)theArray)[index] = val);
00437     }
00438 
00445     T GetAt(
00446       PINDEX index  
00447     ) const {
00448       PASSERTINDEX(index);
00449       return index < GetSize() ? ((T *)theArray)[index] : (T)0;
00450     }
00451 
00460     void Attach(
00461       const T * buffer,   
00462       PINDEX bufferSize   
00463     ) {
00464       PAbstractArray::Attach(buffer, bufferSize);
00465     }
00466 
00480     T * GetPointer(
00481       PINDEX minSize = 0    
00482     ) {
00483       return (T *)PAbstractArray::GetPointer(minSize);
00484     }
00486 
00498     T operator[](
00499       PINDEX index  
00500     ) const {
00501       return GetAt(index);
00502     }
00503 
00514     T & operator[](
00515       PINDEX index  
00516     ) {
00517       PASSERTINDEX(index);
00518       PAssert(SetMinSize(index+1), POutOfMemory);
00519       return ((T *)theArray)[index];
00520     }
00521 
00535     operator T const *() const {
00536       return (T const *)theArray;
00537     }
00538 
00550     BOOL Concatenate(
00551       const PBaseArray & array  
00552     ) {
00553       return PAbstractArray::Concatenate(array);
00554     }
00556 
00557   protected:
00558     virtual void PrintElementOn(
00559       ostream & stream,
00560       PINDEX index
00561     ) const {
00562       stream << GetAt(index);
00563     }
00564 };
00565 
00566 /*Declare a dynamic array base type.
00567    This macro is used to declare a descendent of PAbstractArray class,
00568    customised for a particular element type {\bf T}. This macro closes the
00569    class declaration off so no additional members can be added.
00570 
00571    If the compilation is using templates then this macro produces a typedef
00572    of the #PBaseArray# template class.
00573  */
00574 #define PBASEARRAY(cls, T) typedef PBaseArray<T> cls
00575 
00588 #define PDECLARE_BASEARRAY(cls, T) \
00589   PDECLARE_CLASS(cls, PBaseArray<T>) \
00590     cls(PINDEX initialSize = 0) \
00591       : PBaseArray<T>(initialSize) { } \
00592     cls(T const * buffer, PINDEX length, BOOL dynamic = TRUE) \
00593       : PBaseArray<T>(buffer, length, dynamic) { } \
00594     virtual PObject * Clone() const \
00595       { return PNEW cls(*this, GetSize()); } \
00596 
00597 
00616 template <class T> class PScalarArray : public PBaseArray<T>
00617 {
00618   public:
00626     PScalarArray(
00627       PINDEX initialSize = 0  
00628     ) : PBaseArray<T>(initialSize) { }
00629     
00632     PScalarArray(
00633       T const * buffer,   
00634       PINDEX length,      
00635       BOOL dynamic = TRUE 
00636     ) : PBaseArray<T>(buffer, length, dynamic) { }
00638 
00639   protected:
00640     virtual void ReadElementFrom(
00641       istream & stream,
00642       PINDEX index
00643     ) {
00644       T t;
00645       stream >> t;
00646       if (!stream.fail())
00647         SetAt(index, t);
00648     }
00649 };
00650 
00651 
00652 /*Declare a dynamic array base type.
00653    This macro is used to declare a descendent of PAbstractArray class,
00654    customised for a particular element type {\bf T}. This macro closes the
00655    class declaration off so no additional members can be added.
00656 
00657    If the compilation is using templates then this macro produces a typedef
00658    of the #PBaseArray# template class.
00659  */
00660 #define PSCALAR_ARRAY(cls, T) typedef PScalarArray<T> cls
00661 
00662 #else // PHAS_TEMPLATES
00663 
00664 #define PBASEARRAY(cls, T) \
00665   typedef T P_##cls##_Base_Type; \
00666   class cls : public PAbstractArray { \
00667     PCLASSINFO(cls, PAbstractArray) \
00668   public: \
00669     inline cls(PINDEX initialSize = 0) \
00670       : PAbstractArray(sizeof(P_##cls##_Base_Type), initialSize) { } \
00671     inline cls(P_##cls##_Base_Type const * buffer, PINDEX length, BOOL dynamic = TRUE) \
00672       : PAbstractArray(sizeof(P_##cls##_Base_Type), buffer, length, dynamic) { } \
00673     virtual PObject * Clone() const \
00674       { return PNEW cls(*this, GetSize()); } \
00675     inline BOOL SetAt(PINDEX index, P_##cls##_Base_Type val) \
00676       { return SetMinSize(index+1) && \
00677                      val==(((P_##cls##_Base_Type *)theArray)[index] = val); } \
00678     inline P_##cls##_Base_Type GetAt(PINDEX index) const \
00679       { PASSERTINDEX(index); return index < GetSize() ? \
00680           ((P_##cls##_Base_Type*)theArray)[index] : (P_##cls##_Base_Type)0; } \
00681     inline P_##cls##_Base_Type operator[](PINDEX index) const \
00682       { PASSERTINDEX(index); return GetAt(index); } \
00683     inline P_##cls##_Base_Type & operator[](PINDEX index) \
00684       { PASSERTINDEX(index); PAssert(SetMinSize(index+1), POutOfMemory); \
00685         return ((P_##cls##_Base_Type *)theArray)[index]; } \
00686     inline void Attach(const P_##cls##_Base_Type * buffer, PINDEX bufferSize) \
00687       { PAbstractArray::Attach(buffer, bufferSize); } \
00688     inline P_##cls##_Base_Type * GetPointer(PINDEX minSize = 0) \
00689       { return (P_##cls##_Base_Type *)PAbstractArray::GetPointer(minSize); } \
00690     inline operator P_##cls##_Base_Type const *() const \
00691       { return (P_##cls##_Base_Type const *)theArray; } \
00692     inline BOOL Concatenate(cls const & array) \
00693       { return PAbstractArray::Concatenate(array); } \
00694   }
00695 
00696 #define PDECLARE_BASEARRAY(cls, T) \
00697   PBASEARRAY(cls##_PTemplate, T); \
00698   PDECLARE_CLASS(cls, cls##_PTemplate) \
00699     cls(PINDEX initialSize = 0) \
00700       : cls##_PTemplate(initialSize) { } \
00701     cls(T const * buffer, PINDEX length, BOOL dynamic = TRUE) \
00702       : cls##_PTemplate(buffer, length, dynamic) { } \
00703     virtual PObject * Clone() const \
00704       { return PNEW cls(*this, GetSize()); } \
00705 
00706 #define PSCALAR_ARRAY(cls, T) PBASEARRAY(cls, T)
00707 
00708 #endif // PHAS_TEMPLATES
00709 
00710 
00712 #ifdef DOC_PLUS_PLUS
00713 class PCharArray : public PBaseArray {
00714   public:
00720     PCharArray(
00721       PINDEX initialSize = 0  
00722     );
00723 
00726     PCharArray(
00727       char const * buffer,   
00728       PINDEX length,      
00729       BOOL dynamic = TRUE 
00730     );
00732 #endif
00733 PDECLARE_BASEARRAY(PCharArray, char);
00734   public:
00737 
00738     virtual void PrintOn(
00739       ostream & strm 
00740     ) const;
00742     virtual void ReadFrom(
00743       istream &strm   // Stream to read the objects contents from.
00744     );
00746 };
00747 
00749 #ifdef DOC_PLUS_PLUS
00750 class PShortArray : public PBaseArray {
00751   public:
00757     PShortArray(
00758       PINDEX initialSize = 0  
00759     );
00760 
00763     PShortArray(
00764       short const * buffer,   
00765       PINDEX length,      
00766       BOOL dynamic = TRUE 
00767     );
00769 };
00770 #endif
00771 PSCALAR_ARRAY(PShortArray, short);
00772 
00773 
00775 #ifdef DOC_PLUS_PLUS
00776 class PIntArray : public PBaseArray {
00777   public:
00783     PIntArray(
00784       PINDEX initialSize = 0  
00785     );
00786 
00789     PIntArray(
00790       int const * buffer,   
00791       PINDEX length,      
00792       BOOL dynamic = TRUE 
00793     );
00795 };
00796 #endif
00797 PSCALAR_ARRAY(PIntArray, int);
00798 
00799 
00801 #ifdef DOC_PLUS_PLUS
00802 class PLongArray : public PBaseArray {
00803   public:
00809     PLongArray(
00810       PINDEX initialSize = 0  
00811     );
00812 
00815     PLongArray(
00816       long const * buffer,   
00817       PINDEX length,      
00818       BOOL dynamic = TRUE 
00819     );
00821 };
00822 #endif
00823 PSCALAR_ARRAY(PLongArray, long);
00824 
00825 
00827 #ifdef DOC_PLUS_PLUS
00828 class PBYTEArray : public PBaseArray {
00829   public:
00835     PBYTEArray(
00836       PINDEX initialSize = 0  
00837     );
00838 
00841     PBYTEArray(
00842       BYTE const * buffer,   
00843       PINDEX length,      
00844       BOOL dynamic = TRUE 
00845     );
00847 };
00848 #endif
00849 PDECLARE_BASEARRAY(PBYTEArray, BYTE);
00850   public:
00853 
00854     virtual void PrintOn(
00855       ostream & strm 
00856     ) const;
00858     virtual void ReadFrom(
00859       istream &strm   
00860     );
00862 };
00863 
00864 
00866 #ifdef DOC_PLUS_PLUS
00867 class PWORDArray : public PBaseArray {
00868   public:
00874     PWORDArray(
00875       PINDEX initialSize = 0  
00876     );
00877 
00880     PWORDArray(
00881       WORD const * buffer,   
00882       PINDEX length,      
00883       BOOL dynamic = TRUE 
00884     );
00886 };
00887 #endif
00888 PSCALAR_ARRAY(PWORDArray, WORD);
00889 
00890 
00892 #ifdef DOC_PLUS_PLUS
00893 class PUnsignedArray : public PBaseArray {
00894   public:
00900     PUnsignedArray(
00901       PINDEX initialSize = 0  
00902     );
00903 
00906     PUnsignedArray(
00907       unsigned const * buffer,   
00908       PINDEX length,      
00909       BOOL dynamic = TRUE 
00910     );
00912 };
00913 #endif
00914 PSCALAR_ARRAY(PUnsignedArray, unsigned);
00915 
00916 
00918 #ifdef DOC_PLUS_PLUS
00919 class PDWORDArray : public PBaseArray {
00920   public:
00926     PDWORDArray(
00927       PINDEX initialSize = 0  
00928     );
00929 
00932     PDWORDArray(
00933       DWORD const * buffer,   
00934       PINDEX length,      
00935       BOOL dynamic = TRUE 
00936     );
00938 #endif
00939 PSCALAR_ARRAY(PDWORDArray, DWORD);
00940 
00941 
00943 // Linear array of objects
00944 
00966 class PArrayObjects : public PCollection
00967 {
00968   PCONTAINERINFO(PArrayObjects, PCollection);
00969 
00970   public:
00979     PINLINE PArrayObjects(
00980       PINDEX initialSize = 0  
00981     );
00983 
01016     virtual Comparison Compare(
01017       const PObject & obj   
01018     ) const;
01020 
01023 
01024     virtual PINDEX GetSize() const;
01025 
01034     virtual BOOL SetSize(
01035       PINDEX newSize  
01036     );
01038 
01047     virtual PINDEX Append(
01048       PObject * obj   
01049     );
01050 
01066     virtual PINDEX Insert(
01067       const PObject & before,   
01068       PObject * obj             
01069     );
01070 
01081     virtual PINDEX InsertAt(
01082       PINDEX index,   
01083       PObject * obj   
01084     );
01085 
01094     virtual BOOL Remove(
01095       const PObject * obj   
01096     );
01097 
01109     virtual PObject * RemoveAt(
01110       PINDEX index   
01111     );
01112 
01120     virtual BOOL SetAt(
01121       PINDEX index,   
01122       PObject * val   
01123     );
01124 
01131     virtual PObject * GetAt(
01132       PINDEX index  
01133     ) const;
01134 
01142     virtual PINDEX GetObjectsIndex(
01143       const PObject * obj  
01144     ) const;
01145 
01155     virtual PINDEX GetValuesIndex(
01156       const PObject & obj   // Object to find equal of.
01157     ) const;
01158 
01165     virtual void RemoveAll();
01167 
01168   protected:
01169     // The type below cannot be nested as DevStudio 2005 AUTOEXP.DAT doesn't like it
01170     PBaseArray<PObject *> * theArray;
01171 };
01172 
01173 
01174 #ifdef PHAS_TEMPLATES
01175 
01182 template <class T> class PArray : public PArrayObjects
01183 {
01184   PCLASSINFO(PArray, PArrayObjects);
01185 
01186   public:
01195     PArray( 
01196       PINDEX initialSize = 0  
01197     ) : PArrayObjects(initialSize) { }
01199 
01205     virtual PObject * Clone() const
01206       { return PNEW PArray(0, this); }
01208 
01218     T & operator[](
01219       PINDEX index  
01220     ) const {
01221       PObject * obj = GetAt(index);
01222       PAssert(obj != NULL, PInvalidArrayElement);
01223       return (T &)*obj;
01224     }
01226 
01227   protected:
01228     PArray(int dummy, const PArray * c) : PArrayObjects(dummy, c) { }
01229 };
01230 
01231 
01243 #define PARRAY(cls, T) typedef PArray<T> cls
01244 
01245 
01258 #define PDECLARE_ARRAY(cls, T) \
01259   PARRAY(cls##_PTemplate, T); \
01260   PDECLARE_CLASS(cls, cls##_PTemplate) \
01261   protected: \
01262     inline cls(int dummy, const cls * c) \
01263       : cls##_PTemplate(dummy, c) { } \
01264   public: \
01265     inline cls(PINDEX initialSize = 0) \
01266       : cls##_PTemplate(initialSize) { } \
01267     virtual PObject * Clone() const \
01268       { return PNEW cls(0, this); } \
01269 
01270 #else // PHAS_TEMPLATES
01271 
01272 
01273 #define PARRAY(cls, T) \
01274   class cls : public PArrayObjects { \
01275   PCLASSINFO(cls, PArrayObjects); \
01276   protected: \
01277     inline cls(int dummy, const cls * c) \
01278       : PArrayObjects(dummy, c) { } \
01279   public: \
01280     inline cls(PINDEX initialSize = 0) \
01281       : PArrayObjects(initialSize) { } \
01282     virtual PObject * Clone() const \
01283       { return PNEW cls(0, this); } \
01284     inline T & operator[](PINDEX index) const\
01285       { PObject * obj = GetAt(index); \
01286         PAssert(obj != NULL, PInvalidArrayElement); \
01287         /* want to do to this, but gcc 3.0 complains --> return *(T *)obj; } */ \
01288         return (T &)*obj; } \
01289   }
01290 
01291 #define PDECLARE_ARRAY(cls, T) \
01292   PARRAY(cls##_PTemplate, T); \
01293   PDECLARE_CLASS(cls, cls##_PTemplate) \
01294   protected: \
01295     inline cls(int dummy, const cls * c) \
01296       : cls##_PTemplate(dummy, c) { } \
01297   public: \
01298     inline cls(PINDEX initialSize = 0) \
01299       : cls##_PTemplate(initialSize) { } \
01300     virtual PObject * Clone() const \
01301       { return PNEW cls(0, this); } \
01302 
01303 #endif // PHAS_TEMPLATES
01304 
01305 
01308 class PBitArray : public PBYTEArray
01309 {
01310   PCLASSINFO(PBitArray, PBYTEArray);
01311 
01312   public:
01317     PBitArray(
01318       PINDEX initialSize = 0  
01319     );
01320     
01323     PBitArray(
01324       const void * buffer,   
01325       PINDEX length,         
01326       BOOL dynamic = TRUE    
01327     );
01329 
01334     virtual PObject * Clone() const;
01336 
01345     virtual PINDEX GetSize() const;
01346 
01355     virtual BOOL SetSize(
01356       PINDEX newSize  
01357     );
01358 
01365     BOOL SetAt(
01366       PINDEX index,   
01367       BOOL val           
01368     );
01369 
01376     BOOL GetAt(
01377       PINDEX index  
01378     ) const;
01379 
01388     void Attach(
01389       const void * buffer,   
01390       PINDEX bufferSize      
01391     );
01392 
01406     BYTE * GetPointer(
01407       PINDEX minSize = 0    
01408     );
01410 
01422     BOOL operator[](
01423       PINDEX index  
01424     ) const { return GetAt(index); }
01425 
01431     PBitArray & operator+=(
01432       PINDEX index  
01433     ) { SetAt(index, TRUE); return *this; }
01434 
01440     PBitArray & operator-=(
01441       PINDEX index  
01442     ) { SetAt(index, FALSE); return *this; }
01443 
01455     BOOL Concatenate(
01456       const PBitArray & array  
01457     );
01459 };
01460 
01461 
01462 #endif
01463 // End Of File ///////////////////////////////////////////////////////////////

Generated on Fri Mar 7 06:25:02 2008 for PTLib by  doxygen 1.5.1