stmm-games-doc  0.32.0
Public Member Functions | List of all members
stmi::BasicDeviceManager::ListenerData Class Referencefinal

Helper class that represents a listener. More...

Public Member Functions

 ListenerData () noexcept
 
bool handleEventCallIf (int32_t nClassTypeIdx, const shared_ptr< Event > &refEvent) const noexcept
 Send event to the listener with callif evaluation. More...
 
uint64_t getAddedTimeStamp () const noexcept
 The time stamp the listener was added to the device manager. More...
 
shared_ptr< CallIfgetCallIf () const noexcept
 The callif associated with the listener. More...
 
shared_ptr< CallIfgetCallIf (int32_t nClassTypeIdx) const noexcept
 The simplified callif for one of the supported event classes. More...
 
template<class ED >
void getExtraData (ED *&p0ExtraData) noexcept
 Get listener's extra data. More...
 

Detailed Description

Helper class that represents a listener.

Constructor & Destructor Documentation

◆ ListenerData()

stmi::BasicDeviceManager::ListenerData::ListenerData ( )
inlinenoexcept

Member Function Documentation

◆ getAddedTimeStamp()

uint64_t stmi::BasicDeviceManager::ListenerData::getAddedTimeStamp ( ) const
inlinenoexcept

The time stamp the listener was added to the device manager.

Returns
In nanoseconds from epoch.

◆ getCallIf() [1/2]

shared_ptr<CallIf> stmi::BasicDeviceManager::ListenerData::getCallIf ( ) const
inlinenoexcept

The callif associated with the listener.

Returns
If null means always send event to listener (
See also
class CallIfTrue).

◆ getCallIf() [2/2]

shared_ptr<CallIf> stmi::BasicDeviceManager::ListenerData::getCallIf ( int32_t  nClassTypeIdx) const
inlinenoexcept

The simplified callif for one of the supported event classes.

Parameters
nClassTypeIdxThe index of the class.
See also
getEventClassIndex(const Event::Class&) const
Returns
If null means always send event to listener (
See also
class CallIfTrue).

◆ getExtraData()

template<class ED >
void stmi::BasicDeviceManager::ListenerData::getExtraData ( ED *&  p0ExtraData)
inlinenoexcept

Get listener's extra data.

The first time this function is called an instance of type ED is created with its default constructor. Further calls must have the same type ED and will return the same instance.

ED must be a subclass of ListenerExtraData and should override method ListenerExtraData::reset() to initialize the data.

Parameters
p0ExtraDataThe pointer to the data.

◆ handleEventCallIf()

bool stmi::BasicDeviceManager::ListenerData::handleEventCallIf ( int32_t  nClassTypeIdx,
const shared_ptr< Event > &  refEvent 
) const
noexcept

Send event to the listener with callif evaluation.

The event is sent only if callif allows it.

Parameters
nClassTypeIdxThe index of the class. If you pass -1 it calls getEventClassIndex(const Event::Class&) const.
refEventThe event to send.
Returns
Whether the event was sent.