container::LinkedList::Node Class Reference
LinkedList uses
Node objects to form a list of
Entity objects.
More...
#include <linkedlist.h>
List of all members.
Detailed Description
LinkedList uses
Node objects to form a list of
Entity objects.
Node is doubly linked. It keeps a pointer to its Entity object and expects it to be dynamically allocated. Node takes responsibility for deleting its Entity object during Node destruction.
- Todo:
- Break node out from LinkedList, or at least provide a .h file. A Node could be used like an iterator. There is some functionality like toNext() and toPrev() that should be encapsulated in Node instead of LinkedList. Node could be re-used as the building block for other linked list type structures.
Constructor & Destructor Documentation
container::LinkedList::Node::Node |
( |
|
) |
|
container::LinkedList::Node::Node |
( |
Entity * |
e, |
|
|
Node * |
n | |
|
) |
| | |
Construct a Node for Entity e and insert it into the list before Node n.
- Precondition:
- n points to a Node that is part of a correctly formed linked list structure
e points to an Entity
- Postcondition:
- The newly constructed Node is in the linked list structure before Node n
container::LinkedList::Node::~Node |
( |
|
) |
|
00217 {
00218
00219 if (prev != NULL) {
00220 prev->next = next;
00221 }
00222
00223 if (next != NULL) {
00224 next->prev = prev;
00225 }
00226
00227
00228 if (entity != NULL) {
00229 delete entity;
00230 }
00231 }
Member Function Documentation
Entity * container::LinkedList::Node::extractEntity |
( |
|
) |
|
00233 {
00234 Entity *e = entity;
00235 entity = NULL;
00236 return e;
00237 }
Member Data Documentation
The documentation for this class was generated from the following files: