Logo Search packages:      
Sourcecode: pwlib version File versions  Download package

PContainer Class Reference

#include <contain.h>

Inheritance diagram for PContainer:

PObject PAbstractArray PCollection PSharedPtr< T > PAbstractList PAbstractSortedList PArrayObjects PHashTable PAbstractDictionary PAbstractSet

List of all members.


Detailed Description

Abstract class to embody the base functionality of a { container}.

Fundamentally, a container is an object that contains other objects. There are two main areas of support for tha that are provided by this class. The first is simply to keep a count of the number of things that the container contains. The current size is stored and accessed by members of this class. The setting of size is determined by the semantics of the descendent class and so is a pure function.

The second area of support is for reference integrity. When an instance of a container is copied to another instance, the two instance contain the same thing. There can therefore be multiple references to the same things. When one reference is destroyed this must { not} destroy the contained object as it may be referenced by another instance of a container class. To this end a reference count is provided by the PContainer class. This assures that the container only destroys the objects it contains when there are no more references to them.

In support of this, descendent classes must provide a DestroyContents()# function. As the normal destructor cannot be used, this function will free the memory or unlock the resource the container is wrapping.

Definition at line 279 of file contain.h.


Comparison functions

virtual Comparison Compare (const PObject &obj) const
virtual Comparison CompareObjectMemoryDirect (const PObject &obj) const
bool operator!= (const PObject &obj) const
bool operator< (const PObject &obj) const
bool operator<= (const PObject &obj) const
bool operator== (const PObject &obj) const
bool operator> (const PObject &obj) const
bool operator>= (const PObject &obj) const
enum  Comparison { LessThan = -1, EqualTo = 0, GreaterThan = 1 }

Run Time Type functions

virtual const char * GetClass (unsigned=0) const
virtual BOOL InternalIsDescendant (const char *clsName) const
BOOL IsClass (const char *cls) const
static const char * Class ()

I/O functions

virtual void PrintOn (ostream &strm) const
virtual void ReadFrom (istream &strm)
ostream & operator<< (ostream &strm, const PObject &obj)
istream & operator>> (istream &strm, PObject &obj)

Public Member Functions

Miscellaneous functions
virtual PObjectClone () const
virtual PINDEX HashFunction () const
Common functions for containers
virtual PINDEX GetSize () const
virtual BOOL IsEmpty () const
BOOL IsUnique () const
virtual BOOL MakeUnique ()
BOOL SetMinSize (PINDEX minSize)
virtual BOOL SetSize (PINDEX newSize)=0
Construction
PContaineroperator= (const PContainer &cont)
 PContainer (const PContainer &cont)
 PContainer (PINDEX initialSize=0)
virtual ~PContainer ()

Protected Member Functions

virtual void AssignContents (const PContainer &c)
void CloneContents (const PContainer *src)
void CopyContents (const PContainer &c)
virtual void DestroyContents ()=0
void Destruct ()
 PContainer (int dummy, const PContainer *cont)

Protected Attributes

class PContainer::Reference * reference

Private Member Functions

 PCLASSINFO (PContainer, PObject)

Classes

class  Reference

The documentation for this class was generated from the following files:

Generated by  Doxygen 1.6.0   Back to index