Go to the documentation of this file.
14 #include <type_traits>
22 template <
typename IFace>
26 std::aligned_storage_t<64 - 2 *
sizeof(
void* )>
m_storage;
32 template <
typename Ret,
typename... Args,
typename = std::enable_if_t<std::is_base_of_v<IFace, Ret>>>
33 Box( std::in_place_type_t<Ret>, Args&&...
args ) {
34 if constexpr (
sizeof( Ret ) <=
sizeof(
m_storage ) ) {
36 m_destruct = [](
void* ptr ) {
static_cast<Ret*
>( ptr )->~Ret(); };
38 m_ptr =
new Ret{ std::forward<Args>(
args )... };
39 m_destruct = [](
void* ptr ) {
delete static_cast<Ret*
>( ptr ); };
51 operator IFace
const&()
const {
return *
m_ptr; }
55 template <
typename IFace>
61 template <
typename IFace>
94 template <
typename IFace>
Box & operator=(const Box &)=delete
Base class to be used to extend an interface.
Box & operator=(Box &&)=delete
State
Allowed states for classes implementing the state machine (ApplicationMgr, Algorithm,...
DeclareInterfaceID(IBinder, 1, 0)
Base class used to implement the interfaces.
Box(std::in_place_type_t< Ret >, Args &&... args)
virtual Box< IFace > bind(const EventContext &ctx) const =0
std::aligned_storage_t< 64 - 2 *sizeof(void *)> m_storage
constexpr static const auto FAILURE
void(* m_destruct)(void *)