asio Namespace Reference

Space-ng SDK: sol3::asio Namespace Reference
Space-ng SDK
sol3::asio Namespace Reference

Support safely capturing this in ASIO completion handlers. More...

Namespaces

 detail
 

Typedefs

using Strand = boost::asio::strand< boost::asio::io_context::executor_type >
 

Functions

template<typename TClass , typename TCallable >
auto weakHandler (TClass *obj, TCallable &&callable)
 
template<typename TExecutor , typename TClass , typename TFunc >
void weakDispatch (TExecutor const &ex, TClass *obj, TFunc &&func)
 
template<typename TExecutor , typename TClass , typename TMemberFn , typename... TArgs>
void weakDispatch (TExecutor const &ex, TClass *obj, TMemberFn method, TArgs &&... args)
 
template<typename TExecutor , typename TClass , typename TFunc >
void weakPost (TExecutor const &ex, TClass *obj, TFunc &&func)
 
template<typename TExecutor , typename TClass , typename TMemberFn , typename... TArgs>
void weakPost (TExecutor const &ex, TClass *obj, TMemberFn method, TArgs &&... args)
 
template<typename TExecutor , typename TClass , typename TFunc >
decltype(auto) weakBindExecutor (TExecutor const &ex, TClass *obj, TFunc &&func)
 
template<typename TExecutor , typename TClass , typename TMemberFn , typename... TArgs>
decltype(auto) weakBindExecutor (TExecutor const &ex, TClass *obj, TMemberFn method, TArgs &&... args)
 
template<typename TClass , typename TCallable >
auto handler (TClass *obj, TCallable &&callable)
 
template<typename TExecutor , typename TClass , typename TFunc >
void dispatch (TExecutor const &ex, TClass *obj, TFunc &&func)
 
template<typename TExecutor , typename TClass , typename TMemberFn , typename... TArgs>
void dispatch (TExecutor const &ex, TClass *obj, TMemberFn method, TArgs &&... args)
 
template<typename TExecutor , typename TClass , typename TFunc >
void post (TExecutor const &ex, TClass *obj, TFunc &&func)
 
template<typename TExecutor , typename TClass , typename TMemberFn , typename... TArgs>
void post (TExecutor const &ex, TClass *obj, TMemberFn method, TArgs &&... args)
 
template<typename TExecutor , typename TClass , typename TFunc >
decltype(auto) bindExecutor (TExecutor const &ex, TClass *obj, TFunc &&func)
 
template<typename TExecutor , typename TClass , typename TMemberFn , typename... TArgs>
decltype(auto) bindExecutor (TExecutor const &ex, TClass *obj, TMemberFn method, TArgs &&... args)
 

Detailed Description

Support safely capturing this in ASIO completion handlers.

There are two families of helper functions:

  • weakPost / weakDispatch: Safely drops the callback if the object is dead.
  • post / dispatch: Strong capture. Keeps object alive for guaranteed execution.

Typedef Documentation

◆ Strand

using sol3::asio::Strand = typedef boost::asio::strand<boost::asio::io_context::executor_type>

Function Documentation

◆ bindExecutor() [1/2]

template<typename TExecutor , typename TClass , typename TFunc >
decltype(auto) sol3::asio::bindExecutor ( TExecutor const &  ex,
TClass *  obj,
TFunc &&  func 
)

◆ bindExecutor() [2/2]

template<typename TExecutor , typename TClass , typename TMemberFn , typename... TArgs>
decltype(auto) sol3::asio::bindExecutor ( TExecutor const &  ex,
TClass *  obj,
TMemberFn  method,
TArgs &&...  args 
)

◆ dispatch() [1/2]

template<typename TExecutor , typename TClass , typename TFunc >
void sol3::asio::dispatch ( TExecutor const &  ex,
TClass *  obj,
TFunc &&  func 
)

◆ dispatch() [2/2]

template<typename TExecutor , typename TClass , typename TMemberFn , typename... TArgs>
void sol3::asio::dispatch ( TExecutor const &  ex,
TClass *  obj,
TMemberFn  method,
TArgs &&...  args 
)

◆ handler()

template<typename TClass , typename TCallable >
auto sol3::asio::handler ( TClass *  obj,
TCallable &&  callable 
)

◆ post() [1/2]

template<typename TExecutor , typename TClass , typename TFunc >
void sol3::asio::post ( TExecutor const &  ex,
TClass *  obj,
TFunc &&  func 
)

◆ post() [2/2]

template<typename TExecutor , typename TClass , typename TMemberFn , typename... TArgs>
void sol3::asio::post ( TExecutor const &  ex,
TClass *  obj,
TMemberFn  method,
TArgs &&...  args 
)

◆ weakBindExecutor() [1/2]

template<typename TExecutor , typename TClass , typename TFunc >
decltype(auto) sol3::asio::weakBindExecutor ( TExecutor const &  ex,
TClass *  obj,
TFunc &&  func 
)

◆ weakBindExecutor() [2/2]

template<typename TExecutor , typename TClass , typename TMemberFn , typename... TArgs>
decltype(auto) sol3::asio::weakBindExecutor ( TExecutor const &  ex,
TClass *  obj,
TMemberFn  method,
TArgs &&...  args 
)

◆ weakDispatch() [1/2]

template<typename TExecutor , typename TClass , typename TFunc >
void sol3::asio::weakDispatch ( TExecutor const &  ex,
TClass *  obj,
TFunc &&  func 
)

◆ weakDispatch() [2/2]

template<typename TExecutor , typename TClass , typename TMemberFn , typename... TArgs>
void sol3::asio::weakDispatch ( TExecutor const &  ex,
TClass *  obj,
TMemberFn  method,
TArgs &&...  args 
)

◆ weakHandler()

template<typename TClass , typename TCallable >
auto sol3::asio::weakHandler ( TClass *  obj,
TCallable &&  callable 
)

◆ weakPost() [1/2]

template<typename TExecutor , typename TClass , typename TFunc >
void sol3::asio::weakPost ( TExecutor const &  ex,
TClass *  obj,
TFunc &&  func 
)

◆ weakPost() [2/2]

template<typename TExecutor , typename TClass , typename TMemberFn , typename... TArgs>
void sol3::asio::weakPost ( TExecutor const &  ex,
TClass *  obj,
TMemberFn  method,
TArgs &&...  args 
)