1 #ifndef _MADARA_KNOWLEDGE_CONTAINERS_STRINGSTAGED_INL_ 2 #define _MADARA_KNOWLEDGE_CONTAINERS_STRINGSTAGED_INL_ 21 std::stringstream result;
23 result <<
"StringStaged: ";
28 MADARA_GUARD_TYPE guard (
mutex_);
30 result << this->
name_;
69 MADARA_GUARD_TYPE guard (
mutex_);
91 MADARA_GUARD_TYPE guard (
mutex_);
113 MADARA_GUARD_TYPE guard (
mutex_);
196 MADARA_GUARD_TYPE guard (
mutex_);
267 MADARA_GUARD_TYPE guard (
mutex_);
286 #endif // _MADARA_KNOWLEDGE_CONTAINERS_STRINGSTAGED_INL_ This class encapsulates an entry in a KnowledgeBase.
int set(const std::string &key, T &&value, const KnowledgeUpdateSettings &settings=KnowledgeUpdateSettings())
Atomically sets the value of a variable to the specific record.
void set_quality(uint32_t quality, const KnowledgeReferenceSettings &settings=KnowledgeReferenceSettings(false))
Sets the quality of writing to the variable.
type operator+=(const type &value)
Increments by a value.
bool is_false(void) const
Determines if the value is zero.
type operator*(void) const
Returns the value of the variable.
madara::knowledge::KnowledgeRecord get(const std::string &key, const KnowledgeReferenceSettings &settings=KnowledgeReferenceSettings()) const
Atomically returns the value of a variable.
type value_
The staged value.
madara::knowledge::KnowledgeRecord KnowledgeRecord
void modify(void)
Mark the value as modified.
double to_double(void) const
converts the value to a float/double
std::string name_
Prefix of variable.
void operator=(const StringStaged &rhs)
Assignment operator.
bool operator>(const type &value) const
Checks for greater than relationship.
This class stores variables and their values for use by any entity needing state information in a thr...
bool has_changed_
Tracks if value_ has changed since last read.
double to_double(void) const
Returns the value as a double.
MADARA_LOCK_TYPE mutex_
guard for access and changes
virtual BaseContainer * clone(void) const
Clones this container.
bool is_true(void) const
Determines if the value is true.
void write(void)
Writes the value to the knowledge base.
type operator-=(const type &value)
Decrements by a value.
bool exists(const std::string &key, const KnowledgeReferenceSettings &settings=KnowledgeReferenceSettings()) const
Atomically checks to see if a variable already exists.
bool operator<(const type &value) const
Checks for less than relationship.
bool operator<=(const type &value) const
Checks for less than or equal to relationship.
A thread-safe guard for a context or knowledge base.
This class provides a distributed knowledge base to users.
std::string get_debug_info(void)
Returns the type of the container along with name and any other useful information.
Integer to_integer(void) const
converts the value to an integer
std::string type
trait that describes the value type
ThreadSafeContext & get_context(void)
Returns the ThreadSafeContext associated with this Knowledge Base.
VariableReference variable_
Variable reference.
Provides functions and classes for the distributed knowledge base.
knowledge::KnowledgeRecord to_record(void) const
Returns the value as a knowledge::KnowledgeRecord.
KnowledgeUpdateSettings settings_
Settings for modifications.
void read(void)
Reads the value from the knowledge base.
bool operator>=(const type &value) const
Checks for greater than or equal to relationship.
VariableReference get_ref(const std::string &key, const KnowledgeReferenceSettings &settings=KnowledgeReferenceSettings())
Atomically returns a reference to the variable.
Settings for applying knowledge updates.
std::string to_string(void) const
Returns the value as a string.
void set_name(const std::string &var_name, KnowledgeBase &knowledge, bool sync=true)
Sets the variable name that this refers to.
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.
Settings for applying knowledge updates.
std::string to_string(const std::string &delimiter=", ") const
converts the value to a string.
Provides an interface for external functions into the MADARA KaRL variable settings.
This class is an abstract base class for all containers.
knowledge::KnowledgeRecord::Integer to_integer(void) const
Returns the value as an integer (same as *)
ThreadSafeContext * context_
Variable context that we are modifying.
StringStaged(const KnowledgeUpdateSettings &settings=KnowledgeUpdateSettings())
Default constructor.
bool exists(void) const
Checks to see if the variable has ever been assigned a value.
void mark_modified(const VariableReference &variable, const KnowledgeUpdateSettings &settings=KnowledgeUpdateSettings())
Marks the variable reference as updated for the purposes of sending or checkpointing knowledge (for g...
ThreadSafeContext * get_context(void)
Returns the ThreadSafeContext associated with this Variables facade.
bool operator==(const StringStaged &value) const
Checks for equality.
Stages a string value to and from the knowledge base.
bool operator!=(const StringStaged &value) const
Checks for inequality.