SmartSoft Component-Developer API
Public Member Functions | List of all members
Smart::IEventTestHandler< ActivationType, EventType, UpdateType > Class Template Referenceabstract

Condition Test Handler (decides at server whether event fires or not). More...

#include <smartIEventServerPattern_T.h>

Public Member Functions

virtual ~IEventTestHandler ()=default
 
virtual bool testEvent (ActivationType &p, EventType &e, const UpdateType &s)=0
 This is the test method which decides whether the event fires or not. More...
 
virtual void onActivation (const ActivationType &p)
 This is a hook which is called whenever an event gets activated. More...
 

Detailed Description

template<class ActivationType, class EventType, class UpdateType = EventType>
class Smart::IEventTestHandler< ActivationType, EventType, UpdateType >

Condition Test Handler (decides at server whether event fires or not).

Constructor & Destructor Documentation

◆ ~IEventTestHandler()

template<class ActivationType , class EventType , class UpdateType = EventType>
virtual Smart::IEventTestHandler< ActivationType, EventType, UpdateType >::~IEventTestHandler ( )
virtualdefault

Member Function Documentation

◆ onActivation()

template<class ActivationType , class EventType , class UpdateType = EventType>
virtual void Smart::IEventTestHandler< ActivationType, EventType, UpdateType >::onActivation ( const ActivationType &  p)
inlinevirtual

This is a hook which is called whenever an event gets activated.

Each time a client activates an event, this hook is called with the corresponding parameter. The overloading of this hook is optional. Blocking calls within this hook should be avoided.

Parameters
pevent activation parameter set

◆ testEvent()

template<class ActivationType , class EventType , class UpdateType = EventType>
virtual bool Smart::IEventTestHandler< ActivationType, EventType, UpdateType >::testEvent ( ActivationType &  p,
EventType &  e,
const UpdateType &  s 
)
pure virtual

This is the test method which decides whether the event fires or not.

As soon as the EventServer::put() is called, the pattern calls EventTestHandler::testEvent() to decide for each event activation parameter set individually whether this parameter set requires the event to fire.

The parameters p are provided by the client individually with every event activation, the current state s is provided via the EventServer::put() method when the server wants the event conditions to be checked.

The test method has to be provided by the user. In case the event fires, one can return data in the event answer object e.

Attention: this function will be called within the same context as the EventServer::put()-method. Therefore pay attention to blocking calls etc.

Parameters
pactivation parameter set to be checked (Communication Object). Can be modified in the test event handler to store state information in the parameter object (for example needed to easily implement an event which only fires with state changes)
eevent answer object (Communication Object) which returns data in case of firing to the client which is responsible for this event activation
scurrent information against which the testEvent() checks the parameters p
Returns
status code
  • true: fire event (predicate true)
  • false: do not fire event (predicate false)

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