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

Classes | Protected Member Functions | Protected Attributes | Private Member Functions

PContainer Class Reference

#include <contain.h>

Inheritance diagram for PContainer:
Inheritance graph
Collaboration diagram for PContainer:
Collaboration graph

List of all members.


class  Reference

Public Member Functions

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

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::Referencereference

Private Member Functions

 PCLASSINFO (PContainer, PObject)

Run Time Type functions

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

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 }

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)

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.

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

Generated by  Doxygen 1.6.0   Back to index