Bifrost SDK
Bifrost SDK documentation
Amino::StopSource Class Reference

A source that can be used to request a stop. More...

#include <StopToken.h>

Public Member Functions

AMINO_CORE_SHARED_DECL StopSource ()
 Default constructor (constructs a valid StopSource). More...
 
AMINO_CORE_SHARED_DECL StopSource (NoStopState_t) noexcept
 Construct a non-stoppable StopSource. More...
 
AMINO_CORE_SHARED_DECL StopSource (StopSource &&o) noexcept
 Move constructor. More...
 
AMINO_CORE_SHARED_DECL StopSource (StopSource const &o)
 Copy constructor. More...
 
AMINO_CORE_SHARED_DECL ~StopSource ()
 Destructor. More...
 
AMINO_CORE_SHARED_DECL StopSourceoperator= (StopSource &&o) noexcept
 Move assignment operator. More...
 
AMINO_CORE_SHARED_DECL StopSourceoperator= (StopSource const &o)
 Copy assignment operator. More...
 
AMINO_CORE_SHARED_DECL StopToken getToken () const noexcept
 Get a StopToken that can be used to check if a stop has been requested from this StopSource. More...
 
AMINO_CORE_SHARED_DECL void requestStop () noexcept
 Request a stop. More...
 
AMINO_CORE_SHARED_DECL bool stopRequested () const
 Check if a stop has been requested for this StopSource. More...
 
AMINO_CORE_SHARED_DECL bool stopPossible () const
 Check if a stop can be requested for this StopSource. More...
 

Friends

bool operator== (StopSource const &lhs, StopSource const &rhs)
 Equality operators. More...
 
bool operator!= (StopSource const &lhs, StopSource const &rhs)
 Equality operators. More...
 

Detailed Description

A source that can be used to request a stop.

Note
Essentially the same as std::stop_source.

Definition at line 107 of file StopToken.h.

Constructor & Destructor Documentation

◆ StopSource() [1/4]

AMINO_CORE_SHARED_DECL Amino::StopSource::StopSource ( )

Default constructor (constructs a valid StopSource).

◆ StopSource() [2/4]

AMINO_CORE_SHARED_DECL Amino::StopSource::StopSource ( NoStopState_t  )
explicitnoexcept

Construct a non-stoppable StopSource.

Postcondition
stopPossible() will return false.

◆ StopSource() [3/4]

AMINO_CORE_SHARED_DECL Amino::StopSource::StopSource ( StopSource &&  o)
noexcept

Move constructor.

◆ StopSource() [4/4]

AMINO_CORE_SHARED_DECL Amino::StopSource::StopSource ( StopSource const &  o)

Copy constructor.

◆ ~StopSource()

AMINO_CORE_SHARED_DECL Amino::StopSource::~StopSource ( )

Destructor.

Member Function Documentation

◆ getToken()

AMINO_CORE_SHARED_DECL StopToken Amino::StopSource::getToken ( ) const
noexcept

Get a StopToken that can be used to check if a stop has been requested from this StopSource.

◆ operator=() [1/2]

AMINO_CORE_SHARED_DECL StopSource & Amino::StopSource::operator= ( StopSource &&  o)
noexcept

Move assignment operator.

◆ operator=() [2/2]

AMINO_CORE_SHARED_DECL StopSource & Amino::StopSource::operator= ( StopSource const &  o)

Copy assignment operator.

◆ requestStop()

AMINO_CORE_SHARED_DECL void Amino::StopSource::requestStop ( )
noexcept

Request a stop.

Postcondition
All StopToken instances created from this StopSource will report that a stop has been requested.

◆ stopPossible()

AMINO_CORE_SHARED_DECL bool Amino::StopSource::stopPossible ( ) const

Check if a stop can be requested for this StopSource.

Returns false if the StopSource was constructed with a NoStopState_t, true otherwise.

◆ stopRequested()

AMINO_CORE_SHARED_DECL bool Amino::StopSource::stopRequested ( ) const

Check if a stop has been requested for this StopSource.

Friends And Related Function Documentation

◆ operator!=

bool operator!= ( StopSource const &  lhs,
StopSource const &  rhs 
)
friend

Equality operators.

Definition at line 137 of file StopToken.h.

◆ operator==

bool operator== ( StopSource const &  lhs,
StopSource const &  rhs 
)
friend

Equality operators.

Definition at line 134 of file StopToken.h.