Handle to a subscribed job that can be resigned or triggered.
More...
#include <spk_contract_provider.hpp>
|
|
using | Job = std::function<void(TParameterTypes...)> |
| | Callback signature accepted by the provider.
|
|
|
| Contract (const Contract &)=delete |
|
Contract & | operator= (const Contract &)=delete |
| | Contract (Contract &&p_other) noexcept |
| | Move-constructs the contract, transferring ownership.
|
| Contract & | operator= (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.
|
|
|
class | TContractProvider< TParameterTypes... > |
template<typename... TParameterTypes>
class spk::TContractProvider< TParameterTypes >::Contract
Handle to a subscribed job that can be resigned or triggered.
◆ Contract()
template<typename... TParameterTypes>
Move-constructs the contract, transferring ownership.
- Parameters
-
| p_other | Source contract to steal from. |
◆ isValid()
template<typename... TParameterTypes>
Checks whether the contract currently owns a valid job.
- Returns
- true when still subscribed.
◆ operator=()
template<typename... TParameterTypes>
Move-assigns the contract, resigning any current subscription.
- Parameters
-
| p_other | Source contract to steal from. |
- Returns
- *this after transfer.
◆ relinquish()
template<typename... TParameterTypes>
Transfers ownership back to the provider without immediate unsubscribe.
- Exceptions
-
| std::runtime_error | if already resigned. |
◆ resign()
template<typename... TParameterTypes>
Unsubscribes the contract and drops ownership.
- Exceptions
-
| std::runtime_error | if already resigned. |
◆ trigger()
template<typename... TParameterTypes>
Directly invokes the job if valid.
- Parameters
-
| p_args | Arguments forwarded to the job. |
The documentation for this class was generated from the following file: