#include <UpdateStatus.hpp>
Public Member Functions | |
UpdateStatus () | |
bool | isConverged () const |
bool | isUpdated () const |
void | update (UpdateStatus other) |
void | updateConverged () |
void | updateNotConverged () |
Private Attributes | |
uint8_t | _status |
Static Private Attributes | |
static const uint8_t | NotUpdated |
static const uint8_t | UpdatedConverged |
static const uint8_t | UpdatedNotConverged |
UpdateStatus is a helper class for representing a tri-state enumeration value that indicates the update status of an entity (which can be a single value or an aggregate of values): NotUpdated means the entity has not been changed and thus has converged; UpdatedConverged means the entity has been changed but can be considered to have converged; UpdatedNotConverged means the entity has been changed and has not yet converged.
This tri-state is implemented as a class rather than a straight enumeration to facilitate streamlined operations and queries on its value, as can be seen from the various functions defined for this class. UpdateStatus instances can be copied or moved at will. The tri-state value is stored in a single byte to limit the size of arrays of UpdateStatus instances.
|
inline |
This is the default constructor; the status is initialized to NotUpdated.
|
inline |
This function returns true if the status is NotUpdated or UpdatedConverged, and false if the status is UpdatedNotConverged.
|
inline |
This function returns true if the status is UpdatedConverged or UpdatedNotConverged, and false if the status is NotUpdated.
|
inline |
This function updates the receiving status according the specified other status, which is useful when determining the aggregated status for a set of entities. Specifically, if the other status is UpdatedNotConverged, the effect is that of the updateNotConverged() function; if the other status is UpdatedConverged, the effect is that of the updateConverged() function; and if the other status is NotUpdated, there is no effect.
|
inline |
If the current status is NotUpdated, this function changes it to UpdatedConverged. Otherwise, the function has no effect. Specifically, an UpdatedNotConverged status is never "downgraded" to UpdatedConverged.
|
inline |
This function sets the status to UpdatedNotConverged regardless of its current value.