CNQPacketQueue Class Reference

Implementation of platform (and stack) independent FIFO packet queue for objects of type CNQMessage. More...

#include <NQPacketQueue.h>

Inherits CNQLockMechanism.

Collaboration diagram for CNQPacketQueue:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 CNQPacketQueue ()
virtual ~CNQPacketQueue ()
bool setQueueMaxsize (INT32 maxsize, UINT32 &lasterr)
 Adjust the Queue depth.
UINT32 getLastError ()
 Returns last error code happened.
bool pop_front (CNQMessage **obj, UINT32 &lasterr)
 Gets the first message (FIFO) out of the queue.
bool push_back (const CNQMessage *obj, UINT32 &lasterr)
 Appends a CNQMessage object to the end of the (FIFO) queue.
bool remove_elem (UINT16 requestid, UINT32 &lasterr)
bool find_elem (UINT16 requestid, CNQMessage **obj, UINT32 &lasterr)
bool find_and_remove_elem (UINT16 requestid, CNQMessage **obj, UINT32 &lasterr)
int size (UINT32 &lasterr)
bool find_elem_ack_and_signal (const CNQMessage &aAckPacket, UINT32 &lasterr)
bool find_and_remove_passed_elem (CNQMessage *obj, UINT32 &lasterr)
bool setQueueMaxsize (INT32 maxsize)
bool pop_front (CNQMessage **obj)
bool push_back (const CNQMessage *obj)
bool remove_elem (UINT16 requestid)
bool find_elem (UINT16 requestid, CNQMessage **obj)
bool find_and_remove_elem (UINT16 requestid, CNQMessage **obj)
int size ()
 Returns the current amount of elements stored in the queue.
bool find_elem_ack_and_signal (const CNQMessage &aAckPacket)
bool find_and_remove_passed_elem (CNQMessage *obj)

Private Attributes

INT32 m_iQueueFirstElement
INT32 m_iQueueLastElement
INT32 m_iQueueNumElements
VOIDPm_pQueueValue
INT32m_iQueueNextElement
INT32 m_iQueueMaxSize
UINT32 m_iLastError

Friends

class CNQMessage


Detailed Description

Implementation of platform (and stack) independent FIFO packet queue for objects of type CNQMessage.

Using C++ STL this could be done much more easily, but implementation on Nios2 platform did not work (reason not fully known, stack issues suspected). This CNQPacketQueue was created as a slightly inferior, but working solution.

Implementation details:

Definition at line 25 of file NQPacketQueue.h.


Constructor & Destructor Documentation

CNQPacketQueue::CNQPacketQueue (  ) 

Definition at line 14 of file NQPacketQueue.cpp.

CNQPacketQueue::~CNQPacketQueue (  )  [virtual]

Definition at line 39 of file NQPacketQueue.cpp.


Member Function Documentation

bool CNQPacketQueue::setQueueMaxsize ( INT32  maxsize,
UINT32 lasterr 
)

Adjust the Queue depth.

This method adjusts the queue depth by reinitializing the queue pool. Any data accumulated in the queue might be lost after readjustment.

Parameters:
maxsize new 'queue depth'
lasterr unique error code
Return values:
true successfully readjusted to 'maxsize' depth
false failure, something happened (see lasterr) if lasterr ERR_PQ_LOCK, mutex locking failed
See also:
Network Queue Error Codes

Definition at line 124 of file NQPacketQueue.cpp.

Referenced by CNetworkQueue::CNetworkQueue(), and setQueueMaxsize().

Here is the call graph for this function:

Here is the caller graph for this function:

UINT32 CNQPacketQueue::getLastError (  ) 

Returns last error code happened.

for detailed list of possible error codes, see Declarations.h

See also:
Network Queue Error Codes

Definition at line 768 of file NQPacketQueue.cpp.

bool CNQPacketQueue::pop_front ( CNQMessage **  obj,
UINT32 lasterr 
)

Gets the first message (FIFO) out of the queue.

Parameters:
obj place to store extracted element (empty variable of type CNQMessage)
lasterr unique error code
Return values:
true successful, first element extracted and put to **obj
false failure, something happened (see lasterr)
Errorcodes:

Note:
This function contains assert() which gives more failure reasons during development/debugging.
See also:
Network Queue Error Codes

Definition at line 177 of file NQPacketQueue.cpp.

Referenced by CNetworkQueue::close(), pop_front(), CNetworkQueue::recvMsg(), and CNetworkQueue::SendProcessTask().

Here is the call graph for this function:

Here is the caller graph for this function:

bool CNQPacketQueue::push_back ( const CNQMessage obj,
UINT32 lasterr 
)

Appends a CNQMessage object to the end of the (FIFO) queue.

Parameters:
obj object reference to store
lasterr unique error code
Return values:
true successful, element reference to obj appended
false failure, something happened (see lasterr)
Errorcodes:

Note:
This function contains assert() which gives more failure reasons during development/debugging.
See also:
Network Queue Error Codes

Definition at line 239 of file NQPacketQueue.cpp.

Referenced by push_back(), CNetworkQueue::ReceiveProcessTask(), CNetworkQueue::sendMsgTo(), and CNetworkQueue::sendMsgToInternal().

Here is the call graph for this function:

Here is the caller graph for this function:

bool CNQPacketQueue::remove_elem ( UINT16  requestid,
UINT32 lasterr 
)

This method traverses the queue, looks for a CNQMessage element that contains the 'requestid' and removes it.

Parameters:
requestid CNQMessage object's request id (this object will be removed from the queue if found)
lasterr unique error code
Return values:
true successful, element reference was removed
false failure, something happened (see lasterr)
Errorcodes:

Note:
This function contains assert() which gives more failure reasons during development/debugging.
See also:
Network Queue Error Codes

