MADARA
3.1.8
|
This class stores a vector of NativeIntegerVectors. More...
#include <IntegerVectorVector.h>
Classes | |
struct | Indices |
two dimensional indexing More... | |
Public Types | |
typedef std::vector< int64_t > | type |
trait that describes the value type More... | |
Public Member Functions | |
IntegerVectorVector (const KnowledgeUpdateSettings &settings=KnowledgeUpdateSettings(), const std::string &delimiter=".") | |
Default constructor. More... | |
IntegerVectorVector (const std::string &name, KnowledgeBase &knowledge, int size=-1, bool delete_vars=true, const KnowledgeUpdateSettings &settings=KnowledgeUpdateSettings(), const std::string &delimiter=".") | |
Constructor. More... | |
IntegerVectorVector (const std::string &name, Variables &knowledge, int size=-1, bool delete_vars=true, const KnowledgeUpdateSettings &settings=KnowledgeUpdateSettings(), const std::string &delimiter=".") | |
Constructor. More... | |
IntegerVectorVector (const IntegerVectorVector &rhs) | |
Copy constructor. More... | |
virtual | ~IntegerVectorVector () |
Destructor. More... | |
virtual BaseContainer * | clone (void) const |
Clones this container. More... | |
void | copy_to (KnowledgeVector &target) const |
Copies the vector elements to an STL vector of Knowledge Records. More... | |
void | copy_to (std::vector< type > &target) const |
Copies the vector elements to an STL vector. More... | |
void | exchange (IntegerVectorVector &other, bool refresh_keys=true, bool delete_keys=true) |
Exchanges the vector at this location with the vector at another location. More... | |
bool | exists (size_t index) const |
Checks to see if the index 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_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... | |
VariableReference | get_size_ref (void) |
Returns a reference to the size field of the current name. More... | |
bool | is_false (void) const |
Determines if the value of the vector is false. More... | |
bool | is_true (void) const |
Determines if all values in the vector are true. More... | |
void | modify (void) |
Mark the vector as modified. More... | |
void | modify (size_t index) |
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... | |
void | operator= (const IntegerVectorVector &rhs) |
Assignment operator. More... | |
type | operator[] (size_t index) const |
Retrieves a copy of the record from the vector. More... | |
int64_t | operator[] (Indices index) const |
Retrieves an index from the multi-dimensional array. More... | |
void | push_back (const type &value) |
Pushes the value to the end of the array after incrementing the array size. More... | |
void | resize (int size=-1, bool delete_vars=true) |
Resizes the vector. More... | |
int | set (size_t index, type value) |
Sets a knowledge variable to a specified value. More... | |
int | set (const std::vector< type > &value) |
Reads values from a STL vector of doubles. More... | |
int | set (size_t index, type value, const KnowledgeUpdateSettings &settings) |
Sets a knowledge variable to a specified value. More... | |
int | set (const std::vector< type > &value, const KnowledgeUpdateSettings &settings) |
Reads values from a STL vector of doubles. More... | |
void | set_delimiter (const std::string &delimiter) |
Sets the delimiter for adding and detecting subvariables. More... | |
void | set_name (const std::string &var_name, KnowledgeBase &knowledge, int size=-1) |
Sets the variable name that this refers to. More... | |
void | set_name (const std::string &var_name, Variables &knowledge, int size=-1) |
Sets the variable name that this refers to. More... | |
void | set_name (const std::string &var_name, ThreadSafeContext &knowledge, int size=-1) |
Sets the variable name that this refers to. More... | |
void | set_quality (size_t index, 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 (void) const |
Returns the size of the local vector. More... | |
knowledge::KnowledgeRecord | to_record (size_t index) const |
Retrieves a copy of the record from the vector. More... | |
void | transfer_to (IntegerVectorVector &other) |
Transfers elements from this vector to another. 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... | |
std::string | delimiter_ |
Delimiter for the prefix to subvars. More... | |
VariableReference | size_ |
Reference to the size field of the vector space. More... | |
std::vector< VariableReference > | vector_ |
Values of the array. More... | |
This class stores a vector of NativeIntegerVectors.
This is a Vector of int64_t[].
Definition at line 32 of file IntegerVectorVector.h.
typedef std::vector<int64_t> madara::knowledge::containers::IntegerVectorVector::type |
trait that describes the value type
Definition at line 36 of file IntegerVectorVector.h.
madara::knowledge::containers::IntegerVectorVector::IntegerVectorVector | ( | const KnowledgeUpdateSettings & | settings = KnowledgeUpdateSettings () , |
const std::string & | delimiter = "." |
||
) |
Default constructor.
settings | settings for evaluating the vector |
delimiter | the delimiter for variables in the vector |
Definition at line 5 of file IntegerVectorVector.cpp.
madara::knowledge::containers::IntegerVectorVector::IntegerVectorVector | ( | const std::string & | name, |
KnowledgeBase & | knowledge, | ||
int | size = -1 , |
||
bool | delete_vars = true , |
||
const KnowledgeUpdateSettings & | settings = KnowledgeUpdateSettings () , |
||
const std::string & | delimiter = "." |
||
) |
Constructor.
name | name of the vector in the knowledge base |
size | size of the vector. -1 to check for size. |
knowledge | the knowledge base that will contain the vector |
delete_vars | delete indices outside of the specified range |
settings | settings for evaluating the vector |
delimiter | the delimiter for variables in the vector |
Definition at line 12 of file IntegerVectorVector.cpp.
madara::knowledge::containers::IntegerVectorVector::IntegerVectorVector | ( | const std::string & | name, |
Variables & | knowledge, | ||
int | size = -1 , |
||
bool | delete_vars = true , |
||
const KnowledgeUpdateSettings & | settings = KnowledgeUpdateSettings () , |
||
const std::string & | delimiter = "." |
||
) |
Constructor.
name | name of the vector in the knowledge base |
size | size of the vector. -1 to check for size. |
knowledge | the knowledge base that will contain the vector |
delete_vars | delete indices outside of the specified range |
settings | settings for evaluating the vector |
delimiter | the delimiter for variables in the vector |
Definition at line 26 of file IntegerVectorVector.cpp.
madara::knowledge::containers::IntegerVectorVector::IntegerVectorVector | ( | const IntegerVectorVector & | rhs | ) |
Copy constructor.
Definition at line 40 of file IntegerVectorVector.cpp.
|
virtual |
Destructor.
Definition at line 50 of file IntegerVectorVector.cpp.
|
virtual |
Clones this container.
Implements madara::knowledge::containers::BaseContainer.
Definition at line 114 of file IntegerVectorVector.cpp.
void madara::knowledge::containers::IntegerVectorVector::copy_to | ( | KnowledgeVector & | target | ) | const |
Copies the vector elements to an STL vector of Knowledge Records.
target | record values at this instance |
Definition at line 482 of file IntegerVectorVector.cpp.
void madara::knowledge::containers::IntegerVectorVector::copy_to | ( | std::vector< type > & | target | ) | const |
Copies the vector elements to an STL vector.
target | the target of the copy operation |
Definition at line 500 of file IntegerVectorVector.cpp.
void madara::knowledge::containers::IntegerVectorVector::exchange | ( | IntegerVectorVector & | other, |
bool | refresh_keys = true , |
||
bool | delete_keys = true |
||
) |
Exchanges the vector at this location with the vector at another location.
other | the other vector 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 367 of file IntegerVectorVector.cpp.
bool madara::knowledge::containers::IntegerVectorVector::exists | ( | size_t | index | ) | const |
Checks to see if the index has ever been assigned a value.
index | the index of the variable entry |
Definition at line 571 of file IntegerVectorVector.cpp.
std::string madara::knowledge::containers::IntegerVectorVector::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 69 of file IntegerVectorVector.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 108 of file IntegerVectorVector.cpp.
std::string madara::knowledge::containers::IntegerVectorVector::get_delimiter | ( | void | ) |
Gets the delimiter for adding and detecting subvariables.
By default, MADARA uses a '.' delimiter for names like "com.madara.Var1". Other conventions can include '/' for ROS-like topic directory structures, e.g., com/madara/Var1.
Definition at line 361 of file IntegerVectorVector.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.
madara::knowledge::VariableReference madara::knowledge::containers::IntegerVectorVector::get_size_ref | ( | void | ) |
Returns a reference to the size field of the current name.
Definition at line 166 of file IntegerVectorVector.cpp.
bool madara::knowledge::containers::IntegerVectorVector::is_false | ( | void | ) | const |
Determines if the value of the vector is false.
Definition at line 734 of file IntegerVectorVector.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 747 of file IntegerVectorVector.cpp.
bool madara::knowledge::containers::IntegerVectorVector::is_true | ( | void | ) | const |
Determines if all values in the vector are true.
Definition at line 688 of file IntegerVectorVector.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 741 of file IntegerVectorVector.cpp.
void madara::knowledge::containers::IntegerVectorVector::modify | ( | void | ) |
Mark the vector as modified.
The vector retains the same values but will resend values as if they had been modified.
Definition at line 56 of file IntegerVectorVector.cpp.
void madara::knowledge::containers::IntegerVectorVector::modify | ( | size_t | index | ) |
Mark the value as modified.
The vector element retains its value but will resend its value as if it had been modified.
index | the index to modify |
Definition at line 120 of file IntegerVectorVector.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 102 of file IntegerVectorVector.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.
void madara::knowledge::containers::IntegerVectorVector::operator= | ( | const IntegerVectorVector & | rhs | ) |
Assignment operator.
rhs | value to copy |
Definition at line 130 of file IntegerVectorVector.cpp.
madara::knowledge::containers::IntegerVectorVector::type madara::knowledge::containers::IntegerVectorVector::operator[] | ( | size_t | index | ) | const |
Retrieves a copy of the record from the vector.
index | the index of the variable entry |
Definition at line 518 of file IntegerVectorVector.cpp.
int64_t madara::knowledge::containers::IntegerVectorVector::operator[] | ( | Indices | index | ) | const |
Retrieves an index from the multi-dimensional array.
index | the index of the variable entry |
Definition at line 535 of file IntegerVectorVector.cpp.
void madara::knowledge::containers::IntegerVectorVector::push_back | ( | const type & | value | ) |
Pushes the value to the end of the array after incrementing the array size.
value | the value to place at the end of the array |
Definition at line 147 of file IntegerVectorVector.cpp.
void madara::knowledge::containers::IntegerVectorVector::resize | ( | int | size = -1 , |
bool | delete_vars = true |
||
) |
Resizes the vector.
size | maximum size of the vector. Can be -1 to check the knowledge base for size information) |
delete_vars | delete indices outside of the specified range |
Definition at line 189 of file IntegerVectorVector.cpp.
int madara::knowledge::containers::IntegerVectorVector::set | ( | size_t | index, |
type | value | ||
) |
Sets a knowledge variable to a specified value.
index | index to set |
value | value to set at location |
Definition at line 587 of file IntegerVectorVector.cpp.
int madara::knowledge::containers::IntegerVectorVector::set | ( | const std::vector< type > & | value | ) |
Reads values from a STL vector of doubles.
value | array of doubles to set at the location |
Definition at line 605 of file IntegerVectorVector.cpp.
int madara::knowledge::containers::IntegerVectorVector::set | ( | size_t | index, |
type | value, | ||
const KnowledgeUpdateSettings & | settings | ||
) |
Sets a knowledge variable to a specified value.
index | index to set |
value | value to set at location |
settings | settings for applying the update |
Definition at line 629 of file IntegerVectorVector.cpp.
int madara::knowledge::containers::IntegerVectorVector::set | ( | const std::vector< type > & | value, |
const KnowledgeUpdateSettings & | settings | ||
) |
Reads values from a STL vector of doubles.
value | array of doubles to set at the location |
settings | settings for applying the update |
Definition at line 648 of file IntegerVectorVector.cpp.
void madara::knowledge::containers::IntegerVectorVector::set_delimiter | ( | const std::string & | delimiter | ) |
Sets the delimiter for adding and detecting subvariables.
By default, MADARA uses a '.' delimiter for names like "com.madara.Var1". Other conventions can include '/' for ROS-like topic directory structures, e.g., com/madara/Var1.
delimiter | the delimiter to use for variable demarcation |
Definition at line 345 of file IntegerVectorVector.cpp.
void madara::knowledge::containers::IntegerVectorVector::set_name | ( | const std::string & | var_name, |
KnowledgeBase & | knowledge, | ||
int | size = -1 |
||
) |
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 |
size | size of the new vector (-1 to not change size) |
Definition at line 285 of file IntegerVectorVector.cpp.
void madara::knowledge::containers::IntegerVectorVector::set_name | ( | const std::string & | var_name, |
Variables & | knowledge, | ||
int | size = -1 |
||
) |
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 |
size | size of the new vector (-1 to not change size) |
Definition at line 307 of file IntegerVectorVector.cpp.
void madara::knowledge::containers::IntegerVectorVector::set_name | ( | const std::string & | var_name, |
ThreadSafeContext & | knowledge, | ||
int | size = -1 |
||
) |
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 |
size | size of the new vector (-1 to not change size) |
Definition at line 326 of file IntegerVectorVector.cpp.
void madara::knowledge::containers::IntegerVectorVector::set_quality | ( | size_t | index, |
uint32_t | quality, | ||
const KnowledgeReferenceSettings & | settings = KnowledgeReferenceSettings (false) |
||
) |
Sets the quality of writing to a certain variable from this entity.
index | index to set |
quality | quality of writing to this location |
settings | settings for referring to knowledge variables |
Definition at line 673 of file IntegerVectorVector.cpp.
|
inherited |
Sets the update settings for the container.
settings | the new settings to use |
Definition at line 28 of file BaseContainer.cpp.
size_t madara::knowledge::containers::IntegerVectorVector::size | ( | void | ) | const |
Returns the size of the local vector.
Call resize() first without arguments to ensure local vector matches data in KnowledgeBase.
Definition at line 278 of file IntegerVectorVector.cpp.
madara::knowledge::KnowledgeRecord madara::knowledge::containers::IntegerVectorVector::to_record | ( | size_t | index | ) | const |
Retrieves a copy of the record from the vector.
index | the index of the variable entry |
Definition at line 554 of file IntegerVectorVector.cpp.
void madara::knowledge::containers::IntegerVectorVector::transfer_to | ( | IntegerVectorVector & | other | ) |
Transfers elements from this vector to another.
other | the other vector to transfer to |
Definition at line 456 of file IntegerVectorVector.cpp.
|
private |
Variable context that we are modifying.
Definition at line 373 of file IntegerVectorVector.h.
|
private |
Delimiter for the prefix to subvars.
Definition at line 388 of file IntegerVectorVector.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 |
Reference to the size field of the vector space.
Definition at line 383 of file IntegerVectorVector.h.
|
private |
Values of the array.
Definition at line 378 of file IntegerVectorVector.h.