WSF
wsf::comm::Queue Class Reference

#include <WsfCommQueue.hpp>

Classes

class  Entry

Public Types

enum class  QueueType : size_t { cFIFO , cLIFO , cPRIORITY }
 Queue Types. More...

Public Member Functions

 Queue ()=default
virtual ~Queue ()=default
bool Push (const Entry &aEntry)
void Pop ()
const EntryTop () const
const EntryPeek (const Message::Identifier &aIdentifier) const
EntryPeek (const Message::Identifier &aIdentifier)
size_t Size () const
 The number of entries, regardless of status.
size_t SizeActiveEntries () const
bool Empty () const
 If the queue is empty, regardless of entry status.
bool EmptyActiveEntries () const
QueueType GetQueueType () const
void SetQueueType (QueueType aType)
size_t GetLimit () const
 Limits apply to all entries, regardless of status.
void SetLimit (size_t aLimit)
std::vector< EntryRemove (double aTime)
bool EntryProcessed (const Message::Identifier &aIdentifier)
bool EntryReprocessed (double aSimTime, const Message::Identifier &aIdentifier)
bool EntryDropped (const Message::Identifier &aIdentifier)

Detailed Description

This class provides a 'queue-like' container for holding comm messages, specifically intended for usage by the datalink layer. Messages are intended to be processed in a typical queue implementation of indicated type. However, messages may have different lifetimes. As such, this container must differentiate messages based on their status, and must have visibility into the container beyond the top entry.

Member Enumeration Documentation

◆ QueueType

enum class wsf::comm::Queue::QueueType : size_t
strong

Queue Types.

Enumerator
cFIFO 
cLIFO 
cPRIORITY 

Constructor & Destructor Documentation

◆ Queue()

wsf::comm::Queue::Queue ( )
default

Referenced by Peek().

◆ ~Queue()

virtual wsf::comm::Queue::~Queue ( )
virtualdefault

References Peek(), Pop(), Push(), and Top().

Member Function Documentation

◆ Empty()

bool wsf::comm::Queue::Empty ( ) const
inline

If the queue is empty, regardless of entry status.

◆ EmptyActiveEntries()

bool wsf::comm::Queue::EmptyActiveEntries ( ) const

Indicates presence of any entries able to be 'popped', i.e. those with a status of cQUEUED.

References SizeActiveEntries().

Referenced by Pop(), and Top().

◆ EntryDropped()

bool wsf::comm::Queue::EntryDropped ( const Message::Identifier & aIdentifier)

Completely removes an entry regardless of status. Can be called when a message is guaranteed to be done with processing, or is discarded.

References wsf::comm::Queue::Entry::GetMessage().

◆ EntryProcessed()

bool wsf::comm::Queue::EntryProcessed ( const Message::Identifier & aIdentifier)

Status call methods After initial addition of entries to the queue, members may be internally updated based on their status.

Changes an entry of status cQUEUED to cPROCESSED. Done automatically when popped, but available for other use cases.

References wsf::comm::Queue::Entry::cPROCESSED, wsf::comm::Queue::Entry::cQUEUED, and Peek().

Referenced by Pop().

◆ EntryReprocessed()

bool wsf::comm::Queue::EntryReprocessed ( double aSimTime,
const Message::Identifier & aIdentifier )

Changes an entry of status cPROCESSED to cREPROCESSED. Called externally, procedurally the same as cPROCESSED within the queue. Requires provision of current time to reset the timer for this message.

References wsf::comm::Queue::Entry::cPROCESSED, wsf::comm::Queue::Entry::cREPROCESSED, and Peek().

◆ GetLimit()

size_t wsf::comm::Queue::GetLimit ( ) const
inline

Limits apply to all entries, regardless of status.

◆ GetQueueType()

QueueType wsf::comm::Queue::GetQueueType ( ) const
inline

◆ Peek() [1/2]

Queue::Entry * wsf::comm::Queue::Peek ( const Message::Identifier & aIdentifier)

References Queue().

◆ Peek() [2/2]

const Queue::Entry * wsf::comm::Queue::Peek ( const Message::Identifier & aIdentifier) const

◆ Pop()

void wsf::comm::Queue::Pop ( )

Pop only removes those entries in a state that qualifies, i.e. those with a status of cQUEUED. It does not actually remove the entry, the status of the entry is changed to make it ineligible for future pops.

Always valid iterator due to initial check of non-empty queue

References cFIFO, cLIFO, cPRIORITY, wsf::comm::Queue::Entry::cPROCESSED, wsf::comm::Queue::Entry::cQUEUED, EmptyActiveEntries(), EntryProcessed(), wsf::comm::Queue::Entry::GetMessage(), wsf::comm::Queue::Entry::GetStatus(), and wsf::comm::Message::SourceMessage().

Referenced by ~Queue().

◆ Push()

bool wsf::comm::Queue::Push ( const Entry & aEntry)

Ensure the entry has valid data. This avoids repetitive validity checks, and can also aid in debugging errors in logic prior to reception at the queue.

References wsf::comm::Queue::Entry::GetMessage(), ok, and wsf::comm::Message::SourceMessage().

Referenced by ~Queue().

◆ Remove()

◆ SetLimit()

void wsf::comm::Queue::SetLimit ( size_t aLimit)
inline

◆ SetQueueType()

void wsf::comm::Queue::SetQueueType ( QueueType aType)
inline

◆ Size()

size_t wsf::comm::Queue::Size ( ) const
inline

The number of entries, regardless of status.

◆ SizeActiveEntries()

size_t wsf::comm::Queue::SizeActiveEntries ( ) const

Provides the size of entries able to be 'popped', i.e. those with a status of cQUEUED.

References wsf::comm::Queue::Entry::cQUEUED, and wsf::comm::Queue::Entry::GetStatus().

Referenced by EmptyActiveEntries().

◆ Top()

const Queue::Entry & wsf::comm::Queue::Top ( ) const

Top only provides the next entry (depending on queue type) in a state valid for processing, i.e. cQUEUED.

Check for non-empty std::list needed to avoid undefined behavior.

Always valid iterator due to initial check of non-empty queue

References cFIFO, cLIFO, cPRIORITY, wsf::comm::Queue::Entry::cQUEUED, EmptyActiveEntries(), wsf::comm::Queue::Entry::GetMessage(), wsf::comm::Queue::Entry::GetStatus(), Peek(), and wsf::comm::Message::SourceMessage().

Referenced by ~Queue().


The documentation for this class was generated from the following files:
Copyrights Multiple, All Rights Reserved