Definition at line 327 of file NQPacketQueue.cpp.

Referenced by remove_elem().

Here is the call graph for this function:

Here is the caller graph for this function:

bool CNQPacketQueue::find_elem ( UINT16  requestid,
CNQMessage **  obj,
UINT32 lasterr 
)

This method traverses the queue, looks for a CNQMessage element that contains the 'requestid' and returns it without removeing it.

Parameters:
requestid CNQMessage object's request id (this object will be returned if found)
obj place to store element, if found (empty variable of type CNQMessage *)
lasterr unique error code
Return values:
true successful, element is returned
false failure, something happened, element is NOT returned (see lasterr)
Errorcodes:

See also:
Network Queue Error Codes

Definition at line 428 of file NQPacketQueue.cpp.

Referenced by find_elem().

Here is the call graph for this function:

Here is the caller graph for this function:

bool CNQPacketQueue::find_and_remove_elem ( UINT16  requestid,
CNQMessage **  obj,
UINT32 lasterr 
)

This method traverses the queue, looks for a CNQMessage element that contains the 'requestid' and returns it. The object reference is removed from the queue.

Parameters:
requestid CNQMessage object's request id (this object will be returned if found)
obj place to store element, if found (empty variable of type CNQMessage *)
lasterr unique error code
Return values:
true successful, element is returned and removed from queue
false failure, something happened, element is NOT returned (see lasterr)
Errorcodes:

note\ This function contains assert() which gives more failure reasons during development/debugging.

See also:
Network Queue Error Codes

Definition at line 666 of file NQPacketQueue.cpp.

Referenced by find_and_remove_elem(), and CNetworkQueue::sendRecvMsg().

Here is the call graph for this function:

Here is the caller graph for this function:

int CNQPacketQueue::size ( UINT32 lasterr  ) 

Referenced by CNetworkQueue::close().

Here is the caller graph for this function:

bool CNQPacketQueue::find_elem_ack_and_signal ( const CNQMessage ack_packet,
UINT32 lasterr 
)

This method traverses the queue, looks for a CNQMessage element that matches the passed 'ack packet' and signals the attached semaphore in case a match is found.

This method is used in order to signal 'waiting to be ACKed' packets inside ReceiveProcessTask on successful reception of an ACK packet.

Parameters:
ack_packet CNQMessage object's ack_packet
lasterr unique error code
Return values:
true successful, element is returned
false failure, something happened, element is NOT returned (see lasterr)
Errorcodes:

Note:
In case of debug version a special assert is thrown in case the semaphore could not be signalled.
See also:
Network Queue Error Codes

Definition at line 495 of file NQPacketQueue.cpp.

Referenced by find_elem_ack_and_signal(), and CNetworkQueue::ReceiveProcessTask().

Here is the call graph for this function:

Here is the caller graph for this function:

bool CNQPacketQueue::find_and_remove_passed_elem ( CNQMessage obj,
UINT32 lasterr 
)

This method traverses the queue, looks for a CNQMessage element that matches the passed CNQMessage and, if found, removes the object reference from the queue.

Parameters:
obj a valid CNQMessage to look for inside the queue
lasterr unique error code
Return values:
true successful, element is returned and removed from queue
false failure, something happened, element is NOT returned (see lasterr)
Errorcodes:

Note:
This function contains assert() which gives more failure reasons during development/debugging.
See also:
Network Queue Error Codes

Definition at line 564 of file NQPacketQueue.cpp.

Referenced by find_and_remove_passed_elem(), and CNetworkQueue::sendMsgTo().

Here is the call graph for this function:

Here is the caller graph for this function:

bool CNQPacketQueue::setQueueMaxsize ( INT32  maxsize  ) 

Definition at line 49 of file NQPacketQueue.cpp.

Here is the call graph for this function:

bool CNQPacketQueue::pop_front ( CNQMessage **  obj  ) 

Definition at line 56 of file NQPacketQueue.cpp.

Here is the call graph for this function:

bool CNQPacketQueue::push_back ( const CNQMessage obj  ) 

Definition at line 63 of file NQPacketQueue.cpp.

Here is the call graph for this function:

bool CNQPacketQueue::remove_elem ( UINT16  requestid  ) 

Definition at line 70 of file NQPacketQueue.cpp.

Here is the call graph for this function:

bool CNQPacketQueue::find_elem ( UINT16  requestid,
CNQMessage **  obj 
)

Definition at line 77 of file NQPacketQueue.cpp.

Here is the call graph for this function:

bool CNQPacketQueue::find_and_remove_elem ( UINT16  requestid,
CNQMessage **  obj 
)

Definition at line 84 of file NQPacketQueue.cpp.

Here is the call graph for this function:

int CNQPacketQueue::size (  ) 

Returns the current amount of elements stored in the queue.

Return values:
>0 number of elements in queue
0 failure or queue is empty (see lasterr)

Definition at line 756 of file NQPacketQueue.cpp.

bool CNQPacketQueue::find_elem_ack_and_signal ( const CNQMessage aAckPacket  ) 

Definition at line 91 of file NQPacketQueue.cpp.

Here is the call graph for this function:

bool CNQPacketQueue::find_and_remove_passed_elem ( CNQMessage obj  ) 

Definition at line 98 of file NQPacketQueue.cpp.

Here is the call graph for this function:


Friends And Related Function Documentation

friend class CNQMessage [friend]

Definition at line 27 of file NQPacketQueue.h.


Member Data Documentation

Definition at line 65 of file NQPacketQueue.h.

Referenced by CNQPacketQueue(), push_back(), and setQueueMaxsize().


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

Generated on Tue Apr 22 18:19:59 2008 for NetworkQueue by  doxygen 1.5.5