#include <cllist.h>
Inheritance diagram for cLinkedList:
Use std::deque or std::list instead.
A double-linked list of non-cObject 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.
Public Member Functions | |
Constructors, destructor, assignment. | |
cLinkedList (const cLinkedList &llist) | |
cLinkedList (const char *name=NULL) | |
virtual | ~cLinkedList () |
cLinkedList & | operator= (const cLinkedList &queue) |
Redefined cObject member functions | |
virtual cPolymorphic * | dup () const |
virtual std::string | info () const |
virtual void | netPack (cCommBuffer *buffer) |
virtual void | netUnpack (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 | length () const |
bool | empty () const |
bool | contains (void *item) const |
void | clear () |
Classes | |
class | Iterator |
Walks along a cLinkedList object. More... |
|
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's no duplication function so only the pointers are copied. |
|
Constructor. It accepts the object name. |
|
Destructor calls clear().
|
|
As a result, the container will be empty. Contained items will be deleted as configured by configPointer(). |
|
Configures memory management for contained items.
|
|
Returns true if the list contains the given pointer.
|
|
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. |
|
Returns true if the list is empty.
|
|
Returns the first item in the list or NULL pointer if the list is empty.
|
|
Produces a one-line description of object contents into the buffer passed as argument. See cObject for more details. Reimplemented from cPolymorphic. |
|
Inserts the given object at the head of the list.
|
|
Inserts exactly after the given item. If the item to be inserted after is not in the list, cRuntimeError is thrown. |
|
Inserts exactly before the given item. If the item to be inserted before is not in the list, cRuntimeError is thrown. |
|
Returns the number of items contained in the list.
|
|
Serializes the object into a PVM or MPI send buffer. Used by the simulation kernel for parallel execution. See cObject for more details. Reimplemented from cObject. |
|
Deserializes the object from a PVM or MPI receive buffer Used by the simulation kernel for parallel execution. See cObject for more details. Reimplemented from cObject. |
|
Assignment operator. The name member doesn't get copied; see cObject'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. |
|
Unlinks and returns the last item in the list. If the list is empty, cRuntimeError is thrown. |
|
Unlinks and returns the given item. If the item is not in the list, cRuntimeError is thrown. |
|
Returns the last item in the list or NULL pointer if the list is empty.
|