MADARA
3.2.3
|
Stages an integer value to and from the knowledge base. More...
#include <IntegerStaged.h>
Public Types | |
typedef knowledge::KnowledgeRecord::Integer | type |
trait that describes the value type More... | |
Public Member Functions | |
IntegerStaged (const KnowledgeUpdateSettings &settings=KnowledgeUpdateSettings()) | |
Default constructor. More... | |
IntegerStaged (const std::string &name, KnowledgeBase &knowledge, const KnowledgeUpdateSettings &settings=KnowledgeUpdateSettings()) | |
Constructor. More... | |
IntegerStaged (const std::string &name, Variables &knowledge, const KnowledgeUpdateSettings &settings=KnowledgeUpdateSettings()) | |
Constructor. More... | |
IntegerStaged (const std::string &name, KnowledgeBase &knowledge, type value, const KnowledgeUpdateSettings &settings=KnowledgeUpdateSettings()) | |
Default constructor. More... | |
IntegerStaged (const std::string &name, Variables &knowledge, type value, const KnowledgeUpdateSettings &settings=KnowledgeUpdateSettings()) | |
Default constructor. More... | |
IntegerStaged (const IntegerStaged &rhs) | |
Copy constructor. More... | |
virtual | ~IntegerStaged () |
Destructor. More... | |
virtual BaseContainer * | clone (void) const |
Clones this container. More... | |
void | exchange (IntegerStaged &other) |
Exchanges the integer at this location with the integer at another location. More... | |
bool | exists (void) const |
Checks to see if the variable has ever been assigned a value. More... | |
std::string | get_debug_info (void) |
Returns the type of the container along with name and any other useful information. More... | |
std::string | get_name (void) const |
Returns the name of the container. More... | |
KnowledgeUpdateSettings | get_settings (void) |
Gets the update settings for the container. More... | |
bool | is_false (void) const |
Determines if the value is zero. More... | |
bool | is_true (void) const |
Determines if the value is true. More... | |
void | modify (void) |
Mark the value as modified. More... | |
virtual bool | modify_if_false (BaseContainer &conditional) |
Modifies the container if the argument is false. More... | |
virtual bool | modify_if_true (BaseContainer &conditional) |
Modifies the container if the argument is true. More... | |
bool | operator!= (const IntegerStaged &value) const |
Checks for inequality. More... | |
bool | operator!= (type value) const |
Checks for inequality. More... | |
type | operator* (void) const |
Returns the value of the variable. More... | |
type | operator++ (void) |
Increments the value of the variable and returns the result. More... | |
type | operator+= (type value) |
Increments by a value. More... | |
type | operator-- (void) |
Decrements the value of the variable and returns the result. More... | |
type | operator-= (type value) |
Decrements by a value. More... | |
bool | operator< (type value) const |
Checks for less than relationship. More... | |
bool | operator<= (type value) const |
Checks for less than or equal to relationship. More... | |
void | operator= (const IntegerStaged &rhs) |
Assignment operator. More... | |
type | operator= (type value) |
Sets the value of the variable. More... | |
bool | operator== (const IntegerStaged &value) const |
Checks for equality. More... | |
bool | operator== (type value) const |
Checks for equality. More... | |
bool | operator> (type value) const |
Checks for greater than relationship. More... | |
bool | operator>= (type value) const |
Checks for greater than or equal to relationship. More... | |
void | read (void) |
Reads the value from the knowledge base. More... | |
void | set_name (const std::string &var_name, KnowledgeBase &knowledge, bool sync=true) |
Sets the variable name that this refers to. More... | |
void | set_name (const std::string &var_name, Variables &knowledge, bool sync=true) |
Sets the variable name that this refers to. More... | |
void | set_name (const std::string &var_name, ThreadSafeContext &knowledge, bool sync=true) |
Sets the variable name that this refers to. More... | |
void | set_quality (uint32_t quality, const KnowledgeReferenceSettings &settings=KnowledgeReferenceSettings(false)) |
Sets the quality of writing to the variable. More... | |
void | set_settings (const KnowledgeUpdateSettings &settings) |
Sets the update settings for the container. More... | |
double | to_double (void) const |
Returns the value as a double. More... | |
knowledge::KnowledgeRecord::Integer | to_integer (void) const |
Returns the value as an integer (same as *) More... | |
knowledge::KnowledgeRecord | to_record (void) const |
Returns the value as a knowledge::KnowledgeRecord. More... | |
std::string | to_string (void) const |
Returns the value as a string. More... | |
void | write (void) |
Writes the value to the knowledge base. More... | |
Protected Attributes | |
MADARA_LOCK_TYPE | mutex_ |
guard for access and changes More... | |
std::string | name_ |
Prefix of variable. More... | |
KnowledgeUpdateSettings | settings_ |
Settings for modifications. More... | |
Private Member Functions | |
virtual std::string | get_debug_info_ (void) |
Returns the type of the container along with name and any other useful information. More... | |
virtual bool | is_false_ (void) const |
Polymorphic is false method which can be used to determine if at least one value in the container is false. More... | |
virtual bool | is_true_ (void) const |
Polymorphic is true method which can be used to determine if all values in the container are true. More... | |
virtual void | modify_ (void) |
Polymorphic modify method used by collection containers. More... | |
Private Attributes | |
ThreadSafeContext * | context_ |
Variable context that we are modifying. More... | |
bool | has_changed_ |
Tracks if value_ has changed since last read. More... | |
type | value_ |
The staged value. More... | |
VariableReference | variable_ |
Variable reference. More... | |
Stages an integer value to and from the knowledge base.
This container is highly optimized for using a staged value (an intermediate value between the user application and the knowledge base) for common operations and then writing that staged value to the knowledge base after operations are complete with the write method. The value is only updated from the knowledge base on construction and when read is called.
Definition at line 38 of file IntegerStaged.h.
trait that describes the value type
Definition at line 42 of file IntegerStaged.h.
madara::knowledge::containers::IntegerStaged::IntegerStaged | ( | const KnowledgeUpdateSettings & | settings = KnowledgeUpdateSettings () | ) |
Default constructor.
settings | settings for updating knowledge |
Definition at line 4 of file IntegerStaged.cpp.
madara::knowledge::containers::IntegerStaged::IntegerStaged | ( | const std::string & | name, |
KnowledgeBase & | knowledge, | ||
const KnowledgeUpdateSettings & | settings = KnowledgeUpdateSettings () |
||
) |
Constructor.
name | name of the integer in the knowledge base |
knowledge | the knowledge base that will contain the vector |
settings | settings for updating knowledge |
Definition at line 10 of file IntegerStaged.cpp.
madara::knowledge::containers::IntegerStaged::IntegerStaged | ( | const std::string & | name, |
Variables & | knowledge, | ||
const KnowledgeUpdateSettings & | settings = KnowledgeUpdateSettings () |
||
) |
Constructor.
name | the name of the map within the variable context |
knowledge | the variable context |
settings | settings for updating knowledge |
Definition at line 21 of file IntegerStaged.cpp.
madara::knowledge::containers::IntegerStaged::IntegerStaged | ( | const std::string & | name, |
KnowledgeBase & | knowledge, | ||
type | value, | ||
const KnowledgeUpdateSettings & | settings = KnowledgeUpdateSettings () |
||
) |
Default constructor.
name | name of the integer in the knowledge base |
knowledge | the knowledge base that will contain the vector |
value | new value of the variable in the knowledge base |
settings | settings for updating knowledge |
Definition at line 32 of file IntegerStaged.cpp.
madara::knowledge::containers::IntegerStaged::IntegerStaged | ( | const std::string & | name, |
Variables & | knowledge, | ||
type | value, | ||
const KnowledgeUpdateSettings & | settings = KnowledgeUpdateSettings () |
||
) |
Default constructor.
name | name of the integer in the knowledge base |
knowledge | the knowledge base that will contain the vector |
value | new value of the variable in the knowledge base |
settings | settings for updating knowledge |
Definition at line 45 of file IntegerStaged.cpp.
madara::knowledge::containers::IntegerStaged::IntegerStaged | ( | const IntegerStaged & | rhs | ) |
Copy constructor.
Definition at line 59 of file IntegerStaged.cpp.
|
virtual |
Destructor.
Definition at line 67 of file IntegerStaged.cpp.
|
inlinevirtual |
Clones this container.
Implements madara::knowledge::containers::BaseContainer.
Definition at line 39 of file IntegerStaged.inl.
void madara::knowledge::containers::IntegerStaged::exchange | ( | containers::IntegerStaged & | other | ) |
Exchanges the integer at this location with the integer at another location.
other | the other integer to exchange with |
Definition at line 85 of file IntegerStaged.cpp.
|
inline |
Checks to see if the variable has ever been assigned a value.
Definition at line 190 of file IntegerStaged.inl.
|
inline |
Returns the type of the container along with name and any other useful information.
The provided information should be useful for developers wishing to debug container operations, especially as it pertains to pending network operations (i.e., when used in conjunction with modify)
Definition at line 19 of file IntegerStaged.inl.
|
privatevirtual |
Returns the type of the container along with name and any other useful information.
The provided information should be useful for developers wishing to debug container operations, especially as it pertains to pending network operations (i.e., when used in conjunction with modify)
Implements madara::knowledge::containers::BaseContainer.
Definition at line 79 of file IntegerStaged.cpp.
|
inlineinherited |
Returns the name of the container.
Definition at line 5 of file BaseContainer.inl.
|
inherited |
Gets the update settings for the container.
Definition at line 37 of file BaseContainer.cpp.
|
inline |
Determines if the value is zero.
Definition at line 211 of file IntegerStaged.inl.
|
privatevirtual |
Polymorphic is false method which can be used to determine if at least one value in the container is false.
Implements madara::knowledge::containers::BaseContainer.
Definition at line 112 of file IntegerStaged.cpp.
|
inline |
Determines if the value is true.
Definition at line 205 of file IntegerStaged.inl.
|
privatevirtual |
Polymorphic is true method which can be used to determine if all values in the container are true.
Implements madara::knowledge::containers::BaseContainer.
Definition at line 106 of file IntegerStaged.cpp.
|
inline |
Mark the value as modified.
The IntegerStaged retains the same value but will resend its value as if it had been modified.
Definition at line 9 of file IntegerStaged.inl.
|
privatevirtual |
Polymorphic modify method used by collection containers.
This method calls the modify method for this class. We separate the faster version (modify) from this version (modify_) to allow users the opportunity to have a fastery version that does not use polymorphic functions (generally virtual functions are half as efficient as normal function calls)
Implements madara::knowledge::containers::BaseContainer.
Definition at line 73 of file IntegerStaged.cpp.
|
virtualinherited |
Modifies the container if the argument is false.
conditional | the container that must be false to modify |
Definition at line 64 of file BaseContainer.cpp.
|
virtualinherited |
Modifies the container if the argument is true.
conditional | the container that must be true to modify |
Definition at line 44 of file BaseContainer.cpp.
|
inline |
Checks for inequality.
value | the value to compare to |
Definition at line 153 of file IntegerStaged.inl.
|
inline |
Checks for inequality.
value | the value to compare to |
Definition at line 140 of file IntegerStaged.inl.
|
inline |
Returns the value of the variable.
Definition at line 184 of file IntegerStaged.inl.
|
inline |
Increments the value of the variable and returns the result.
Definition at line 247 of file IntegerStaged.inl.
|
inline |
Increments by a value.
value | the value to add |
Definition at line 229 of file IntegerStaged.inl.
|
inline |
Decrements the value of the variable and returns the result.
Definition at line 256 of file IntegerStaged.inl.
|
inline |
Decrements by a value.
value | the value to remove |
Definition at line 238 of file IntegerStaged.inl.
|
inline |
Checks for less than relationship.
value | the value to compare to |
Definition at line 160 of file IntegerStaged.inl.
|
inline |
Checks for less than or equal to relationship.
value | the value to compare to |
Definition at line 166 of file IntegerStaged.inl.
|
inline |
|
inline |
Sets the value of the variable.
value | the new value of the variable |
Definition at line 127 of file IntegerStaged.inl.
|
inline |
Checks for equality.
value | the value to compare to |
Definition at line 146 of file IntegerStaged.inl.
|
inline |
Checks for equality.
value | the value to compare to |
Definition at line 134 of file IntegerStaged.inl.
|
inline |
Checks for greater than relationship.
value | the value to compare to |
Definition at line 172 of file IntegerStaged.inl.
|
inline |
Checks for greater than or equal to relationship.
value | the value to compare to |
Definition at line 178 of file IntegerStaged.inl.
|
inline |
Reads the value from the knowledge base.
Definition at line 291 of file IntegerStaged.inl.
|
inline |
Sets the variable name that this refers to.
var_name | the name of the variable in the knowledge base |
knowledge | the knowledge base the variable is housed in |
sync | synchronize the value from the underlying knowledge |
Definition at line 61 of file IntegerStaged.inl.
|
inline |
Sets the variable name that this refers to.
var_name | the name of the variable in the knowledge base |
knowledge | the knowledge base the variable is housed in |
sync | synchronize the value from the underlying knowledge |
Definition at line 105 of file IntegerStaged.inl.
|
inline |
Sets the variable name that this refers to.
var_name | the name of the variable in the knowledge base |
knowledge | the knowledge base the variable is housed in |
sync | synchronize the value from the underlying knowledge |
Definition at line 83 of file IntegerStaged.inl.
|
inline |
Sets the quality of writing to the variable.
quality | quality of writing to this location |
settings | settings for referring to knowledge variables |
Definition at line 278 of file IntegerStaged.inl.
|
inherited |
Sets the update settings for the container.
settings | the new settings to use |
Definition at line 28 of file BaseContainer.cpp.
|
inline |
Returns the value as a double.
Definition at line 265 of file IntegerStaged.inl.
|
inline |
Returns the value as an integer (same as *)
Definition at line 223 of file IntegerStaged.inl.
|
inline |
Returns the value as a knowledge::KnowledgeRecord.
This is useful for referencing clock and other record info.
Definition at line 217 of file IntegerStaged.inl.
|
inline |
Returns the value as a string.
Definition at line 271 of file IntegerStaged.inl.
|
inline |
Writes the value to the knowledge base.
Definition at line 298 of file IntegerStaged.inl.
|
private |
Variable context that we are modifying.
Definition at line 376 of file IntegerStaged.h.
|
private |
Tracks if value_ has changed since last read.
Definition at line 391 of file IntegerStaged.h.
|
mutableprotectedinherited |
guard for access and changes
Mutex for local changes
Definition at line 141 of file BaseContainer.h.
|
protectedinherited |
Prefix of variable.
Definition at line 151 of file BaseContainer.h.
|
protectedinherited |
Settings for modifications.
Definition at line 156 of file BaseContainer.h.
|
private |
The staged value.
Definition at line 386 of file IntegerStaged.h.
|
private |
Variable reference.
Definition at line 381 of file IntegerStaged.h.