SMTK  @SMTK_VERSION@
Simulation Modeling Tool Kit
Public Member Functions | Protected Attributes | List of all members
smtk::common::Status Class Reference

A return value for methods that need to indicate both success/failure and modification/stasis. More...

#include <Status.h>

Public Member Functions

 Status (const Status &)=default
 
 Status (Status &&)=default
 
Statusoperator= (const Status &)=default
 
bool success () const
 Return whether or not a method succeeded (true) or not (false).
 
bool modified () const
 Return whether a method modified its object (true) or not (false).
 
bool markModified ()
 Mark the Status to indicate an object was modified.
 
bool markFailed ()
 Mark the Status to indicate a method failed.
 
Statusoperator&= (const Status &other)
 Combine this status object with another instance. More...
 
 operator bool () const
 

Protected Attributes

bool m_success { true }
 
bool m_modified { false }
 

Detailed Description

A return value for methods that need to indicate both success/failure and modification/stasis.

This convenience class provides a default cast to a boolean that returns whether the method succeeded; this way it is backwards compatible with any API that previously returned a success/failure boolean.

Upon construction, a Status object indicates success without modification. You may then mark whether failure or modification occurred.

Member Function Documentation

◆ operator&=()

Status & smtk::common::Status::operator&= ( const Status other)

Combine this status object with another instance.

This AND-s the success bits together (both must succeed for either to succeed) while OR-ing the modified bits together (if either is modified, the result is).


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