cLinkedList Class Reference
[Container classes]

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

#include <clinkedlist.h>

Inheritance diagram for cLinkedList:
cOwnedObject cNamedObject cObject

List of all members.

Classes

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

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 ()

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

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.


Member Function Documentation

void cLinkedList::clear (  ) 

As a result, the container will be empty.

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

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.
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.

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::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.

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 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::pop (  ) 

Unlinks and returns the last item in the list.

If the list is empty, cRuntimeError is thrown.

void* cLinkedList::remove ( void *  item  ) 

Unlinks and returns the given item.

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


The documentation for this class was generated from the following file:
Generated on Tue Dec 2 11:16:28 2014 for OMNeT++ Simulation Library by  doxygen 1.6.3