MADARA
3.4.1
|
This class stores an integer within a variable context. More...
#include <LegacyBarrier.h>
Public Types | |
typedef knowledge::KnowledgeRecord::Integer | type |
trait that describes the value type More... | |
Public Member Functions | |
LegacyBarrier (const KnowledgeUpdateSettings &settings=KnowledgeUpdateSettings()) | |
Default constructor. More... | |
LegacyBarrier (const LegacyBarrier &rhs) | |
Copy constructor. More... | |
LegacyBarrier (const std::string &name, KnowledgeBase &knowledge, const KnowledgeUpdateSettings &settings=KnowledgeUpdateSettings()) | |
Constructor. More... | |
LegacyBarrier (const std::string &name, KnowledgeBase &knowledge, int id, int participants, const KnowledgeUpdateSettings &settings=KnowledgeUpdateSettings()) | |
Default constructor. More... | |
LegacyBarrier (const std::string &name, Variables &knowledge, const KnowledgeUpdateSettings &settings=KnowledgeUpdateSettings()) | |
Constructor. More... | |
LegacyBarrier (const std::string &name, Variables &knowledge, int id, int participants, const KnowledgeUpdateSettings &settings=KnowledgeUpdateSettings()) | |
Default constructor. More... | |
~LegacyBarrier () | |
Destructor. More... | |
virtual BaseContainer * | clone (void) const |
Clones this container. More... | |
std::string | get_debug_info (void) |
Returns the type of the container along with name and any other useful information. More... | |
size_t | get_id (void) const |
Returns the id of the barrier in the barrier ring. More... | |
std::string | get_name (void) const |
Returns the name of the container. More... | |
size_t | get_participants (void) const |
Returns the number of participants in the barrier ring. More... | |
type | get_round (void) const |
Returns the current barrier round. More... | |
KnowledgeUpdateSettings | get_settings (void) |
Gets the update settings for the container. More... | |
bool | is_done (void) |
Wait for all other participants to reach your barrier round. More... | |
bool | is_false (void) const |
Determines if the barrier is false. More... | |
bool | is_true (void) const |
Determines if the barrier 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... | |
void | next (void) |
Goes to the next barrier round. More... | |
bool | operator!= (const LegacyBarrier &value) const |
Checks for inequality. More... | |
void | operator= (const LegacyBarrier &rhs) |
Assignment operator. More... | |
type | operator= (type value) |
Sets the value of the variable. More... | |
bool | operator== (const LegacyBarrier &value) const |
Checks for equality. More... | |
void | resize (size_t id=0, size_t participants=1) |
Resizes the barrier, usually when number of participants change. More... | |
void | set (type value) |
Sets the barrier to a specific round. More... | |
void | set_name (const std::string &var_name, KnowledgeBase &knowledge, int id, int participants) |
Sets the variable name that this refers to. More... | |
void | set_name (const std::string &var_name, ThreadSafeContext &knowledge, int id, int participants) |
Sets the variable name that this refers to. More... | |
void | set_name (const std::string &var_name, Variables &knowledge, int id, int participants) |
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 barrier variables. More... | |
void | set_settings (const KnowledgeUpdateSettings &settings) |
Sets the update settings for the container. More... | |
double | to_double (void) const |
Returns the barrier round number as a double. More... | |
knowledge::KnowledgeRecord::Integer | to_integer (void) const |
Returns the barrier round number as an integer (same as *) More... | |
knowledge::KnowledgeRecord | to_record (void) const |
Returns the barrier round number as a knowledge::KnowledgeRecord. More... | |
std::string | to_string (void) const |
Returns the barrier round number 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 Member Functions | |
type | barrier_result (void) const |
Checks if current barrier is successful. More... | |
void | build_aggregate_barrier (void) |
Builds the aggregate barrier logic. More... | |
void | build_var (void) |
Builds the variable that is actually incremented. More... | |
virtual std::string | get_debug_info_ (void) |
Returns the type of the container along with name and any other useful information. More... | |
void | init_noharm (void) |
Initialize the no harm eval settings. 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 | |
CompiledExpression | aggregate_barrier_ |
Expression for aggregating barrier in one atomic operation. More... | |
ThreadSafeContext * | context_ |
Variable context that we are modifying. More... | |
size_t | id_ |
id of this barrier in the barrier ring More... | |
EvalSettings | no_harm |
Settings we'll use for all evaluations. More... | |
size_t | participants_ |
the number of participants in the barrier ring More... | |
VariableReference | variable_ |
Variable reference. More... | |
std::string | variable_name_ |
Holder for variable name to quickly refresh modified status. More... | |
This class stores an integer within a variable context.
Definition at line 31 of file LegacyBarrier.h.
trait that describes the value type
Definition at line 35 of file LegacyBarrier.h.
madara::knowledge::containers::LegacyBarrier::LegacyBarrier | ( | const KnowledgeUpdateSettings & | settings = KnowledgeUpdateSettings() | ) |
Default constructor.
Definition at line 8 of file LegacyBarrier.cpp.
madara::knowledge::containers::LegacyBarrier::LegacyBarrier | ( | 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 evaluating the vector |
Definition at line 15 of file LegacyBarrier.cpp.
madara::knowledge::containers::LegacyBarrier::LegacyBarrier | ( | 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 to apply by default |
Definition at line 27 of file LegacyBarrier.cpp.
madara::knowledge::containers::LegacyBarrier::LegacyBarrier | ( | const std::string & | name, |
KnowledgeBase & | knowledge, | ||
int | id, | ||
int | participants, | ||
const KnowledgeUpdateSettings & | settings = KnowledgeUpdateSettings() |
||
) |
Default constructor.
name | name of the integer in the knowledge base |
knowledge | the knowledge base that will contain the vector |
id | the id of the barrier in the barrier ring |
participants | the number of participants in the barrier ring |
settings | settings for evaluating the vector |
Definition at line 39 of file LegacyBarrier.cpp.
madara::knowledge::containers::LegacyBarrier::LegacyBarrier | ( | const std::string & | name, |
Variables & | knowledge, | ||
int | id, | ||
int | participants, | ||
const KnowledgeUpdateSettings & | settings = KnowledgeUpdateSettings() |
||
) |
Default constructor.
name | name of the integer in the knowledge base |
knowledge | the knowledge base that will contain the vector |
id | the id of the barrier in the barrier ring |
participants | the number of participants in the barrier ring |
settings | settings for evaluating the vector |
Definition at line 52 of file LegacyBarrier.cpp.
madara::knowledge::containers::LegacyBarrier::LegacyBarrier | ( | const LegacyBarrier & | rhs | ) |
Copy constructor.
Definition at line 65 of file LegacyBarrier.cpp.
madara::knowledge::containers::LegacyBarrier::~LegacyBarrier | ( | ) |
Destructor.
Definition at line 78 of file LegacyBarrier.cpp.
|
inlineprivate |
Checks if current barrier is successful.
Definition at line 310 of file LegacyBarrier.h.
|
private |
Builds the aggregate barrier logic.
Definition at line 99 of file LegacyBarrier.cpp.
|
private |
Builds the variable that is actually incremented.
Definition at line 149 of file LegacyBarrier.cpp.
|
virtual |
Clones this container.
Implements madara::knowledge::containers::BaseContainer.
Definition at line 421 of file LegacyBarrier.cpp.
std::string madara::knowledge::containers::LegacyBarrier::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 375 of file LegacyBarrier.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 415 of file LegacyBarrier.cpp.
size_t madara::knowledge::containers::LegacyBarrier::get_id | ( | void | ) | const |
Returns the id of the barrier in the barrier ring.
Definition at line 191 of file LegacyBarrier.cpp.
|
inlineinherited |
Returns the name of the container.
Definition at line 4 of file BaseContainer.inl.
size_t madara::knowledge::containers::LegacyBarrier::get_participants | ( | void | ) | const |
Returns the number of participants in the barrier ring.
Definition at line 197 of file LegacyBarrier.cpp.
|
inline |
Returns the current barrier round.
Definition at line 116 of file LegacyBarrier.h.
|
inherited |
Gets the update settings for the container.
Definition at line 29 of file BaseContainer.cpp.
|
private |
Initialize the no harm eval settings.
Definition at line 181 of file LegacyBarrier.cpp.
bool madara::knowledge::containers::LegacyBarrier::is_done | ( | void | ) |
Wait for all other participants to reach your barrier round.
Definition at line 325 of file LegacyBarrier.cpp.
bool madara::knowledge::containers::LegacyBarrier::is_false | ( | void | ) | const |
Determines if the barrier is false.
Definition at line 485 of file LegacyBarrier.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 495 of file LegacyBarrier.cpp.
bool madara::knowledge::containers::LegacyBarrier::is_true | ( | void | ) | const |
Determines if the barrier is true.
Definition at line 465 of file LegacyBarrier.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 490 of file LegacyBarrier.cpp.
void madara::knowledge::containers::LegacyBarrier::modify | ( | void | ) |
Mark the value as modified.
The barrier retains the same value but will resend its value as if it had been modified.
Definition at line 367 of file LegacyBarrier.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 410 of file LegacyBarrier.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::LegacyBarrier::next | ( | void | ) |
Goes to the next barrier round.
Definition at line 315 of file LegacyBarrier.cpp.
bool madara::knowledge::containers::LegacyBarrier::operator!= | ( | const LegacyBarrier & | value | ) | const |
Checks for inequality.
value | the value to compare to |
void madara::knowledge::containers::LegacyBarrier::operator= | ( | const LegacyBarrier & | rhs | ) |
madara::knowledge::containers::LegacyBarrier::type madara::knowledge::containers::LegacyBarrier::operator= | ( | type | value | ) |
Sets the value of the variable.
value | the new value of the variable |
Definition at line 273 of file LegacyBarrier.cpp.
bool madara::knowledge::containers::LegacyBarrier::operator== | ( | const LegacyBarrier & | value | ) | const |
Checks for equality.
value | the value to compare to |
void madara::knowledge::containers::LegacyBarrier::resize | ( | size_t | id = 0 , |
size_t | participants = 1 |
||
) |
Resizes the barrier, usually when number of participants change.
id | the id of this barrier in the barrier ring |
participants | the number of participants in barrier ring |
Definition at line 256 of file LegacyBarrier.cpp.
void madara::knowledge::containers::LegacyBarrier::set | ( | type | value | ) |
Sets the barrier to a specific round.
Definition at line 359 of file LegacyBarrier.cpp.
void madara::knowledge::containers::LegacyBarrier::set_name | ( | const std::string & | var_name, |
KnowledgeBase & | knowledge, | ||
int | id, | ||
int | participants | ||
) |
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 |
id | the id of the barrier in the barrier ring |
participants | the number of participants in the barrier ring |
Definition at line 203 of file LegacyBarrier.cpp.
void madara::knowledge::containers::LegacyBarrier::set_name | ( | const std::string & | var_name, |
ThreadSafeContext & | knowledge, | ||
int | id, | ||
int | participants | ||
) |
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 |
id | the id of the barrier in the barrier ring |
participants | the number of participants in the barrier ring |
Definition at line 238 of file LegacyBarrier.cpp.
void madara::knowledge::containers::LegacyBarrier::set_name | ( | const std::string & | var_name, |
Variables & | knowledge, | ||
int | id, | ||
int | participants | ||
) |
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 |
id | the id of the barrier in the barrier ring |
participants | the number of participants in the barrier ring |
Definition at line 221 of file LegacyBarrier.cpp.
void madara::knowledge::containers::LegacyBarrier::set_quality | ( | uint32_t | quality, |
const KnowledgeReferenceSettings & | settings = KnowledgeReferenceSettings( false) |
||
) |
Sets the quality of writing to the barrier variables.
quality | quality of writing to this location |
settings | settings for referring to knowledge variables |
Definition at line 454 of file LegacyBarrier.cpp.
|
inherited |
Sets the update settings for the container.
settings | the new settings to use |
Definition at line 20 of file BaseContainer.cpp.
double madara::knowledge::containers::LegacyBarrier::to_double | ( | void | ) | const |
Returns the barrier round number as a double.
Definition at line 426 of file LegacyBarrier.cpp.
madara::knowledge::KnowledgeRecord::Integer madara::knowledge::containers::LegacyBarrier::to_integer | ( | void | ) | const |
Returns the barrier round number as an integer (same as *)
Definition at line 301 of file LegacyBarrier.cpp.
madara::knowledge::KnowledgeRecord madara::knowledge::containers::LegacyBarrier::to_record | ( | void | ) | const |
Returns the barrier round number as a knowledge::KnowledgeRecord.
This is useful for referencing clock and other record info.
Definition at line 286 of file LegacyBarrier.cpp.
std::string madara::knowledge::containers::LegacyBarrier::to_string | ( | void | ) | const |
Returns the barrier round number as a string.
Definition at line 440 of file LegacyBarrier.cpp.
|
private |
Expression for aggregating barrier in one atomic operation.
Definition at line 354 of file LegacyBarrier.h.
|
mutableprivate |
Variable context that we are modifying.
Definition at line 333 of file LegacyBarrier.h.
|
private |
id of this barrier in the barrier ring
Definition at line 343 of file LegacyBarrier.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.
|
private |
Settings we'll use for all evaluations.
Definition at line 360 of file LegacyBarrier.h.
|
private |
the number of participants in the barrier ring
Definition at line 348 of file LegacyBarrier.h.
|
protectedinherited |
Settings for modifications.
Definition at line 151 of file BaseContainer.h.
|
private |
Variable reference.
Definition at line 338 of file LegacyBarrier.h.
|
private |
Holder for variable name to quickly refresh modified status.
Definition at line 365 of file LegacyBarrier.h.