MADARA
3.4.1
|
This class stores a flexible map of strings and ints to KaRL variables FlexMap differs from Map in three distinct ways. More...
#include <FlexMap.h>
Public Member Functions | |
FlexMap (const FlexMap &rhs) | |
Copy constructor. More... | |
FlexMap (const KnowledgeUpdateSettings &settings=KnowledgeUpdateSettings(), const std::string &delimiter=".") | |
Default constructor. More... | |
FlexMap (const std::string &name, KnowledgeBase &knowledge, const KnowledgeUpdateSettings &settings=KnowledgeUpdateSettings(), const std::string &delimiter=".") | |
Constructor. More... | |
FlexMap (const std::string &name, Variables &knowledge, const KnowledgeUpdateSettings &settings=KnowledgeUpdateSettings(), const std::string &delimiter=".") | |
Constructor. More... | |
virtual | ~FlexMap () |
Destructor. More... | |
void | clear (void) |
Clears the map. More... | |
virtual BaseContainer * | clone (void) const |
Clones this container. More... | |
void | erase (const std::string &key, bool delete_subkeys=true) |
Erases a variable from the map. More... | |
void | exchange (FlexMap &other, bool refresh_keys=true, bool delete_keys=true) |
Exchanges the map at this location with the map at another location. More... | |
bool | exists (const std::string &key, bool first_level_key=false) const |
Checks if a key is in the map. More... | |
bool | exists (void) const |
Checks for the existence of the current location in the context. 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_delimiter (void) |
Gets the delimiter for adding and detecting subvariables. 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 |
Checks if the value in the record is false (0) More... | |
bool | is_true (void) const |
Checks if the value in the record is not false (0) More... | |
void | keys (std::vector< std::string > &curkeys, bool first_level_keys_only=true) const |
Returns the keys within the map. More... | |
void | modify (void) |
Mark the flex map 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... | |
void | operator= (const FlexMap &rhs) |
Assignment operator. More... | |
void | operator= (const std::string value) |
Sets the location to the specified STL string. More... | |
void | operator= (const std::vector< double > &value) |
Sets the location to native double vector of the provided values. More... | |
void | operator= (const std::vector< KnowledgeRecord::Integer > &value) |
Sets the location to native integer vector of the provided values. More... | |
void | operator= (double value) |
Sets the location to the specified double. More... | |
void | operator= (int value) |
Sets the location to the specified int. More... | |
void | operator= (knowledge::KnowledgeRecord::Integer value) |
Sets the location to the specified Integer. More... | |
FlexMap | operator[] (const std::string &key) |
Retrieves a flex map at the keyed location. More... | |
FlexMap | operator[] (size_t index) |
Retrieves a flex map at the indexed location. More... | |
int | read_file (const std::string &filename) |
Read a file into a location in the map. More... | |
int | read_file (const std::string &filename, const KnowledgeUpdateSettings &settings) |
Read a file into a location in the map. More... | |
int | set (const double *value, uint32_t size) |
Sets the location within the map to the specified value. More... | |
int | set (const double *value, uint32_t size, const KnowledgeUpdateSettings &settings) |
Sets the location within the map to the specified value. More... | |
int | set (const knowledge::KnowledgeRecord::Integer *value, uint32_t size) |
Sets the location within the map to the specified value. More... | |
int | set (const knowledge::KnowledgeRecord::Integer *value, uint32_t size, const KnowledgeUpdateSettings &settings) |
Sets the location within the map to the specified value. More... | |
int | set (const std::string &value) |
Sets the location within the map to the specified value. More... | |
int | set (const std::string &value, const KnowledgeUpdateSettings &settings) |
Sets the location within the map to the specified value. More... | |
int | set (const std::vector< double > &value) |
Sets the location within the map to the specified value. More... | |
int | set (const std::vector< double > &value, const KnowledgeUpdateSettings &settings) |
Sets the location within the map to the specified value. More... | |
int | set (const std::vector< KnowledgeRecord::Integer > &value) |
Sets the location within the map to the specified value. More... | |
int | set (const std::vector< KnowledgeRecord::Integer > &value, const KnowledgeUpdateSettings &settings) |
Sets the location within the map to the specified value. More... | |
int | set (double value) |
Sets the location within the map to the specified value. More... | |
int | set (double value, const KnowledgeUpdateSettings &settings) |
Sets the location within the map to the specified value. More... | |
int | set (knowledge::KnowledgeRecord::Integer value=knowledge::KnowledgeRecord::MODIFIED) |
Sets the location within the map to the specified value. More... | |
int | set (KnowledgeRecord::Integer value, const KnowledgeUpdateSettings &settings) |
Sets the location within the map to the specified value. More... | |
void | set_delimiter (const std::string &delimiter) |
Sets the delimiter for adding and detecting subvariables. More... | |
int | set_file (const unsigned char *value, size_t size) |
Atomically sets the value of an index to an arbitrary string. More... | |
int | set_file (const unsigned char *value, size_t size, const KnowledgeUpdateSettings &settings) |
Atomically sets the value of an index to an arbitrary string. More... | |
int | set_index (size_t index, double value) |
Sets an index within a map to a specified value. More... | |
int | set_index (size_t index, double value, const KnowledgeUpdateSettings &settings) |
Sets an index within a map to a specified value. More... | |
int | set_index (size_t index, knowledge::KnowledgeRecord::Integer value) |
Sets an index within an array to a specified value. More... | |
int | set_index (size_t index, knowledge::KnowledgeRecord::Integer value, const KnowledgeUpdateSettings &settings) |
Sets an index within an array to a specified value. More... | |
int | set_jpeg (const unsigned char *value, size_t size) |
Atomically sets the value of an index to a JPEG image. More... | |
int | set_jpeg (const unsigned char *value, size_t size, const KnowledgeUpdateSettings &settings) |
Atomically sets the value of an index to a JPEG image. 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_quality (uint32_t quality, const KnowledgeReferenceSettings &settings=KnowledgeReferenceSettings(false)) |
Sets the quality of writing to a certain variable from this entity. More... | |
void | set_settings (const KnowledgeUpdateSettings &settings) |
Sets the update settings for the container. More... | |
size_t | size (bool first_level_keys_only=true) const |
Returns the size of the map. More... | |
void | to_container (BufferVector &target) const |
Fills a BufferVector container with all subkeys. More... | |
void | to_container (Double &target) const |
Fills a Double container with the current location. More... | |
void | to_container (DoubleVector &target) const |
Fills a DoubleVector container with all subkeys. More... | |
void | to_container (Integer &target) const |
Fills an Integer container with the current location. More... | |
void | to_container (IntegerVector &target) const |
Fills a IntegerVector container with all subkeys. More... | |
void | to_container (Map &target) const |
Fills a Map container with all subkeys. More... | |
void | to_container (NativeDoubleVector &target) const |
Fills a NativeDoubleVector container with all subkeys. More... | |
void | to_container (NativeIntegerVector &target) const |
Fills a NativeIntegerVector container with all subkeys. More... | |
void | to_container (String &target) const |
Fills a String container with the current location. More... | |
void | to_container (StringVector &target) const |
Fills a StringVector container with all subkeys. More... | |
double | to_double (double default_value=0.0) const |
Returns the value at the location as a double. More... | |
knowledge::KnowledgeRecord::Integer | to_integer (KnowledgeRecord::Integer default_value=0) const |
Returns the value at the location as an integer. More... | |
knowledge::KnowledgeRecord | to_record (const KnowledgeRecord &default_value=KnowledgeRecord(0)) const |
Retrieves a copy of the record from the current location. More... | |
std::string | to_string (const std::string &default_value="") const |
Returns the value at the location as a string. 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 Types | |
typedef std::map< std::string, VariableReference > | InternalFlexMap |
internal map of variable references 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... | |
void | update_variable (void) const |
Updates the variable reference if necessary. More... | |
Private Attributes | |
ThreadSafeContext * | context_ |
Variable context that we are modifying. More... | |
std::string | delimiter_ |
Delimiter for the prefix to subvars. More... | |
VariableReference | variable_ |
The current location variable. More... | |
This class stores a flexible map of strings and ints to KaRL variables FlexMap differs from Map in three distinct ways.
First, it can use either integers (for easy multi-dimensional arrays) or strings like Map. Second, it allows for the usage of the [] operator to modify values. This can causes a small performance penalty due to the creation of FlexMaps with each [] operator, but is much more intuitive and an increase in quality-of-life. Third, because of its micromanagement of the variable names, it is slower than Map in almost all operations on variables within the map.
|
private |
madara::knowledge::containers::FlexMap::FlexMap | ( | const KnowledgeUpdateSettings & | settings = KnowledgeUpdateSettings() , |
const std::string & | delimiter = "." |
||
) |
Default constructor.
settings | settings to apply by default |
delimiter | the delimiter for variables in the map |
Definition at line 6 of file FlexMap.cpp.
madara::knowledge::containers::FlexMap::FlexMap | ( | const std::string & | name, |
KnowledgeBase & | knowledge, | ||
const KnowledgeUpdateSettings & | settings = KnowledgeUpdateSettings() , |
||
const std::string & | delimiter = "." |
||
) |
Constructor.
name | the name of the map within the variable context |
knowledge | the variable context |
settings | settings to apply by default |
delimiter | the delimiter for variables in the map |
Definition at line 12 of file FlexMap.cpp.
madara::knowledge::containers::FlexMap::FlexMap | ( | const std::string & | name, |
Variables & | knowledge, | ||
const KnowledgeUpdateSettings & | settings = KnowledgeUpdateSettings() , |
||
const std::string & | delimiter = "." |
||
) |
Constructor.
name | the name of the map within the variable context |
knowledge | the variable context |
settings | settings to apply by default |
delimiter | the delimiter for variables in the map |
Definition at line 21 of file FlexMap.cpp.
madara::knowledge::containers::FlexMap::FlexMap | ( | const FlexMap & | rhs | ) |
Copy constructor.
Definition at line 30 of file FlexMap.cpp.
|
virtual |
Destructor.
Definition at line 38 of file FlexMap.cpp.
void madara::knowledge::containers::FlexMap::clear | ( | void | ) |
Clears the map.
This deletes all keys in the Flex Map from the context.
Definition at line 533 of file FlexMap.cpp.
|
virtual |
Clones this container.
Implements madara::knowledge::containers::BaseContainer.
Definition at line 139 of file FlexMap.cpp.
void madara::knowledge::containers::FlexMap::erase | ( | const std::string & | key, |
bool | delete_subkeys = true |
||
) |
Erases a variable from the map.
key | the variable to delete from the map |
delete_subkeys | if true, delete all keys with the key prefix |
Definition at line 551 of file FlexMap.cpp.
void madara::knowledge::containers::FlexMap::exchange | ( | FlexMap & | other, |
bool | refresh_keys = true , |
||
bool | delete_keys = true |
||
) |
Exchanges the map at this location with the map at another location.
other | the other integer to exchange with |
refresh_keys | force a refresh of the keys in both maps to ensure all keys are swapped |
delete_keys | delete any unused keys |
Definition at line 511 of file FlexMap.cpp.
bool madara::knowledge::containers::FlexMap::exists | ( | const std::string & | key, |
bool | first_level_key = false |
||
) | const |
Checks if a key is in the map.
By default, this will check for an exact match (i.e., the exact string matches to an existing record). If you want to just check if the key exists in the next level, set first_level_key to true.
key | the map key to check for |
first_level_key | if true, checks for existence of key in the next level of map hierarchy. This is a more expensive version of exists. O (log N) vs. O (N) |
Definition at line 666 of file FlexMap.cpp.
bool madara::knowledge::containers::FlexMap::exists | ( | void | ) | const |
Checks for the existence of the current location in the context.
Checks if the value in the record is false (0)
Definition at line 651 of file FlexMap.cpp.
std::string madara::knowledge::containers::FlexMap::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 106 of file FlexMap.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 133 of file FlexMap.cpp.
std::string madara::knowledge::containers::FlexMap::get_delimiter | ( | void | ) |
Gets the delimiter for adding and detecting subvariables.
By default, MADARA uses a '.' delimiter for names like "ai.madara.Var1". Other conventions can include '/' for ROS-like topic directory structures, e.g., ai/madara/Var1.
Definition at line 642 of file FlexMap.cpp.
|
inlineinherited |
Returns the name of the container.
Definition at line 4 of file BaseContainer.inl.
|
inherited |
Gets the update settings for the container.
Definition at line 29 of file BaseContainer.cpp.
bool madara::knowledge::containers::FlexMap::is_false | ( | void | ) | const |
Checks if the value in the record is false (0)
Definition at line 69 of file FlexMap.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 1250 of file FlexMap.cpp.
bool madara::knowledge::containers::FlexMap::is_true | ( | void | ) | const |
Checks if the value in the record is not false (0)
Definition at line 44 of file FlexMap.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 1245 of file FlexMap.cpp.
void madara::knowledge::containers::FlexMap::keys | ( | std::vector< std::string > & | curkeys, |
bool | first_level_keys_only = true |
||
) | const |
Returns the keys within the map.
This can be an O(n) operation that checks for any key that has name{delimiter}key.
curkeys | the results of the operation |
first_level_keys_only | if true, only generate first level keys |
Definition at line 697 of file FlexMap.cpp.
void madara::knowledge::containers::FlexMap::modify | ( | void | ) |
Mark the flex map as modified.
The map retains the same values but will resend values as if they had been modified.
Definition at line 84 of file FlexMap.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 128 of file FlexMap.cpp.
|
virtualinherited |
Modifies the container if the argument is false.
conditional | the container that must be false to modify |
Definition at line 56 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 36 of file BaseContainer.cpp.
void madara::knowledge::containers::FlexMap::operator= | ( | const FlexMap & | rhs | ) |
void madara::knowledge::containers::FlexMap::operator= | ( | const std::string | value | ) |
Sets the location to the specified STL string.
value | value to set at location |
Definition at line 173 of file FlexMap.cpp.
void madara::knowledge::containers::FlexMap::operator= | ( | const std::vector< double > & | value | ) |
Sets the location to native double vector of the provided values.
value | array of doubles to set at the location |
Definition at line 184 of file FlexMap.cpp.
void madara::knowledge::containers::FlexMap::operator= | ( | const std::vector< KnowledgeRecord::Integer > & | value | ) |
Sets the location to native integer vector of the provided values.
value | array of integers to set at the location |
Definition at line 178 of file FlexMap.cpp.
void madara::knowledge::containers::FlexMap::operator= | ( | double | value | ) |
Sets the location to the specified double.
value | value to set at location |
Definition at line 168 of file FlexMap.cpp.
void madara::knowledge::containers::FlexMap::operator= | ( | int | value | ) |
Sets the location to the specified int.
value | value to set at location |
Definition at line 163 of file FlexMap.cpp.
void madara::knowledge::containers::FlexMap::operator= | ( | knowledge::KnowledgeRecord::Integer | value | ) |
Sets the location to the specified Integer.
value | value to set at location |
Definition at line 157 of file FlexMap.cpp.
madara::knowledge::containers::FlexMap madara::knowledge::containers::FlexMap::operator[] | ( | const std::string & | key | ) |
Retrieves a flex map at the keyed location.
key | the name of the variable entry |
Definition at line 441 of file FlexMap.cpp.
madara::knowledge::containers::FlexMap madara::knowledge::containers::FlexMap::operator[] | ( | size_t | index | ) |
Retrieves a flex map at the indexed location.
index | the index of the variable entry |
Definition at line 459 of file FlexMap.cpp.
int madara::knowledge::containers::FlexMap::read_file | ( | const std::string & | filename | ) |
Read a file into a location in the map.
filename | file to read |
Definition at line 721 of file FlexMap.cpp.
int madara::knowledge::containers::FlexMap::read_file | ( | const std::string & | filename, |
const KnowledgeUpdateSettings & | settings | ||
) |
Read a file into a location in the map.
filename | file to read |
settings | settings to use when evaluating/updating |
Definition at line 741 of file FlexMap.cpp.
int madara::knowledge::containers::FlexMap::set | ( | const double * | value, |
uint32_t | size | ||
) |
Sets the location within the map to the specified value.
value | array of doubles to set at the location |
size | number of elements in the array |
Definition at line 1019 of file FlexMap.cpp.
int madara::knowledge::containers::FlexMap::set | ( | const double * | value, |
uint32_t | size, | ||
const KnowledgeUpdateSettings & | settings | ||
) |
Sets the location within the map to the specified value.
value | array of doubles to set at the location |
size | number of elements in the array |
settings | settings for applying the update |
Definition at line 1040 of file FlexMap.cpp.
int madara::knowledge::containers::FlexMap::set | ( | const knowledge::KnowledgeRecord::Integer * | value, |
uint32_t | size | ||
) |
Sets the location within the map to the specified value.
value | array of integers to set at the location |
size | number of elements in the array |
Definition at line 850 of file FlexMap.cpp.
int madara::knowledge::containers::FlexMap::set | ( | const knowledge::KnowledgeRecord::Integer * | value, |
uint32_t | size, | ||
const KnowledgeUpdateSettings & | settings | ||
) |
Sets the location within the map to the specified value.
value | array of integers to set at the location |
size | number of elements in the array |
settings | settings for applying the update |
Definition at line 871 of file FlexMap.cpp.
int madara::knowledge::containers::FlexMap::set | ( | const std::string & | value | ) |
Sets the location within the map to the specified value.
value | value to set at location |
Definition at line 1103 of file FlexMap.cpp.
int madara::knowledge::containers::FlexMap::set | ( | const std::string & | value, |
const KnowledgeUpdateSettings & | settings | ||
) |
Sets the location within the map to the specified value.
value | value to set at location |
settings | settings for applying the update |
Definition at line 1123 of file FlexMap.cpp.
int madara::knowledge::containers::FlexMap::set | ( | const std::vector< double > & | value | ) |
Sets the location within the map to the specified value.
value | array of doubles to set at the location |
Definition at line 1061 of file FlexMap.cpp.
int madara::knowledge::containers::FlexMap::set | ( | const std::vector< double > & | value, |
const KnowledgeUpdateSettings & | settings | ||
) |
Sets the location within the map to the specified value.
value | array of doubles to set at the location |
settings | settings for applying the update |
Definition at line 1082 of file FlexMap.cpp.
int madara::knowledge::containers::FlexMap::set | ( | const std::vector< KnowledgeRecord::Integer > & | value | ) |
Sets the location within the map to the specified value.
value | array of integers to set at the location |
Definition at line 893 of file FlexMap.cpp.
int madara::knowledge::containers::FlexMap::set | ( | const std::vector< KnowledgeRecord::Integer > & | value, |
const KnowledgeUpdateSettings & | settings | ||
) |
Sets the location within the map to the specified value.
value | array of integers to set at the location |
settings | settings for applying the update |
Definition at line 914 of file FlexMap.cpp.
int madara::knowledge::containers::FlexMap::set | ( | double | value | ) |
Sets the location within the map to the specified value.
value | value to set at location |
Definition at line 936 of file FlexMap.cpp.
int madara::knowledge::containers::FlexMap::set | ( | double | value, |
const KnowledgeUpdateSettings & | settings | ||
) |
Sets the location within the map to the specified value.
value | value to set at location |
settings | settings for applying the update |
Definition at line 956 of file FlexMap.cpp.
int madara::knowledge::containers::FlexMap::set | ( | knowledge::KnowledgeRecord::Integer | value = knowledge::KnowledgeRecord::MODIFIED | ) |
Sets the location within the map to the specified value.
value | value to set at location |
Definition at line 762 of file FlexMap.cpp.
int madara::knowledge::containers::FlexMap::set | ( | KnowledgeRecord::Integer | value, |
const KnowledgeUpdateSettings & | settings | ||
) |
Sets the location within the map to the specified value.
value | value to set at location |
settings | settings for applying the update |
Definition at line 783 of file FlexMap.cpp.
void madara::knowledge::containers::FlexMap::set_delimiter | ( | const std::string & | delimiter | ) |
Sets the delimiter for adding and detecting subvariables.
By default, MADARA uses a '.' delimiter for names like "ai.madara.Var1". Other conventions can include '/' for ROS-like topic directory structures, e.g., ai/madara/Var1.
delimiter | the delimiter to use for variable demarcation |
Definition at line 636 of file FlexMap.cpp.
int madara::knowledge::containers::FlexMap::set_file | ( | const unsigned char * | value, |
size_t | size | ||
) |
Atomically sets the value of an index to an arbitrary string.
value | new value of the variable |
size | indicates the size of the value buffer |
Definition at line 1144 of file FlexMap.cpp.
int madara::knowledge::containers::FlexMap::set_file | ( | const unsigned char * | value, |
size_t | size, | ||
const KnowledgeUpdateSettings & | settings | ||
) |
Atomically sets the value of an index to an arbitrary string.
value | new value of the variable |
size | indicates the size of the value buffer |
settings | settings for applying the update |
Definition at line 1165 of file FlexMap.cpp.
int madara::knowledge::containers::FlexMap::set_index | ( | size_t | index, |
double | value | ||
) |
Sets an index within a map to a specified value.
index | index of the location in the array |
value | value to set at location |
Definition at line 977 of file FlexMap.cpp.
int madara::knowledge::containers::FlexMap::set_index | ( | size_t | index, |
double | value, | ||
const KnowledgeUpdateSettings & | settings | ||
) |
Sets an index within a map to a specified value.
index | index of the location in the array |
value | value to set at location |
settings | settings for applying the update |
Definition at line 998 of file FlexMap.cpp.
int madara::knowledge::containers::FlexMap::set_index | ( | size_t | index, |
knowledge::KnowledgeRecord::Integer | value | ||
) |
Sets an index within an array to a specified value.
index | index of the location in the array |
value | value to set at location |
Definition at line 805 of file FlexMap.cpp.
int madara::knowledge::containers::FlexMap::set_index | ( | size_t | index, |
knowledge::KnowledgeRecord::Integer | value, | ||
const KnowledgeUpdateSettings & | settings | ||
) |
Sets an index within an array to a specified value.
index | index of the location in the array |
value | value to set at location |
settings | settings for applying the update |
Definition at line 827 of file FlexMap.cpp.
int madara::knowledge::containers::FlexMap::set_jpeg | ( | const unsigned char * | value, |
size_t | size | ||
) |
Atomically sets the value of an index to a JPEG image.
value | new value of the variable |
size | indicates the size of the value buffer |
Definition at line 1186 of file FlexMap.cpp.
int madara::knowledge::containers::FlexMap::set_jpeg | ( | const unsigned char * | value, |
size_t | size, | ||
const KnowledgeUpdateSettings & | settings | ||
) |
Atomically sets the value of an index to a JPEG image.
value | new value of the variable |
size | indicates the size of the value buffer |
settings | settings for applying the update |
Definition at line 1207 of file FlexMap.cpp.
void madara::knowledge::containers::FlexMap::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 573 of file FlexMap.cpp.
void madara::knowledge::containers::FlexMap::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 599 of file FlexMap.cpp.
void madara::knowledge::containers::FlexMap::set_quality | ( | uint32_t | quality, |
const KnowledgeReferenceSettings & | settings = KnowledgeReferenceSettings( false) |
||
) |
Sets the quality of writing to a certain variable from this entity.
quality | quality of writing to this location |
settings | settings for referring to knowledge variables |
Definition at line 1228 of file FlexMap.cpp.
|
inherited |
Sets the update settings for the container.
settings | the new settings to use |
Definition at line 20 of file BaseContainer.cpp.
size_t madara::knowledge::containers::FlexMap::size | ( | bool | first_level_keys_only = true | ) | const |
Returns the size of the map.
first_level_keys_only | if true, only use first level keys |
Definition at line 481 of file FlexMap.cpp.
void madara::knowledge::containers::FlexMap::to_container | ( | BufferVector & | target | ) | const |
Fills a BufferVector container with all subkeys.
target | container to be filled |
Definition at line 280 of file FlexMap.cpp.
void madara::knowledge::containers::FlexMap::to_container | ( | Double & | target | ) | const |
Fills a Double container with the current location.
target | container to be filled |
Definition at line 364 of file FlexMap.cpp.
void madara::knowledge::containers::FlexMap::to_container | ( | DoubleVector & | target | ) | const |
Fills a DoubleVector container with all subkeys.
target | container to be filled |
Definition at line 297 of file FlexMap.cpp.
void madara::knowledge::containers::FlexMap::to_container | ( | Integer & | target | ) | const |
Fills an Integer container with the current location.
target | container to be filled |
Definition at line 395 of file FlexMap.cpp.
void madara::knowledge::containers::FlexMap::to_container | ( | IntegerVector & | target | ) | const |
Fills a IntegerVector container with all subkeys.
target | container to be filled |
Definition at line 314 of file FlexMap.cpp.
void madara::knowledge::containers::FlexMap::to_container | ( | Map & | target | ) | const |
Fills a Map container with all subkeys.
target | container to be filled |
Definition at line 425 of file FlexMap.cpp.
void madara::knowledge::containers::FlexMap::to_container | ( | NativeDoubleVector & | target | ) | const |
Fills a NativeDoubleVector container with all subkeys.
target | container to be filled |
Definition at line 379 of file FlexMap.cpp.
void madara::knowledge::containers::FlexMap::to_container | ( | NativeIntegerVector & | target | ) | const |
Fills a NativeIntegerVector container with all subkeys.
target | container to be filled |
Definition at line 331 of file FlexMap.cpp.
void madara::knowledge::containers::FlexMap::to_container | ( | String & | target | ) | const |
Fills a String container with the current location.
target | container to be filled |
Definition at line 410 of file FlexMap.cpp.
void madara::knowledge::containers::FlexMap::to_container | ( | StringVector & | target | ) | const |
Fills a StringVector container with all subkeys.
target | container to be filled |
Definition at line 347 of file FlexMap.cpp.
double madara::knowledge::containers::FlexMap::to_double | ( | double | default_value = 0.0 | ) | const |
Returns the value at the location as a double.
default_value | if map location does not exist in KB, return this value instead |
Definition at line 236 of file FlexMap.cpp.
madara::knowledge::KnowledgeRecord::Integer madara::knowledge::containers::FlexMap::to_integer | ( | KnowledgeRecord::Integer | default_value = 0 | ) | const |
Returns the value at the location as an integer.
default_value | if map location does not exist in KB, return this value instead |
Definition at line 214 of file FlexMap.cpp.
madara::knowledge::KnowledgeRecord madara::knowledge::containers::FlexMap::to_record | ( | const KnowledgeRecord & | default_value = KnowledgeRecord(0) | ) | const |
Retrieves a copy of the record from the current location.
default_value | if map location does not exist in KB, return this value instead |
Definition at line 191 of file FlexMap.cpp.
std::string madara::knowledge::containers::FlexMap::to_string | ( | const std::string & | default_value = "" | ) | const |
Returns the value at the location as a string.
default_value | if map location does not exist in KB, return this value instead |
Definition at line 258 of file FlexMap.cpp.
|
private |
Updates the variable reference if necessary.
Definition at line 623 of file FlexMap.cpp.
|
private |
|
private |
|
mutableprotectedinherited |
guard for access and changes
Mutex for local changes
Definition at line 136 of file BaseContainer.h.
|
protectedinherited |
Prefix of variable.
Definition at line 146 of file BaseContainer.h.
|
protectedinherited |
Settings for modifications.
Definition at line 151 of file BaseContainer.h.
|
mutableprivate |