container::OrderedList Class Reference

An ADT that represents a list of items. More...

#include <orderedlist.h>

Inheritance diagram for container::OrderedList:

Inheritance graph
[legend]
Collaboration diagram for container::OrderedList:

Collaboration graph
[legend]

List of all members.

Public Member Functions

virtual ~OrderedList ()
 Destructor.
void append (Entity *entity)
 Add an Entity to the end of the list.
void insertBefore (Entity *entity)
 Inserts the new Entity relative to the list cursor.
virtual ostream & renderState (ostream &os) const
 Write the state of an Object for debugging and demonstration.
virtual const InfotypeInfo () const
 Return the instance of Object::Info that describes the class of this object.
virtual Objectclone (bool deepCopy=false) const =0
 A polymorphic copy constructor.

Static Public Attributes

static const Info *const TYPE_INFO = Object::typeInfoFactory("OrderedList")

Protected Member Functions

 OrderedList ()
 OrderedList (const OrderedList &pattern)
virtual void append_impl (Entity *entity)=0
 Called by a template method.
virtual void insertBefore_impl (Entity *entity)=0
 Called by a template method.

Private Member Functions

void setCount (int c)
 Hide from sub-classes.
void incCount ()
 Hide from sub-classes.
void decCount ()
 Hide from sub-classes.


Detailed Description

An ADT that represents a list of items.

An OrderedList maintains an order but no sorting is performed or enforced. It is left to the user of the class to order the list as desired with the provided mutators.


Constructor & Destructor Documentation

container::OrderedList::OrderedList (  )  [protected]

00047 { }

container::OrderedList::OrderedList ( const OrderedList pattern  )  [protected]

00049 { }

container::OrderedList::~OrderedList (  )  [virtual]

Destructor.

00054 { }


Member Function Documentation

void container::OrderedList::append ( Entity entity  ) 

Add an Entity to the end of the list.

No copy of the Entity is made; the list takes on the responsibility of deleting the Entity. The list relinquishes the responsibility to delete the Entity only if it is extracted from the list using extractCurrentEntity().

This method is a template function that enforces the correct value for count. Concrete sub-classes must implement append_impl(Entity*) to do the work of adding an Entity.

00058                                        {
00059    append_impl(entity);
00060    incCount();
00061 }

Here is the call graph for this function:

Here is the caller graph for this function:

virtual void container::OrderedList::append_impl ( Entity entity  )  [protected, pure virtual]

Called by a template method.

See also:
Details documented in OrderedList::append

Implemented in container::OrderedArrayList, and container::OrderedLinkedList.

Here is the caller graph for this function:

virtual Object* container::OrderedList::clone ( bool  deepCopy = false  )  const [pure virtual]

A polymorphic copy constructor.

Implements container::List.

Implemented in container::OrderedArrayList, and container::OrderedLinkedList.

void container::OrderedList::decCount (  )  [inline, private]

Hide from sub-classes.

Reimplemented from container::Container.

00136                           {
00137       Container::decCount();
00138    }

void container::OrderedList::incCount (  )  [inline, private]

Hide from sub-classes.

Reimplemented from container::Container.

00129                           {
00130       Container::incCount();
00131    }

Here is the caller graph for this function:

void container::OrderedList::insertBefore ( Entity entity  ) 

Inserts the new Entity relative to the list cursor.

Postcondition:
The new Entity is in the list located before the cursor

The cursor remains unchanged, pointing to the same, pre-existing Entity or to the tail of the list

00063                                              {
00064    insertBefore_impl(entity);
00065    incCount();
00066 }

Here is the call graph for this function:

Here is the caller graph for this function:

virtual void container::OrderedList::insertBefore_impl ( Entity entity  )  [protected, pure virtual]

Called by a template method.

See also:
Details documented in OrderedList::insertBefore

Implemented in container::OrderedArrayList, and container::OrderedLinkedList.

Here is the caller graph for this function:

ostream & container::OrderedList::renderState ( ostream &  os  )  const [virtual]

Write the state of an Object for debugging and demonstration.

This method must not change the state of an Object; adding or removing debug statements should not change the behavior of a class. The implementation must be robust, e.g., NULL safe, etc. and work without an unrecoverable error for any state, excluding an Object's time of construction and destruction. It is not required for the implementation to be thread safe.

Precondition:
The Object has been fully constructed and is not in the process of destruction
Postcondition:
The state of the Object is unchanged

Reimplemented from container::List.

Reimplemented in container::OrderedArrayList, and container::OrderedLinkedList.

00070                                                     {
00071    return this->List::renderState(os);
00072 }

void container::OrderedList::setCount ( int  c  )  [inline, private]

Hide from sub-classes.

Reimplemented from container::Container.

00122                                {
00123       Container::setCount(c);
00124    }

const Object::Info * container::OrderedList::typeInfo (  )  const [virtual]

Return the instance of Object::Info that describes the class of this object.

Instantiation of Object::Info is controlled by the protected method Object::typeInfoFactory(const string&). Each sub-class of Object should create one and only one instance of Object::Info.

Reimplemented from container::List.

Reimplemented in container::OrderedArrayList, and container::OrderedLinkedList.

00074                                               {
00075    return TYPE_INFO;
00076 }

Here is the caller graph for this function:


Member Data Documentation

const Object::Info *const container::OrderedList::TYPE_INFO = Object::typeInfoFactory("OrderedList") [static]

Reimplemented from container::List.

Reimplemented in container::OrderedArrayList, and container::OrderedLinkedList.


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

Generated on Tue Jun 16 23:13:00 2009 by  doxygen 1.5.9