container::SortedLinkedList Class Reference

A linked list implementation of SortedList. More...

#include <sortedlinkedlist.h>

Inheritance diagram for container::SortedLinkedList:

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

Collaboration graph
[legend]

List of all members.

Public Member Functions

 SortedLinkedList ()
 SortedLinkedList (const SortedLinkedList &pattern)
virtual ~SortedLinkedList ()
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 Attributes

static const Info *const TYPE_INFO

Protected Member Functions

virtual bool insertSorted_impl (Entity *entity)
 Called by a template method.
virtual bool add_impl (Entity *entity)
 Called by a template method.


Detailed Description

A linked list implementation of SortedList.

Constructor & Destructor Documentation

container::SortedLinkedList::SortedLinkedList (  ) 

00048 { }

container::SortedLinkedList::SortedLinkedList ( const SortedLinkedList pattern  ) 

00050 { }

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

00052 { }


Member Function Documentation

bool container::SortedLinkedList::add_impl ( Entity entity  )  [protected, virtual]

Called by a template method.

See also:
Details documented in List::add

Implements container::List.

00078                                               {
00079    return insertSorted_impl(entity);
00080 }

Here is the call graph for this function:

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

A polymorphic copy constructor.

Implements container::SortedList.

00092 { }

bool container::SortedLinkedList::insertSorted_impl ( Entity entity  )  [protected, virtual]

Called by a template method.

See also:
Details documented in SortedList::insertSorted

Implements container::SortedList.

00056                                                        {
00057    Entity& newEntity = *entity;
00058    for (struct Node* node = head->next; node != tail; node = node->next) {
00059       Entity& existingEntity = *node->entity;
00060       int delta = newEntity.compareKeyTo(existingEntity);
00061 
00062       if (delta < 0) {
00063          new Node(entity, node);
00064          return true;
00065       }
00066 
00067       if (delta == 0) {
00068          return false;
00069       }
00070    }
00071 
00072    new Node(entity, tail);
00073    return true;
00074 }

Here is the call graph for this function:

Here is the caller graph for this function:

ostream & container::SortedLinkedList::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::LinkedList.

00084                                                          {
00085    return this->LinkedList::renderState(os);
00086 }

const Object::Info * container::SortedLinkedList::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::LinkedList.

00088                                                    {
00089    return TYPE_INFO;
00090 }


Member Data Documentation

Initial value:

      Object::typeInfoFactory("SortedLinkedList")

Reimplemented from container::LinkedList.


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