Aria 2.0.0
C++23 MVVM framework (C++20 minimum) — reactive, coroutine-first, ABI-layered
Loading...
Searching...
No Matches
aria::abi::SlotErased Class Reference

Type-erased callback wrapper. More...

#include <slot.hpp>

Public Types

using Invoker = void (*)(void* state, void* args) noexcept
using Destroyer = void (*)(void* state) noexcept

Public Member Functions

 SlotErased () noexcept=default
 SlotErased (Invoker inv, Destroyer dtor, void *state) noexcept
 ~SlotErased () noexcept
 SlotErased (SlotErased &&o) noexcept
SlotErasedoperator= (SlotErased &&o) noexcept
 SlotErased (const SlotErased &)=delete
SlotErasedoperator= (const SlotErased &)=delete
void invoke (void *args) const noexcept
bool empty () const noexcept

Detailed Description

Type-erased callback wrapper.

Stores a callable that takes a single void* "args" pointer (the caller is responsible for casting).

Why void* instead of std::function?

  • An explicit invoker/destroyer pair keeps allocation and destruction in the module that owns the callable.
  • ABI stable (no template).
  • Templates in core/ wrap this with strong typing.

NOTE: SlotErased is move-only. state_ is an opaque owning pointer; moves transfer ownership by copying the pointer, so no "move" function pointer is required (unlike some small-buffer-optimized designs).

The dtor / move ops are defined out-of-line in slot.cpp so the (trivial) destruction of state_ is not inlined into every TU, which keeps code size small and improves compile times.

Member Typedef Documentation

◆ Invoker

using aria::abi::SlotErased::Invoker = void (*)(void* state, void* args) noexcept

◆ Destroyer

using aria::abi::SlotErased::Destroyer = void (*)(void* state) noexcept

Constructor & Destructor Documentation

◆ SlotErased() [1/4]

aria::abi::SlotErased::SlotErased ( )
defaultnoexcept

◆ SlotErased() [2/4]

aria::abi::SlotErased::SlotErased ( Invoker inv,
Destroyer dtor,
void * state )
inlinenoexcept

◆ ~SlotErased()

aria::abi::SlotErased::~SlotErased ( )
noexcept

◆ SlotErased() [3/4]

aria::abi::SlotErased::SlotErased ( SlotErased && o)
noexcept

◆ SlotErased() [4/4]

aria::abi::SlotErased::SlotErased ( const SlotErased & )
delete

Member Function Documentation

◆ operator=() [1/2]

SlotErased & aria::abi::SlotErased::operator= ( SlotErased && o)
noexcept

◆ operator=() [2/2]

SlotErased & aria::abi::SlotErased::operator= ( const SlotErased & )
delete

◆ invoke()

void aria::abi::SlotErased::invoke ( void * args) const
inlinenoexcept

◆ empty()

bool aria::abi::SlotErased::empty ( ) const
inlinenodiscardnoexcept

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