1 #ifndef _MADARA_KNOWLEDGE_CONTAINERS_INTEGER_INL_ 2 #define _MADARA_KNOWLEDGE_CONTAINERS_INTEGER_INL_ 21 std::stringstream result;
23 result <<
"Integer: ";
28 MADARA_GUARD_TYPE guard (
mutex_);
30 result << this->
name_;
66 MADARA_GUARD_TYPE guard (
mutex_);
81 MADARA_GUARD_TYPE guard (
mutex_);
96 MADARA_GUARD_TYPE guard (
mutex_);
108 MADARA_GUARD_TYPE guard (
mutex_);
121 MADARA_GUARD_TYPE guard (
mutex_);
134 MADARA_GUARD_TYPE guard (
mutex_);
148 MADARA_GUARD_TYPE guard (
mutex_);
164 MADARA_GUARD_TYPE guard (
mutex_);
179 MADARA_GUARD_TYPE guard (
mutex_);
192 MADARA_GUARD_TYPE guard (
mutex_);
205 MADARA_GUARD_TYPE guard (
mutex_);
218 MADARA_GUARD_TYPE guard (
mutex_);
239 MADARA_GUARD_TYPE guard (
mutex_);
252 "Integer::is_true: checking for non-zero value\n");
257 MADARA_GUARD_TYPE guard (
mutex_);
262 "Integer::is_true: final result is %d\n", (int)result);
273 "Integer::is_false: checking for zero value\n");
278 MADARA_GUARD_TYPE guard (
mutex_);
283 "Integer::is_false: final result is %d\n", (int)result);
296 MADARA_GUARD_TYPE guard (
mutex_);
309 MADARA_GUARD_TYPE guard (
mutex_);
324 MADARA_GUARD_TYPE guard (
mutex_);
342 MADARA_GUARD_TYPE guard (
mutex_);
358 MADARA_GUARD_TYPE guard (
mutex_);
371 MADARA_GUARD_TYPE guard (
mutex_);
384 MADARA_GUARD_TYPE guard (
mutex_);
397 MADARA_GUARD_TYPE guard (
mutex_);
412 MADARA_GUARD_TYPE guard (
mutex_);
417 #endif // _MADARA_KNOWLEDGE_CONTAINERS_INTEGER_INL_ This class encapsulates an entry in a KnowledgeBase.
madara::knowledge::KnowledgeRecord dec(const std::string &key, const KnowledgeUpdateSettings &settings=KnowledgeUpdateSettings())
Atomically decrements the value of the variable.
int set(const std::string &key, T &&value, const KnowledgeUpdateSettings &settings=KnowledgeUpdateSettings())
Atomically sets the value of a variable to the specific record.
bool is_true(void) const
Checks to see if the record is true.
double to_double(void) const
Returns the value as a double.
madara::knowledge::KnowledgeRecord get(const std::string &key, const KnowledgeReferenceSettings &settings=KnowledgeReferenceSettings()) const
Atomically returns the value of a variable.
void set_name(const std::string &var_name, KnowledgeBase &knowledge)
Sets the variable name that this refers to.
Integer(const KnowledgeUpdateSettings &settings=KnowledgeUpdateSettings())
Default constructor.
bool operator>=(type value) const
Checks for greater than or equal to relationship.
std::string to_string(void) const
Returns the value as a string.
std::string get_debug_info(void)
Returns the type of the container along with name and any other useful information.
double to_double(void) const
converts the value to a float/double
std::string name_
Prefix of variable.
void modify(void)
Mark the value as modified.
knowledge::KnowledgeRecord to_record(void) const
Returns the value as a knowledge::KnowledgeRecord.
type operator--(void)
Decrements the value of the variable and returns the result.
VariableReference variable_
Variable reference.
This class stores variables and their values for use by any entity needing state information in a thr...
bool operator<(type value) const
Checks for less than relationship.
virtual BaseContainer * clone(void) const
Clones this container.
MADARA_LOCK_TYPE mutex_
guard for access and changes
#define madara_logger_log(logger, level,...)
Fast version of the madara::logger::log method.
bool exists(const std::string &key, const KnowledgeReferenceSettings &settings=KnowledgeReferenceSettings()) const
Atomically checks to see if a variable already exists.
type operator*(void) const
Returns the value of the variable.
bool operator!=(const Integer &value) const
Checks for inequality.
type operator++(void)
Increments the value of the variable and returns the result.
bool is_true(void) const
Determines if the value is true.
A thread-safe guard for a context or knowledge base.
void operator=(const Integer &rhs)
Assignment operator.
bool is_false(void) const
Determines if the value is zero.
void set_quality(uint32_t quality, const KnowledgeReferenceSettings &settings=KnowledgeReferenceSettings(false))
Sets the quality of writing to the variable.
This class provides a distributed knowledge base to users.
This class stores an integer within a variable context.
madara::knowledge::KnowledgeRecord inc(const std::string &key, const KnowledgeUpdateSettings &settings=KnowledgeUpdateSettings())
Atomically increments the value of the variable.
type operator-=(type value)
Decrements by a value.
Integer to_integer(void) const
converts the value to an integer
ThreadSafeContext & get_context(void)
Returns the ThreadSafeContext associated with this Knowledge Base.
Provides functions and classes for the distributed knowledge base.
KnowledgeUpdateSettings settings_
Settings for modifications.
knowledge::KnowledgeRecord::Integer type
trait that describes the value type
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.
ThreadSafeContext * context_
Variable context that we are modifying.
logger::Logger & get_logger(void) const
Gets the logger used for information printing.
bool is_false(void) const
Checks to see if the record is false.
Settings for applying knowledge updates.
std::string to_string(const std::string &delimiter=", ") const
converts the value to a string.
bool operator<=(type value) const
Checks for less than or equal to relationship.
Provides an interface for external functions into the MADARA KaRL variable settings.
This class is an abstract base class for all containers.
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...
bool operator==(const Integer &value) const
Checks for equality.
ThreadSafeContext * get_context(void)
Returns the ThreadSafeContext associated with this Variables facade.
bool operator>(type value) const
Checks for greater than relationship.
type operator+=(type value)
Increments by a value.
knowledge::KnowledgeRecord::Integer to_integer(void) const
Returns the value as an integer (same as *)