2 #ifndef _MADARA_CONTAINERS_QUEUE_INL_ 3 #define _MADARA_CONTAINERS_QUEUE_INL_ 12 : context_ (0), settings_ (settings)
21 count_ (name +
".count", knowledge, 0),
22 head_ (name +
".head", knowledge, 0),
23 tail_ (name +
".tail", knowledge, 0),
35 count_ (name +
".count", knowledge),
36 head_ (name +
".head", knowledge),
37 tail_ (name +
".tail", knowledge),
50 count_ (name +
".count", knowledge, 0),
51 head_ (name +
".head", knowledge, 0),
52 tail_ (name +
".tail", knowledge, 0),
53 queue_ (name, knowledge, size, false, settings),
64 count_ (name +
".count", knowledge, 0),
65 head_ (name +
".head", knowledge, 0),
66 tail_ (name +
".tail", knowledge, 0),
67 queue_ (name, knowledge, size, false, settings),
105 const Queue & value)
const 112 const Queue & value)
const 117 template<
typename... Args>
130 MADARA_GUARD_TYPE guard (
mutex_);
145 MADARA_GUARD_TYPE guard (
mutex_);
158 MADARA_GUARD_TYPE guard (
mutex_);
171 return (
size_t)(*count_);
180 MADARA_GUARD_TYPE guard (
mutex_);
195 MADARA_GUARD_TYPE guard (
mutex_);
212 MADARA_GUARD_TYPE guard (
mutex_);
217 #endif // _MADARA_CONTAINERS_QUEUE_INL_ This class encapsulates an entry in a KnowledgeBase.
bool operator==(const Queue &value) const
Checks for equality.
Queue(const KnowledgeUpdateSettings &settings=KnowledgeUpdateSettings())
Default constructor.
void resize(int size=-1)
Resizes the queue.
bool emplace(Args &&...args)
Enqueues a new record to the end of the queue.
bool operator!=(const Queue &value) const
Checks for inequality.
void clear(void)
Clears the queue.
Integer tail_
Tail of the queue.
size_t count(void)
Returns the number of records in the queue.
size_t size(void) const
Returns the size of the local vector.
std::vector< VariableReference > vector_
Values of the array.
size_t size(void)
Returns the maximum size of the queue.
Integer count_
Count of elements in queue.
knowledge::KnowledgeRecord::Integer increment(knowledge::KnowledgeRecord::Integer base, knowledge::KnowledgeRecord::Integer value)
Increments the base by the value, using size as a boundary.
void set_quality(uint32_t quality, const KnowledgeReferenceSettings &settings=KnowledgeReferenceSettings(false))
Sets the quality of writing to the counter variables.
std::string name_
Prefix of variable.
std::string get_name(void) const
Returns the name of the variable.
A thread-safe guard for a context or knowledge base.
void resize(int size=-1, bool delete_vars=true)
Resizes the vector.
ThreadSafeContext * context_
Variable context that we are modifying.
bool enqueue(const knowledge::KnowledgeRecord &record)
Enqueues a record to the end of the queue.
Vector queue_
Underlying array of records.
knowledge::KnowledgeRecord inspect(size_t position)
Retrieves a record at a position in the queue.
This class provides a distributed knowledge base to users.
Integer head_
Head of the queue.
KnowledgeUpdateSettings settings_
Settings for modifications.
This class stores thread-safe queue within the knowledge base.
Provides functions and classes for the distributed knowledge base.
void operator=(const Queue &rhs)
Assignment operator.
Settings for applying knowledge updates.
madara::knowledge::KnowledgeRecord get(const std::string &key, const KnowledgeReferenceSettings &settings=KnowledgeReferenceSettings()) const
Atomically returns the value of a variable.
uint32_t set_quality(const std::string &key, uint32_t quality, bool force_update, const KnowledgeReferenceSettings &settings)
Atomically sets quality of this process for a variable.
KnowledgeUpdateSettings set_settings(const KnowledgeUpdateSettings &settings)
Sets the update settings for the variable.
Settings for applying knowledge updates.
MADARA_LOCK_TYPE mutex_
guard for access and changes
Provides an interface for external functions into the MADARA KaRL variable settings.