The SKIRT project
advanced radiative transfer for astrophysics
Public Member Functions | Private Attributes | Static Private Attributes | List of all members
UpdateStatus Class Referencefinal

#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
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ UpdateStatus()

UpdateStatus::UpdateStatus ( )
inline

This is the default constructor; the status is initialized to NotUpdated.

Member Function Documentation

◆ isConverged()

bool UpdateStatus::isConverged ( ) const
inline

This function returns true if the status is NotUpdated or UpdatedConverged, and false if the status is UpdatedNotConverged.

◆ isUpdated()

bool UpdateStatus::isUpdated ( ) const
inline

This function returns true if the status is UpdatedConverged or UpdatedNotConverged, and false if the status is NotUpdated.

◆ update()

void UpdateStatus::update ( UpdateStatus  other)
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.

◆ updateConverged()

void UpdateStatus::updateConverged ( )
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.

◆ updateNotConverged()

void UpdateStatus::updateNotConverged ( )
inline

This function sets the status to UpdatedNotConverged regardless of its current value.


The documentation for this class was generated from the following file: