MADARA
3.4.1
|
This class stores a vector of doubles inside of KaRL. More...
#include <NativeDoubleVector.h>
Public Types | |
typedef double | type |
trait that describes the value type More... | |
Public Member Functions | |
NativeDoubleVector (const KnowledgeUpdateSettings &settings=KnowledgeUpdateSettings()) | |
Default constructor. More... | |
NativeDoubleVector (const NativeDoubleVector &rhs) | |
Copy constructor. More... | |
NativeDoubleVector (const std::string &name, KnowledgeBase &knowledge, int size=-1, const KnowledgeUpdateSettings &settings=KnowledgeUpdateSettings()) | |
Constructor. More... | |
NativeDoubleVector (const std::string &name, Variables &knowledge, int size=-1, const KnowledgeUpdateSettings &settings=KnowledgeUpdateSettings()) | |
Constructor. More... | |
virtual | ~NativeDoubleVector () |
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 | exchange (NativeDoubleVector &other) |
Exchanges the vector at this location with the vector 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 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 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 NativeDoubleVector &rhs) |
Assignment operator. More... | |
type | operator[] (size_t index) const |
Retrieves a copy of the record from the map. More... | |
void | push_back (type value) |
Pushes the value to the end of the array after incrementing the array size. More... | |
void | resize (size_t size) |
Resizes the vector. More... | |
int | set (const std::vector< type > &value) |
Reads values from a STL vector of doubles. More... | |
int | set (const std::vector< type > &value, const KnowledgeUpdateSettings &settings) |
Reads values from a STL vector of doubles. More... | |
int | set (const type *values, uint32_t size) |
Reads values from a pointer to doubles, and size. More... | |
int | set (const type *values, uint32_t size, const KnowledgeUpdateSettings &settings) |
Reads values from a pointer to doubles, and size. More... | |
int | set (size_t index, type value) |
Sets a knowledge variable to a specified value. More... | |
int | set (size_t index, type value, const KnowledgeUpdateSettings &settings) |
Sets a knowledge variable to a specified value. 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, ThreadSafeContext &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_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 vector. More... | |
std::vector< double > | to_doubles (void) const |
Retrieves the native double array from inside the record. More... | |
knowledge::KnowledgeRecord | to_record (size_t index) const |
Retrieves a copy of the record from the vector. More... | |
knowledge::KnowledgeRecord | to_record (void) const |
Retrieves the entire vector as a native double array in a record. More... | |
void | transfer_to (NativeDoubleVector &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... | |
VariableReference | vector_ |
Reference to the size field of the vector space. More... | |
This class stores a vector of doubles inside of KaRL.
Definition at line 31 of file NativeDoubleVector.h.
typedef double madara::knowledge::containers::NativeDoubleVector::type |
trait that describes the value type
Definition at line 35 of file NativeDoubleVector.h.
madara::knowledge::containers::NativeDoubleVector::NativeDoubleVector | ( | const KnowledgeUpdateSettings & | settings = KnowledgeUpdateSettings() | ) |
Default constructor.
settings | settings for evaluating the vector |
Definition at line 5 of file NativeDoubleVector.cpp.
madara::knowledge::containers::NativeDoubleVector::NativeDoubleVector | ( | const std::string & | name, |
KnowledgeBase & | knowledge, | ||
int | size = -1 , |
||
const KnowledgeUpdateSettings & | settings = KnowledgeUpdateSettings() |
||
) |
Constructor.
name | name of the vector in the knowledge base |
size | size of the vector |
knowledge | the knowledge base that will contain the vector |
settings | settings for evaluating the vector |
Definition at line 13 of file NativeDoubleVector.cpp.
madara::knowledge::containers::NativeDoubleVector::NativeDoubleVector | ( | const std::string & | name, |
Variables & | knowledge, | ||
int | size = -1 , |
||
const KnowledgeUpdateSettings & | settings = KnowledgeUpdateSettings() |
||
) |
Constructor.
name | name of the vector in the knowledge base |
size | size of the vector |
knowledge | the knowledge base that will contain the vector |
settings | settings for evaluating the vector |
Definition at line 29 of file NativeDoubleVector.cpp.
madara::knowledge::containers::NativeDoubleVector::NativeDoubleVector | ( | const NativeDoubleVector & | rhs | ) |
Copy constructor.
Definition at line 45 of file NativeDoubleVector.cpp.
|
virtual |
Destructor.
Definition at line 53 of file NativeDoubleVector.cpp.
|
virtual |
Clones this container.
Implements madara::knowledge::containers::BaseContainer.
Definition at line 107 of file NativeDoubleVector.cpp.
void madara::knowledge::containers::NativeDoubleVector::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 311 of file NativeDoubleVector.cpp.
void madara::knowledge::containers::NativeDoubleVector::exchange | ( | NativeDoubleVector & | other | ) |
Exchanges the vector at this location with the vector at another location.
other | the other vector to exchange with |
Definition at line 243 of file NativeDoubleVector.cpp.
bool madara::knowledge::containers::NativeDoubleVector::exists | ( | void | ) | const |
Checks to see if the variable has ever been assigned a value.
Definition at line 496 of file NativeDoubleVector.cpp.
std::string madara::knowledge::containers::NativeDoubleVector::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 75 of file NativeDoubleVector.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 100 of file NativeDoubleVector.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::NativeDoubleVector::is_false | ( | void | ) | const |
Determines if the value of the vector is false.
Definition at line 566 of file NativeDoubleVector.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 576 of file NativeDoubleVector.cpp.
bool madara::knowledge::containers::NativeDoubleVector::is_true | ( | void | ) | const |
Determines if all values in the vector are true.
Definition at line 544 of file NativeDoubleVector.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 571 of file NativeDoubleVector.cpp.
void madara::knowledge::containers::NativeDoubleVector::modify | ( | void | ) |
Mark the value as modified.
The vector retains the same value but will resend its value as if it had been modified.
Definition at line 59 of file NativeDoubleVector.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 95 of file NativeDoubleVector.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::NativeDoubleVector::operator= | ( | const NativeDoubleVector & | rhs | ) |
Assignment operator.
rhs | value to copy |
Definition at line 115 of file NativeDoubleVector.cpp.
madara::knowledge::containers::NativeDoubleVector::type madara::knowledge::containers::NativeDoubleVector::operator[] | ( | size_t | index | ) | const |
Retrieves a copy of the record from the map.
index | the index of the variable entry |
Definition at line 333 of file NativeDoubleVector.cpp.
void madara::knowledge::containers::NativeDoubleVector::push_back | ( | 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 133 of file NativeDoubleVector.cpp.
void madara::knowledge::containers::NativeDoubleVector::resize | ( | size_t | size | ) |
Resizes the vector.
size | maximum size of the vector |
Definition at line 150 of file NativeDoubleVector.cpp.
int madara::knowledge::containers::NativeDoubleVector::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 397 of file NativeDoubleVector.cpp.
int madara::knowledge::containers::NativeDoubleVector::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 417 of file NativeDoubleVector.cpp.
int madara::knowledge::containers::NativeDoubleVector::set | ( | const type * | values, |
uint32_t | size | ||
) |
Reads values from a pointer to doubles, and size.
values | pointer to doubles to set at the location |
size | number of doubles values points to |
Definition at line 438 of file NativeDoubleVector.cpp.
int madara::knowledge::containers::NativeDoubleVector::set | ( | const type * | values, |
uint32_t | size, | ||
const KnowledgeUpdateSettings & | settings | ||
) |
Reads values from a pointer to doubles, and size.
values | pointer to doubles to set at the location |
size | number of doubles values points to |
settings | settings for applying the update |
Definition at line 458 of file NativeDoubleVector.cpp.
int madara::knowledge::containers::NativeDoubleVector::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 356 of file NativeDoubleVector.cpp.
int madara::knowledge::containers::NativeDoubleVector::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 376 of file NativeDoubleVector.cpp.
void madara::knowledge::containers::NativeDoubleVector::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 177 of file NativeDoubleVector.cpp.
void madara::knowledge::containers::NativeDoubleVector::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 221 of file NativeDoubleVector.cpp.
void madara::knowledge::containers::NativeDoubleVector::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 199 of file NativeDoubleVector.cpp.
void madara::knowledge::containers::NativeDoubleVector::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 479 of file NativeDoubleVector.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::NativeDoubleVector::size | ( | void | ) | const |
Returns the size of the vector.
Definition at line 169 of file NativeDoubleVector.cpp.
std::vector< double > madara::knowledge::containers::NativeDoubleVector::to_doubles | ( | void | ) | const |
Retrieves the native double array from inside the record.
Definition at line 511 of file NativeDoubleVector.cpp.
madara::knowledge::KnowledgeRecord madara::knowledge::containers::NativeDoubleVector::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 521 of file NativeDoubleVector.cpp.
madara::knowledge::KnowledgeRecord madara::knowledge::containers::NativeDoubleVector::to_record | ( | void | ) | const |
Retrieves the entire vector as a native double array in a record.
Definition at line 535 of file NativeDoubleVector.cpp.
void madara::knowledge::containers::NativeDoubleVector::transfer_to | ( | NativeDoubleVector & | other | ) |
Transfers elements from this vector to another.
other | the other vector to transfer to |
Definition at line 266 of file NativeDoubleVector.cpp.
|
private |
Variable context that we are modifying.
Definition at line 329 of file NativeDoubleVector.h.
|
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.
|
private |
Reference to the size field of the vector space.
Definition at line 334 of file NativeDoubleVector.h.