|
WSF
|
#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 Entry & | Top () const |
| const Entry * | Peek (const Message::Identifier &aIdentifier) const |
| Entry * | Peek (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< Entry > | Remove (double aTime) |
| bool | EntryProcessed (const Message::Identifier &aIdentifier) |
| bool | EntryReprocessed (double aSimTime, const Message::Identifier &aIdentifier) |
| bool | EntryDropped (const Message::Identifier &aIdentifier) |
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.
|
strong |
|
default |
Referenced by Peek().
|
inline |
If the queue is empty, regardless of entry status.
| 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().
| 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().
| 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().
| 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().
|
inline |
Limits apply to all entries, regardless of status.
|
inline |
| Queue::Entry * wsf::comm::Queue::Peek | ( | const Message::Identifier & | aIdentifier | ) |
References Queue().
| const Queue::Entry * wsf::comm::Queue::Peek | ( | const Message::Identifier & | aIdentifier | ) | const |
References wsf::comm::Queue::Entry::GetMessage().
Referenced by EntryProcessed(), EntryReprocessed(), Top(), and ~Queue().
| 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().
| 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().
| std::vector< Queue::Entry > wsf::comm::Queue::Remove | ( | double | aTime | ) |
|
inline |
|
inline |
|
inline |
The number of entries, regardless of status.
| 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().
| 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().