DynExp
Highly flexible laboratory automation for dynamically changing experiments.
DynExp::DefaultEvent< ReceiverType, ArgTupleType > Class Template Reference

Describes an event which consists of a receiver's member function and a set of arguments to call this function with. The first argument is expected to be of type ModuleInstance*. This argument is not included in ArgTupleType). More...

+ Inheritance diagram for DynExp::DefaultEvent< ReceiverType, ArgTupleType >:

Classes

struct  EventFuncTraits
 Helper struct to allow accessing elements within ArgTupleType. More...
 

Public Types

using EventFuncPtrType = typename InstantiatedEventFuncTraitsType::EventFuncPtrType
 Signature of an event function. Pointer to ModuleInstance to be passed as parameter instead of reference to render function pointers storable in Util::CallableMemberWrapper (with nullptr as default argument) More...
 
using EventFuncType = typename InstantiatedEventFuncTraitsType::EventFuncType
 Type of a Util::CallableMemberWrapper to store the event. More...
 

Public Member Functions

 DefaultEvent (EventFuncType EventFunc) noexcept
 Constructs a DefaultEvent instance. More...
 
virtual ~DefaultEvent ()
 
- Public Member Functions inherited from DynExp::EventBase
 EventBase ()=default
 
virtual ~EventBase ()=0
 
void Invoke (ModuleInstance &Instance) const
 Invokes the event passing the receiving module's instance reference to it. More...
 

Private Types

using ArgTupleIndexSequenceType = decltype(std::make_index_sequence< std::tuple_size_v< ArgTupleType > >())
 Index sequence for the (pseudo-)instantiation of EventFuncTraits. More...
 
using InstantiatedEventFuncTraitsType = decltype(DefaultEvent< ReceiverType, ArgTupleType >::MakeEventFuncTraits(std::declval< ArgTupleIndexSequenceType >()))
 Type of the instantiated EventFuncTraits - not actually instantiating it. More...
 

Private Member Functions

virtual void InvokeChild (ModuleInstance &Instance) const override
 Invokes the event passing the receiving module's instance reference to it. More...
 

Static Private Member Functions

template<size_t... Indices>
constexpr static auto MakeEventFuncTraits (std::index_sequence< Indices... >)
 Instantiates EventFuncTraits. This function is not meant to be called. It is used for type deduction only. More...
 

Private Attributes

const EventFuncType EventFunc
 Util::CallableMemberWrapper to store the event receiver, the event function, and its arguments. More...
 

Detailed Description

template<typename ReceiverType, typename ArgTupleType>
class DynExp::DefaultEvent< ReceiverType, ArgTupleType >

Describes an event which consists of a receiver's member function and a set of arguments to call this function with. The first argument is expected to be of type ModuleInstance*. This argument is not included in ArgTupleType).

Template Parameters
ReceiverTypeType of the receiving module.
ArgTupleTypeType of a tuple of the arguments' types the receiver's member function expects.

Definition at line 94 of file Module.h.

Member Typedef Documentation

◆ ArgTupleIndexSequenceType

template<typename ReceiverType , typename ArgTupleType >
using DynExp::DefaultEvent< ReceiverType, ArgTupleType >::ArgTupleIndexSequenceType = decltype(std::make_index_sequence<std::tuple_size_v<ArgTupleType> >())
private

Index sequence for the (pseudo-)instantiation of EventFuncTraits.

Definition at line 130 of file Module.h.

◆ EventFuncPtrType

template<typename ReceiverType , typename ArgTupleType >
using DynExp::DefaultEvent< ReceiverType, ArgTupleType >::EventFuncPtrType = typename InstantiatedEventFuncTraitsType::EventFuncPtrType

Signature of an event function. Pointer to ModuleInstance to be passed as parameter instead of reference to render function pointers storable in Util::CallableMemberWrapper (with nullptr as default argument)

Definition at line 138 of file Module.h.

◆ EventFuncType

template<typename ReceiverType , typename ArgTupleType >
using DynExp::DefaultEvent< ReceiverType, ArgTupleType >::EventFuncType = typename InstantiatedEventFuncTraitsType::EventFuncType

Type of a Util::CallableMemberWrapper to store the event.

Definition at line 139 of file Module.h.

◆ InstantiatedEventFuncTraitsType

template<typename ReceiverType , typename ArgTupleType >
using DynExp::DefaultEvent< ReceiverType, ArgTupleType >::InstantiatedEventFuncTraitsType = decltype(DefaultEvent<ReceiverType, ArgTupleType>::MakeEventFuncTraits(std::declval<ArgTupleIndexSequenceType>()))
private

Type of the instantiated EventFuncTraits - not actually instantiating it.

Definition at line 135 of file Module.h.

Constructor & Destructor Documentation

◆ DefaultEvent()

template<typename ReceiverType , typename ArgTupleType >
DynExp::DefaultEvent< ReceiverType, ArgTupleType >::DefaultEvent ( EventFuncType  EventFunc)
inlinenoexcept

Constructs a DefaultEvent instance.

Parameters
EventFuncUtil::CallableMemberWrapper to store the event receiver, the event function, and its arguments.

Definition at line 145 of file Module.h.

◆ ~DefaultEvent()

template<typename ReceiverType , typename ArgTupleType >
virtual DynExp::DefaultEvent< ReceiverType, ArgTupleType >::~DefaultEvent ( )
inlinevirtual

Definition at line 147 of file Module.h.

Member Function Documentation

◆ InvokeChild()

template<typename ReceiverType , typename ArgTupleType >
virtual void DynExp::DefaultEvent< ReceiverType, ArgTupleType >::InvokeChild ( ModuleInstance Instance) const
inlineoverrideprivatevirtual

Invokes the event passing the receiving module's instance reference to it.

Parameters
InstanceModule instance handle.

Implements DynExp::EventBase.

Definition at line 150 of file Module.h.

◆ MakeEventFuncTraits()

template<typename ReceiverType , typename ArgTupleType >
template<size_t... Indices>
constexpr static auto DynExp::DefaultEvent< ReceiverType, ArgTupleType >::MakeEventFuncTraits ( std::index_sequence< Indices... >  )
inlinestaticconstexprprivate

Instantiates EventFuncTraits. This function is not meant to be called. It is used for type deduction only.

Template Parameters
...IndicesIndex sequence for the (pseudo-)instantiation of EventFuncTraits.
Returns
Returns an instance of EventFuncTraits.

Definition at line 125 of file Module.h.

Member Data Documentation

◆ EventFunc

template<typename ReceiverType , typename ArgTupleType >
const EventFuncType DynExp::DefaultEvent< ReceiverType, ArgTupleType >::EventFunc
private

Util::CallableMemberWrapper to store the event receiver, the event function, and its arguments.

Definition at line 155 of file Module.h.


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