cLinkedList Class Reference
[Container classes]

#include <clinkedlist.h>

Inheritance diagram for cLinkedList:

cOwnedObject cNamedObject cObject

List of all members.


Detailed Description

Use of this class is DISCOURAGED, it is provided for backward compatibility only.

Use std::deque or std::list instead.

A double-linked list of non-cOwnedObject items. cLinkedList has a cQueue-like interface.

Memory management of contained items is controlled by the configPointer() function. As default, pointers are treated as mere pointers, so items are never duplicated or deleted.

See also:
Iterator

Public Member Functions

Constructors, destructor, assignment.
 cLinkedList (const cLinkedList &llist)
 cLinkedList (const char *name=NULL)
virtual ~cLinkedList ()
cLinkedListoperator= (const cLinkedList &queue)
Redefined cObject member functions
virtual cLinkedListdup () const
virtual std::string info () const
virtual void parsimPack (cCommBuffer *buffer)
virtual void parsimUnpack (cCommBuffer *buffer)
Container functions.
void config (VoidDelFunc _delfunc, VoidDupFunc _dupfunc, size_t _itemsize=0)
void insert (void *item)
void insertBefore (void *where, void *item)
void insertAfter (void *where, void *item)
void * head () const
void * tail () const
void * remove (void *item)
void * pop ()
int getLength () const
bool isEmpty () const
int length () const
bool empty () const
bool contains (void *item) const
void clear ()

Classes

class  Iterator
 Walks along a cLinkedList object. More...

Constructor & Destructor Documentation

cLinkedList::cLinkedList ( const cLinkedList llist  ) 

Copy constructor.

Contained items that are owned by the list will be duplicated using the function passed in configPointer() so that the new list will have its own copy of them. By default, there is no duplication function so only the pointers are copied.

cLinkedList::cLinkedList ( const char *  name = NULL  )  [explicit]

Constructor.

It accepts the object name.

virtual cLinkedList::~cLinkedList (  )  [virtual]

Destructor calls clear().


Member Function Documentation

cLinkedList& cLinkedList::operator= ( const cLinkedList queue  ) 

Assignment operator.

The name member is not copied; see cOwnedObject's operator=() for more details. Duplication and assignment work all right with cLinkedList. Contained items are treated as configured with configPointer(). By default, only pointers are copied.

virtual cLinkedList* cLinkedList::dup (  )  const [inline, virtual]

Duplication and assignment work all right with cLinkedList.

Contained items are treated as configured with configPointer(). By default, only pointers are copied.

Reimplemented from cObject.

virtual std::string cLinkedList::info (  )  const [virtual]

Produces a one-line description of the object's contents.

See cObject for more details.

Reimplemented from cObject.

virtual void cLinkedList::parsimPack ( cCommBuffer buffer  )  [virtual]

Serializes the object into an MPI send buffer.

Used by the simulation kernel for parallel execution. See cObject for more details.

Reimplemented from cOwnedObject.

virtual void cLinkedList::parsimUnpack ( cCommBuffer buffer  )  [virtual]

Deserializes the object from an MPI receive buffer Used by the simulation kernel for parallel execution.

See cObject for more details.

Reimplemented from cOwnedObject.

void cLinkedList::config ( VoidDelFunc  _delfunc,
VoidDupFunc  _dupfunc,
size_t  _itemsize = 0 
)

Configures memory management for contained items.

delete func.dupl.func. itemsizebehavior
NULLNULL 0Pointer is treated as mere pointer - no memory management. Duplication copies the pointer, and deletion does nothing.
NULLNULL >0 sizePlain memory management. Duplication is done with operator new char[size]+memcpy(), and deletion is done via operator delete.
NULL or user's delete func.user's dupfunc. indifferentSophisticated memory management. Duplication is done by calling the user-supplied duplication function, which should do the allocation and the appropriate copying. Deletion is done by calling the user-supplied delete function, or the delete operator if it is not supplied.

void cLinkedList::insert ( void *  item  ) 

Inserts the given object at the head of the list.

void cLinkedList::insertBefore ( void *  where,
void *  item 
)

Inserts exactly before the given item.

If the item to be inserted before is not in the list, cRuntimeError is thrown.

void cLinkedList::insertAfter ( void *  where,
void *  item 
)

Inserts exactly after the given item.

If the item to be inserted after is not in the list, cRuntimeError is thrown.

void* cLinkedList::head (  )  const [inline]

Returns the first item in the list, or NULL pointer if the list is empty.

void* cLinkedList::tail (  )  const [inline]

Returns the last item in the list, or NULL pointer if the list is empty.

void* cLinkedList::remove ( void *  item  ) 

Unlinks and returns the given item.

If the item is not in the list, cRuntimeError is thrown.

void* cLinkedList::pop (  ) 

Unlinks and returns the last item in the list.

If the list is empty, cRuntimeError is thrown.

int cLinkedList::getLength (  )  const [inline]

Returns the number of items contained in the list.

bool cLinkedList::isEmpty (  )  const [inline]

Returns true if the list is empty.

int cLinkedList::length (  )  const [inline]

Alias for getLength().

bool cLinkedList::empty (  )  const [inline]

Alias for isEmpty().

bool cLinkedList::contains ( void *  item  )  const [inline]

Returns true if the list contains the given pointer.

void cLinkedList::clear (  ) 

As a result, the container will be empty.

Contained items will be deleted as configured by configPointer().


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

Generated on Wed Apr 3 14:40:28 2013 for OMNeT++ Simulation Library by  doxygen 1.5.5