container::StackImpl Class Reference

An implementation of Stack that based on an OrderedList. More...

#include <stackimpl.h>

Inheritance diagram for container::StackImpl:

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

Collaboration graph
[legend]

List of all members.

Public Member Functions

 StackImpl (const StackImpl &orig)
virtual ~StackImpl ()
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
 A polymorphic copy constructor.

Static Public Member Functions

static StackfactoryLinkedComposition ()
 Constructs an StackImpl with an underlying OrderedLinkedList.
static StackfactoryArrayComposition ()
 Constructs a StackImpl with an underlying OrderedArrayList.

Static Public Attributes

static const Info *const TYPE_INFO

Protected Member Functions

virtual void push_impl (Entity *entity)
 Called by a template method.
virtual Entitypop_impl ()
 Called by a template method.

Private Member Functions

 StackImpl (OrderedList *list)

Private Attributes

OrderedList *const list


Detailed Description

An implementation of Stack that based on an OrderedList.

Constructor & Destructor Documentation

container::StackImpl::StackImpl ( OrderedList list  )  [private]

00050 : list(lst) { }

Here is the caller graph for this function:

container::StackImpl::StackImpl ( const StackImpl orig  ) 

00052 : list(orig.list) { }

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

00054                       {
00055    delete list;
00056 }


Member Function Documentation

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

A polymorphic copy constructor.

Implements container::Stack.

00107                                             {
00108    
00109 }

Stack * container::StackImpl::factoryArrayComposition (  )  [static]

Constructs a StackImpl with an underlying OrderedArrayList.

00078                                           {
00079    return new StackImpl(new OrderedArrayList());
00080 }

Here is the call graph for this function:

Stack * container::StackImpl::factoryLinkedComposition (  )  [static]

Constructs an StackImpl with an underlying OrderedLinkedList.

00074                                            {
00075    return new StackImpl(new OrderedLinkedList());
00076 }

Here is the call graph for this function:

Entity * container::StackImpl::pop_impl (  )  [protected, virtual]

Called by a template method.

See also:
Details documented in method pop

Implements container::Stack.

00064                              {
00065    if (list->toLast()) {
00066       return list->extractCurrentEntity();
00067    } else {
00068       return NULL;
00069    }
00070 }

Here is the call graph for this function:

void container::StackImpl::push_impl ( Entity entity  )  [protected, virtual]

Called by a template method.

See also:
Details documented in method push

Implements container::Stack.

00060                                         {
00061    list->append(entity);
00062 }

Here is the call graph for this function:

ostream & container::StackImpl::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::Stack.

00084                                                   {
00085 
00086    this->Stack::renderState(os);
00087    os << " composed with an " << list->typeInfo()->typeName << " contents{";
00088 
00089    int i = 0;
00090    for (list->toTail(); list->toPrev(); i++) {
00091       os << std::endl << "      [" << i << ']' << list->currentEntity();
00092       if (list->getCount() > 1) {
00093          if (list->isFirst()) {
00094             os << " <--BOTTOM";
00095          } else if (list->isLast()) {
00096             os << " <--TOP";
00097          }
00098       }
00099    }
00100    return os << "}";
00101 }

Here is the call graph for this function:

const Object::Info * container::StackImpl::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::Stack.

00103                                             {
00104    return TYPE_INFO;
00105 }


Member Data Documentation

Initial value:

Reimplemented from container::Stack.


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

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