|
MADARA
3.1.8
|
This class stores thread-safe queue within the knowledge base. More...
#include <Queue.h>

Public Member Functions | |
| Queue (const KnowledgeUpdateSettings &settings=KnowledgeUpdateSettings()) | |
| Default constructor. More... | |
| Queue (const std::string &name, KnowledgeBase &knowledge, const KnowledgeUpdateSettings &settings=KnowledgeUpdateSettings()) | |
| Constructor. More... | |
| Queue (const std::string &name, Variables &knowledge, const KnowledgeUpdateSettings &settings=KnowledgeUpdateSettings()) | |
| Constructor. More... | |
| Queue (const std::string &name, KnowledgeBase &knowledge, int size, const KnowledgeUpdateSettings &settings=KnowledgeUpdateSettings()) | |
| Default constructor. More... | |
| Queue (const std::string &name, Variables &knowledge, int size, const KnowledgeUpdateSettings &settings=KnowledgeUpdateSettings()) | |
| Default constructor. More... | |
| Queue (const Queue &rhs) | |
| Copy constructor. More... | |
| virtual | ~Queue ()=default |
| Destructor. More... | |
| void | clear (void) |
| Clears the queue. More... | |
| size_t | count (void) |
| Returns the number of records in the queue. More... | |
| knowledge::KnowledgeRecord | dequeue (bool wait=true) |
| Dequeues a record from the front of the queue. More... | |
| template<typename... Args> | |
| bool | emplace (Args &&...args) |
| Enqueues a new record to the end of the queue. More... | |
| bool | enqueue (const knowledge::KnowledgeRecord &record) |
| Enqueues a record to the end of the queue. More... | |
| std::string | get_name (void) const |
| Returns the name of the variable. More... | |
| knowledge::KnowledgeRecord | inspect (size_t position) |
| Retrieves a record at a position in the queue. More... | |
| bool | operator!= (const Queue &value) const |
| Checks for inequality. More... | |
| void | operator= (const Queue &rhs) |
| Assignment operator. More... | |
| bool | operator== (const Queue &value) const |
| Checks for equality. More... | |
| void | resize (int size=-1) |
| Resizes the queue. More... | |
| void | set_name (const std::string &var_name, KnowledgeBase &knowledge) |
| Sets the variable name that this refers to. More... | |
| void | set_name (const std::string &var_name, Variables &knowledge) |
| Sets the variable name that this refers to. More... | |
| void | set_quality (uint32_t quality, const KnowledgeReferenceSettings &settings=KnowledgeReferenceSettings(false)) |
| Sets the quality of writing to the counter variables. More... | |
| KnowledgeUpdateSettings | set_settings (const KnowledgeUpdateSettings &settings) |
| Sets the update settings for the variable. More... | |
| size_t | size (void) |
| Returns the maximum size of the queue. More... | |
Private Member Functions | |
| knowledge::KnowledgeRecord::Integer | increment (knowledge::KnowledgeRecord::Integer base, knowledge::KnowledgeRecord::Integer value) |
| Increments the base by the value, using size as a boundary. More... | |
Private Attributes | |
| ThreadSafeContext * | context_ |
| Variable context that we are modifying. More... | |
| Integer | count_ |
| Count of elements in queue. More... | |
| Integer | head_ |
| Head of the queue. More... | |
| MADARA_LOCK_TYPE | mutex_ |
| guard for access and changes More... | |
| std::string | name_ |
| Prefix of variable. More... | |
| Vector | queue_ |
| Underlying array of records. More... | |
| KnowledgeUpdateSettings | settings_ |
| Settings for modifications. More... | |
| Integer | tail_ |
| Tail of the queue. More... | |
This class stores thread-safe queue within the knowledge base.
The Queue allows for O(1) enqueue/dequeue time. It also allows for O(1) inspection of arbitrary elements and features asynchronous and synchronous dequeues.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
virtualdefault |
Destructor.
|
inline |
|
inline |
| madara::knowledge::KnowledgeRecord madara::knowledge::containers::Queue::dequeue | ( | bool | wait = true | ) |
Dequeues a record from the front of the queue.
This method support both blocking and non-blocking dequeues. The default operation is to wait for an element to become available in the queue and only return a valid element. Setting wait to false enables an asynchronous call that returns immediately with either a valid record or an UNINITIALIZED record, the latter of which means there was nothing in queue.
|
inline |
Enqueues a new record to the end of the queue.
| args | arguments to pass to KnowledgeRecord |
| bool madara::knowledge::containers::Queue::enqueue | ( | const knowledge::KnowledgeRecord & | record | ) |
| std::string madara::knowledge::containers::Queue::get_name | ( | void | ) | const |
|
inlineprivate |
|
inline |
|
inline |
|
inline |
|
inline |
| void madara::knowledge::containers::Queue::resize | ( | int | size = -1 | ) |
| void madara::knowledge::containers::Queue::set_name | ( | const std::string & | var_name, |
| KnowledgeBase & | knowledge | ||
| ) |
| void madara::knowledge::containers::Queue::set_name | ( | const std::string & | var_name, |
| Variables & | knowledge | ||
| ) |
| void madara::knowledge::containers::Queue::set_quality | ( | uint32_t | quality, |
| const KnowledgeReferenceSettings & | settings = KnowledgeReferenceSettings (false) |
||
| ) |
| madara::knowledge::KnowledgeUpdateSettings madara::knowledge::containers::Queue::set_settings | ( | const KnowledgeUpdateSettings & | settings | ) |
|
inline |
|
mutableprivate |
|
private |
|
private |
|
mutableprivate |
|
private |
|
private |
|
private |
|
private |