MADARA
3.1.8
|
This class stores a string within a variable context. More...
#include <String.h>
Public Types | |
typedef std::string | type |
trait that describes the value type More... | |
Public Member Functions | |
String (const KnowledgeUpdateSettings &settings=KnowledgeUpdateSettings()) | |
Default constructor. More... | |
String (const std::string &name, KnowledgeBase &knowledge, const KnowledgeUpdateSettings &settings=KnowledgeUpdateSettings()) | |
Default constructor. More... | |
String (const std::string &name, KnowledgeBase &knowledge, const std::string &value, const KnowledgeUpdateSettings &settings=KnowledgeUpdateSettings()) | |
Default constructor. More... | |
String (const std::string &name, Variables &knowledge, const KnowledgeUpdateSettings &settings=KnowledgeUpdateSettings()) | |
Default constructor. More... | |
String (const std::string &name, Variables &knowledge, const std::string &value, const KnowledgeUpdateSettings &settings=KnowledgeUpdateSettings()) | |
Default constructor. More... | |
String (const String &rhs) | |
Copy constructor. More... | |
virtual | ~String () |
Destructor. More... | |
virtual BaseContainer * | clone (void) const |
Clones this container. More... | |
void | exchange (String &other) |
Exchanges the string at this location with the string 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!= (type value) const |
Checks for inequality. More... | |
bool | operator!= (const String &value) const |
Checks for inequality. More... | |
type | operator* (void) const |
Returns the value of the variable. More... | |
type | operator+= (type value) |
Increments 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 String &rhs) |
Assignment operator. More... | |
type | operator= (const type &value) |
Sets the value of the variable. More... | |
bool | operator== (type value) const |
Checks for equality. More... | |
bool | operator== (const String &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 | set_name (const std::string &var_name, KnowledgeBase &knowledge) |
Sets the variable name that this refers to. More... | |
void | set_name (const std::string &var_name, Variables &knowledge) |
Sets the variable name that this refers to. More... | |
void | set_name (const std::string &var_name, ThreadSafeContext &knowledge) |
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... | |
madara::knowledge::KnowledgeRecord::Integer | to_integer (void) const |
Returns the value as an integer. 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 (alias of *) 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... | |
VariableReference | variable_ |
Variable reference. More... | |
typedef std::string madara::knowledge::containers::String::type |
madara::knowledge::containers::String::String | ( | const KnowledgeUpdateSettings & | settings = KnowledgeUpdateSettings () | ) |
Default constructor.
Definition at line 4 of file String.cpp.
madara::knowledge::containers::String::String | ( | const std::string & | name, |
KnowledgeBase & | knowledge, | ||
const KnowledgeUpdateSettings & | settings = KnowledgeUpdateSettings () |
||
) |
Default constructor.
name | name of the variable in the knowledge base |
knowledge | the knowledge base that will contain the vector |
settings | settings for updating knowledge |
Definition at line 11 of file String.cpp.
madara::knowledge::containers::String::String | ( | const std::string & | name, |
KnowledgeBase & | knowledge, | ||
const std::string & | value, | ||
const KnowledgeUpdateSettings & | settings = KnowledgeUpdateSettings () |
||
) |
Default constructor.
name | name of the variable in the knowledge base |
knowledge | the knowledge base that will contain the vector |
value | new value of the variable |
settings | settings for updating knowledge |
Definition at line 31 of file String.cpp.
madara::knowledge::containers::String::String | ( | const std::string & | name, |
Variables & | knowledge, | ||
const KnowledgeUpdateSettings & | settings = KnowledgeUpdateSettings () |
||
) |
Default constructor.
name | name of the variable in the knowledge base |
knowledge | the knowledge base that will contain the vector |
settings | settings for updating knowledge |
Definition at line 21 of file String.cpp.
madara::knowledge::containers::String::String | ( | const std::string & | name, |
Variables & | knowledge, | ||
const std::string & | value, | ||
const KnowledgeUpdateSettings & | settings = KnowledgeUpdateSettings () |
||
) |
Default constructor.
name | name of the variable in the knowledge base |
knowledge | the knowledge base that will contain the vector |
value | new value of the variable |
settings | settings for updating knowledge |
Definition at line 42 of file String.cpp.
madara::knowledge::containers::String::String | ( | const String & | rhs | ) |
Copy constructor.
Definition at line 54 of file String.cpp.
|
virtual |
Destructor.
Definition at line 61 of file String.cpp.
|
virtual |
Clones this container.
Implements madara::knowledge::containers::BaseContainer.
Definition at line 108 of file String.cpp.
void madara::knowledge::containers::String::exchange | ( | String & | other | ) |
Exchanges the string at this location with the string at another location.
other | the other string to exchange with |
Definition at line 128 of file String.cpp.
bool madara::knowledge::containers::String::exists | ( | void | ) | const |
Checks to see if the variable has ever been assigned a value.
Definition at line 335 of file String.cpp.
std::string madara::knowledge::containers::String::get_debug_info | ( | void | ) |
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 77 of file String.cpp.
|
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 102 of file String.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.
bool madara::knowledge::containers::String::is_false | ( | void | ) | const |
Determines if the value is zero.
Definition at line 438 of file String.cpp.
|
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 451 of file String.cpp.
bool madara::knowledge::containers::String::is_true | ( | void | ) | const |
Determines if the value is true.
Definition at line 417 of file String.cpp.
|
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 445 of file String.cpp.
void madara::knowledge::containers::String::modify | ( | void | ) |
Mark the value as modified.
The String retains the same value but will resend its value as if it had been modified.
Definition at line 67 of file String.cpp.
|
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 96 of file String.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.
bool madara::knowledge::containers::String::operator!= | ( | type | value | ) | const |
Checks for inequality.
value | the value to compare to |
Definition at line 232 of file String.cpp.
bool madara::knowledge::containers::String::operator!= | ( | const String & | value | ) | const |
Checks for inequality.
value | the value to compare to |
Definition at line 261 of file String.cpp.
madara::knowledge::containers::String::type madara::knowledge::containers::String::operator* | ( | void | ) | const |
Returns the value of the variable.
Definition at line 329 of file String.cpp.
madara::knowledge::containers::String::type madara::knowledge::containers::String::operator+= | ( | type | value | ) |
Increments by a value.
value | the value to add |
Definition at line 201 of file String.cpp.
bool madara::knowledge::containers::String::operator< | ( | type | value | ) | const |
Checks for less than relationship.
value | the value to compare to |
Definition at line 277 of file String.cpp.
bool madara::knowledge::containers::String::operator<= | ( | type | value | ) | const |
Checks for less than or equal to relationship.
value | the value to compare to |
Definition at line 290 of file String.cpp.
void madara::knowledge::containers::String::operator= | ( | const String & | rhs | ) |
madara::knowledge::containers::String::type madara::knowledge::containers::String::operator= | ( | const type & | value | ) |
Sets the value of the variable.
value | the new value of the variable |
Definition at line 188 of file String.cpp.
bool madara::knowledge::containers::String::operator== | ( | type | value | ) | const |
Checks for equality.
value | the value to compare to |
Definition at line 219 of file String.cpp.
bool madara::knowledge::containers::String::operator== | ( | const String & | value | ) | const |
Checks for equality.
value | the value to compare to |
Definition at line 245 of file String.cpp.
bool madara::knowledge::containers::String::operator> | ( | type | value | ) | const |
Checks for greater than relationship.
value | the value to compare to |
Definition at line 303 of file String.cpp.
bool madara::knowledge::containers::String::operator>= | ( | type | value | ) | const |
Checks for greater than or equal to relationship.
value | the value to compare to |
Definition at line 316 of file String.cpp.
void madara::knowledge::containers::String::set_name | ( | const std::string & | var_name, |
KnowledgeBase & | knowledge | ||
) |
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 |
Definition at line 143 of file String.cpp.
void madara::knowledge::containers::String::set_name | ( | const std::string & | var_name, |
Variables & | knowledge | ||
) |
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 |
Definition at line 158 of file String.cpp.
void madara::knowledge::containers::String::set_name | ( | const std::string & | var_name, |
ThreadSafeContext & | knowledge | ||
) |
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 |
Definition at line 173 of file String.cpp.
void madara::knowledge::containers::String::set_quality | ( | uint32_t | quality, |
const KnowledgeReferenceSettings & | settings = KnowledgeReferenceSettings (false) |
||
) |
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 404 of file String.cpp.
|
inherited |
Sets the update settings for the container.
settings | the new settings to use |
Definition at line 28 of file BaseContainer.cpp.
double madara::knowledge::containers::String::to_double | ( | void | ) | const |
Returns the value as a double.
Definition at line 378 of file String.cpp.
madara::knowledge::KnowledgeRecord::Integer madara::knowledge::containers::String::to_integer | ( | void | ) | const |
Returns the value as an integer.
Definition at line 391 of file String.cpp.
madara::knowledge::KnowledgeRecord madara::knowledge::containers::String::to_record | ( | void | ) | const |
Returns the value as a knowledge::KnowledgeRecord.
This is useful for referencing clock and other record info.
Definition at line 350 of file String.cpp.
std::string madara::knowledge::containers::String::to_string | ( | void | ) | const |
Returns the value as a string (alias of *)
Definition at line 365 of file String.cpp.
|
private |
|
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 |