0.01.00
ot::MessageQueue Class Reference

This class implements a message queue. More...

#include <src/core/common/message.hpp>

Inheritance diagram for ot::MessageQueue:
otMessageQueue

Public Types

enum  QueuePosition {
  kQueuePositionHead,
  kQueuePositionTail
}
 This enumeration represents a position (head or tail) in the queue. More...
 

Public Member Functions

 MessageQueue (void)
 This constructor initializes the message queue.
 
MessageGetHead (void) const
 This method returns a pointer to the first message. More...
 
otError Enqueue (Message &aMessage)
 This method adds a message to the end of the list. More...
 
otError Enqueue (Message &aMessage, QueuePosition aPosition)
 This method adds a message at a given position (head/tail) of the list. More...
 
otError Dequeue (Message &aMessage)
 This method removes a message from the list. More...
 
void GetInfo (uint16_t &aMessageCount, uint16_t &aBufferCount) const
 This method returns the number of messages and buffers enqueued. More...
 

Friends

class Message
 
class PriorityQueue
 

Additional Inherited Members

- Public Attributes inherited from otMessageQueue
void * mData
 Opaque data used by the implementation.
 

Detailed Description

This class implements a message queue.

Member Enumeration Documentation

§ QueuePosition

This enumeration represents a position (head or tail) in the queue.

This is used to specify where a new message should be added in the queue.

Enumerator
kQueuePositionHead 

Indicates the head (front) of the list.

kQueuePositionTail 

Indicates the tail (end) of the list.

Member Function Documentation

§ Dequeue()

otError ot::MessageQueue::Dequeue ( Message aMessage)

This method removes a message from the list.

Parameters
[in]aMessageThe message to remove.
Return values
OT_ERROR_NONESuccessfully removed the message from the list.
OT_ERROR_NOT_FOUNDThe message is not enqueued in a list.

§ Enqueue() [1/2]

otError ot::MessageQueue::Enqueue ( Message aMessage)
inline

This method adds a message to the end of the list.

Parameters
[in]aMessageThe message to add.
Return values
OT_ERROR_NONESuccessfully added the message to the list.
OT_ERROR_ALREADYThe message is already enqueued in a list.

§ Enqueue() [2/2]

otError ot::MessageQueue::Enqueue ( Message aMessage,
QueuePosition  aPosition 
)

This method adds a message at a given position (head/tail) of the list.

Parameters
[in]aMessageThe message to add.
[in]aPositionThe position (head or tail) where to add the message.
Return values
OT_ERROR_NONESuccessfully added the message to the list.
OT_ERROR_ALREADYThe message is already enqueued in a list.

§ GetHead()

Message * ot::MessageQueue::GetHead ( void  ) const

This method returns a pointer to the first message.

Returns
A pointer to the first message.

§ GetInfo()

void ot::MessageQueue::GetInfo ( uint16_t &  aMessageCount,
uint16_t &  aBufferCount 
) const

This method returns the number of messages and buffers enqueued.

Parameters
[out]aMessageCountReturns the number of messages enqueued.
[out]aBufferCountReturns the number of buffers enqueued.

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