cPacketQueue Class Reference
[Container classes]

A queue class specialized for cPacket objects. More...

#include <cpacketqueue.h>

Inheritance diagram for cPacketQueue:
cQueue cOwnedObject cNamedObject cObject

List of all members.

Public Member Functions

Constructors, destructor, assignment.

 cPacketQueue (const char *name=NULL, CompareFunc cmp=NULL)
 cPacketQueue (const cPacketQueue &queue)
cPacketQueueoperator= (const cPacketQueue &queue)
Redefined cObject member functions.

virtual cPacketQueuedup () const
virtual std::string info () const
virtual void parsimPack (cCommBuffer *buffer)
virtual void parsimUnpack (cCommBuffer *buffer)
Setup, insertion and removal functions.

virtual void insert (cPacket *pkt)
virtual void insertBefore (cPacket *where, cPacket *pkt)
virtual void insertAfter (cPacket *where, cPacket *pkt)
virtual cPacketremove (cPacket *pkt)
virtual cPacketpop ()
virtual void clear ()
Query functions.

int64 getBitLength () const
int64 getByteLength () const
virtual cPacketfront () const
virtual cPacketback () const
cPacketget (int i) const

Detailed Description

A queue class specialized for cPacket objects.

The added value is that this class keeps track of the total queue length in bits as well.


Constructor & Destructor Documentation

cPacketQueue::cPacketQueue ( const cPacketQueue queue  ) 

Copy constructor.

Contained objects that are owned by the queue will be duplicated so that the new queue will have its own copy of them.


Member Function Documentation

virtual cPacket* cPacketQueue::back (  )  const [inline, virtual]

Returns pointer to the last (back) element in the queue.

This is the element most recently added by insert(). Returns NULL if the queue is empty.

Reimplemented from cQueue.

References cQueue::front().

virtual void cPacketQueue::clear (  )  [virtual]

Empties the container.

Contained objects that were owned by the queue (see getTakeOwnership()) will be deleted.

Reimplemented from cQueue.

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

Duplication and assignment work all right with cPacketQueue.

Contained objects that are owned by the queue will be duplicated so that the new queue will have its own copy of them.

Reimplemented from cQueue.

virtual cPacket* cPacketQueue::front (  )  const [inline, virtual]

Returns pointer to the object at the front of the queue.

This is the element to be return by pop(). Returns NULL if the queue is empty.

Reimplemented from cQueue.

cPacket* cPacketQueue::get ( int  i  )  const [inline]

Returns the ith element in the queue, or NULL if i is out of range.

get(0) returns the front element. This method performs linear search.

Reimplemented from cQueue.

References cQueue::back().

int64 cPacketQueue::getBitLength (  )  const [inline]

Returns the total size of the messages in the queue, in bits.

This is the sum of the message bit lengths; see cPacket::getBitLength().

int64 cPacketQueue::getByteLength (  )  const [inline]

Returns the sum of the message lengths in bytes, that is, getBitLength()/8.

If getBitLength() is not a multiple of 8, the result is rounded up.

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

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

See cObject for more details.

Reimplemented from cQueue.

virtual void cPacketQueue::insert ( cPacket pkt  )  [virtual]

Adds an element to the back of the queue.

Trying to insert a NULL pointer is an error (throws cRuntimeError). The given object must be an instance of cPacket.

virtual void cPacketQueue::insertAfter ( cPacket where,
cPacket pkt 
) [virtual]

Inserts exactly after the given object.

If the given position does not exist or if you try to insert a NULL pointer, cRuntimeError is thrown. The given object must be an instance of cPacket.

virtual void cPacketQueue::insertBefore ( cPacket where,
cPacket pkt 
) [virtual]

Inserts exactly before the given object.

If the given position does not exist or if you try to insert a NULL pointer, cRuntimeError is thrown. The given object must be an instance of cPacket.

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

Assignment operator.

Duplication and assignment work all right with cPacketQueue. Contained objects that are owned by the queue will be duplicated so that the new queue will have its own copy of them.

The name member is not copied; see cNamedObject's operator=() for more details.

virtual void cPacketQueue::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 cQueue.

virtual void cPacketQueue::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 cQueue.

virtual cPacket* cPacketQueue::pop (  )  [virtual]

Unlinks and returns the front element in the queue.

If the queue is empty, cRuntimeError is thrown.

Reimplemented from cQueue.

virtual cPacket* cPacketQueue::remove ( cPacket pkt  )  [virtual]

Unlinks and returns the object given.

If the object is not in the queue, NULL pointer is returned. The given object must be an instance of cPacket.


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