Callback with explicitly cloned context and creator-module release.
More...
#include <StormByte/safe/callback.hxx>
|
| using | Invoke = Status (*)(void*, const String&) noexcept |
| | Invoke with owned context and borrowed text.
|
| using | Clone = void* (*)(const void*) noexcept |
| | Clone the callback context in its creator module; null reports failure.
|
| using | Release = void (*)(void*) noexcept |
| | Release the context in its creator module exactly once.
|
Callback with explicitly cloned context and creator-module release.
Invoke borrows UTF-8 text for the duration of the call. Retained text must be copied into a Safe owner. Function pointers use the project's default C++ calling convention; all participants must agree. No exceptions may escape Invoke or Release. Keep the callback's module and Base loaded until release. Thread safety and reentrancy are the provider's responsibility. A callback must not destroy itself during invocation. This is not std::function.
◆ Clone
Clone the callback context in its creator module; null reports failure.
◆ Invoke
Invoke with owned context and borrowed text.
◆ Release
Release the context in its creator module exactly once.
◆ Callback() [1/3]
| StormByte::Safe::Callback::Callback |
( |
void * | context, |
|
|
Invoke | invoke, |
|
|
Clone | clone, |
|
|
Release | release ) |
Adopt a non-null context with non-null callbacks.
- Parameters
-
| context | Owned context. |
| invoke | Invocation callback. |
| clone | Context clone callback. |
| release | Destruction callback. |
- Exceptions
-
◆ Callback() [2/3]
| StormByte::Safe::Callback::Callback |
( |
const Callback & | other | ) |
|
|
default |
Deep-copy the context through its creator-module callback.
- Parameters
-
- Exceptions
-
◆ Callback() [3/3]
| StormByte::Safe::Callback::Callback |
( |
Callback && | other | ) |
|
|
noexcept |
Transfer context; source becomes empty.
- Parameters
-
◆ ~Callback()
| StormByte::Safe::Callback::~Callback |
( |
| ) |
|
|
noexcept |
Invoke the creator-module release callback.
◆ Call()
| Status StormByte::Safe::Callback::Call |
( |
const String & | value | ) |
const |
|
noexcept |
Invoke with borrowed UTF-8 text.
- Parameters
-
| value | Text valid for this call. |
- Returns
- Provider status, or Missing after move.
◆ HasValue()
| bool StormByte::Safe::Callback::HasValue |
( |
| ) |
const |
|
noexcept |
Test whether a context is held.
- Returns
- False after move.
◆ operator=() [1/2]
Release old context and transfer.
- Parameters
-
- Returns
- This callback.
◆ operator=() [2/2]
Deep-copy the context with the strong guarantee.
- Parameters
-
- Returns
- This callback.
- Exceptions
-
The documentation for this class was generated from the following file: