Sparkle 0.0.1
Loading...
Searching...
No Matches
spk::TContractProvider< TParameterTypes >::Contract Class Reference

Handle to a subscribed job that can be resigned or triggered. More...

#include <spk_contract_provider.hpp>

Collaboration diagram for spk::TContractProvider< TParameterTypes >::Contract:
Collaboration graph

Public Types

using Job = std::function<void(TParameterTypes...)>
 Callback signature accepted by the provider.

Public Member Functions

 Contract (const Contract &)=delete
Contractoperator= (const Contract &)=delete
 Contract (Contract &&p_other) noexcept
 Move-constructs the contract, transferring ownership.
Contractoperator= (Contract &&p_other) noexcept
 Move-assigns the contract, resigning any current subscription.
 ~Contract ()
 Resigns the contract upon destruction when still subscribed.
bool isValid () const
 Checks whether the contract currently owns a valid job.
void resign ()
 Unsubscribes the contract and drops ownership.
void relinquish ()
 Transfers ownership back to the provider without immediate unsubscribe.
void trigger (TParameterTypes... p_args) const
 Directly invokes the job if valid.

Friends

class TContractProvider< TParameterTypes... >

Detailed Description

template<typename... TParameterTypes>
class spk::TContractProvider< TParameterTypes >::Contract

Handle to a subscribed job that can be resigned or triggered.

Constructor & Destructor Documentation

◆ Contract()

template<typename... TParameterTypes>
spk::TContractProvider< TParameterTypes >::Contract::Contract ( Contract && p_other)
inlinenoexcept

Move-constructs the contract, transferring ownership.

Parameters
p_otherSource contract to steal from.

Member Function Documentation

◆ isValid()

template<typename... TParameterTypes>
bool spk::TContractProvider< TParameterTypes >::Contract::isValid ( ) const
inline

Checks whether the contract currently owns a valid job.

Returns
true when still subscribed.
Here is the caller graph for this function:

◆ operator=()

template<typename... TParameterTypes>
Contract & spk::TContractProvider< TParameterTypes >::Contract::operator= ( Contract && p_other)
inlinenoexcept

Move-assigns the contract, resigning any current subscription.

Parameters
p_otherSource contract to steal from.
Returns
*this after transfer.
Here is the call graph for this function:

◆ relinquish()

template<typename... TParameterTypes>
void spk::TContractProvider< TParameterTypes >::Contract::relinquish ( )
inline

Transfers ownership back to the provider without immediate unsubscribe.

Exceptions
std::runtime_errorif already resigned.
Here is the call graph for this function:

◆ resign()

template<typename... TParameterTypes>
void spk::TContractProvider< TParameterTypes >::Contract::resign ( )
inline

Unsubscribes the contract and drops ownership.

Exceptions
std::runtime_errorif already resigned.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ trigger()

template<typename... TParameterTypes>
void spk::TContractProvider< TParameterTypes >::Contract::trigger ( TParameterTypes... p_args) const
inline

Directly invokes the job if valid.

Parameters
p_argsArguments forwarded to the job.
Here is the call graph for this function:

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