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