1 #ifndef _MADARA_KNOWLEDGE_CONTAINERS_NATIVECIRCULARBUFFERCONSUMER_H_
2 #define _MADARA_KNOWLEDGE_CONTAINERS_NATIVECIRCULARBUFFERCONSUMER_H_
6 #include "madara/LockType.h"
152 void consume(T& value,
size_t& dropped)
const;
207 size_t count,
size_t& dropped)
const;
229 size_t count, std::vector<T>& values,
size_t& dropped)
const;
255 size_t count(
void)
const;
261 size_t size(
void)
const;
317 size_t count,
size_t& dropped)
const;
342 std::vector<KnowledgeRecord>
inspect(
358 std::vector<T>& values)
const;
391 static void check_name(
const char* func,
const char* name);
This class provides a distributed knowledge base to users.
This class encapsulates an entry in a KnowledgeBase.
This class stores variables and their values for use by any entity needing state information in a thr...
Optimized reference to a variable within the knowledge base.
Provides an interface for external functions into the MADARA KaRL variable settings.
This class provides an interface similar to CircularBufferConsumer, which uses the internal history b...
static void check_name(const char *func, const char *name)
VariableReference ref_
Reference to underlying record we are reading.
void inspect(KnowledgeRecord::Integer position, T &value) const
Retrieves a record at a position relative to local index.
void consume_many(size_t count, std::vector< T > &values) const
Consumes (earliest) records from the local index.
void set_index(size_t index)
Sets the local index to an arbitrary position.
std::string get_name(void) const
Returns the name of the variable.
madara::knowledge::KnowledgeRecord consume(void) const
Consumes the record at the local index (not the producer index)
madara::knowledge::KnowledgeRecord consume_latest(void) const
Consumes the latest the record at the local index (not the producer index).
size_t local_index_
Index for latest item read by.
void set_name(const std::string &name, KnowledgeBase &knowledge)
Sets the variable name that this refers to.
KnowledgeRecord get_record() const
Get the KnowledgeRecord this container refers to.
ThreadSafeContext * context_
Variable context that we are modifying.
size_t get_dropped(void) const
Returns the number of known drops since last consume.
void check_context(const char *func) const
bool operator==(const NativeCircularBufferConsumer &value) const
Checks for equality.
size_t count(void) const
Returns the number of records in the NativeCircularBufferConsumer.
size_t remaining(void) const
Returns the number of records remaining that have not been consumed.
size_t get_index()
Gets the local index.
madara::knowledge::KnowledgeRecord peek_latest(void) const
Peeks, but does not consume, the latest the record at the local index (not the producer index).
NativeCircularBufferConsumer()
Default constructor.
size_t size(void) const
Returns the maximum size of the NativeCircularBufferConsumer.
bool operator!=(const NativeCircularBufferConsumer &value) const
Checks for inequality.
virtual ~NativeCircularBufferConsumer()=default
Destructor.
Provides container classes for fast knowledge base access and mutation.
Provides functions and classes for the distributed knowledge base.
Copyright(c) 2020 Galois.