senf::ppi::EventImplementation< EventType > Class Template Reference

Event implementation base class. More...

#include <senf/PPI/Events.hh>

Inheritance diagram for senf::ppi::EventImplementation< EventType >:

Public Types

typedef EventType Event
 
typedef detail::EventArgType< EventType >::type EventArg
 

Public Member Functions

module::Modulemodule () const
 Module in which the event is registered. More...
 
EventManagermanager () const
 EventManager of the event. More...
 
- Public Member Functions inherited from senf::ppi::EventDescriptor
virtual ~EventDescriptor ()
 
bool enabled () const
 Check, whether the event is currently enabled. More...
 
void enabled (bool v)
 Enable or disable the event. More...
 

Protected Member Functions

 EventImplementation ()
 
- Protected Member Functions inherited from senf::ppi::EventDescriptor
 EventDescriptor ()
 
- Protected Member Functions inherited from senf::ppi::EventImplementationHelper< EventType, EventImplementation< EventType > >
void callback (EventArg event, ClockService::clock_type time)
 Forward event to user callback. More...
 
void callback (EventArg event)
 Forward event to user callback. More...
 

Additional Inherited Members

- Protected Types inherited from senf::ppi::EventImplementationHelper< EventType, EventImplementation< EventType > >
typedef detail::EventArgType< EventType >::type EventArg
 

Detailed Description

template<class EventType>
class senf::ppi::EventImplementation< EventType >

Event implementation base class.

EventImplementation provides the base-class for all Event implementations.

class SomeEvent : public EventImplementation<SomeEventArg>
{
public:
SomeEvent() {}
private:
virtual void v_enable() {
// register cb() to be called when the event occurs
}
virtual void v_disable() {
// unregister cb()
}
void cb() {
// Build event argument
SomeEventArg arg (...);
// Call the event callback
callback(arg);
}
};
    Every event needs to implement v_enable() and v_disable(). v_enable() should register some
    member (in the example \c cb() ) to be called whenever the event occurs, while v_disable()
    should unregister it.

    The \a EventType argument to EventImplementation defines the type of argument passed to the
    user callback. It defaults to \c void. . This user callback is called from within the
    registered member (e.g. \c cb() ) by calling the inherited callback() member. This member
    takes an \a EventType reference as argument which will be forwarded to the user callback. If
    available, you should also provide the \e expected event time as a second argument.

Definition at line 169 of file Events.hh.

Member Typedef Documentation

◆ Event

template<class EventType>
typedef EventType senf::ppi::EventImplementation< EventType >::Event

Definition at line 174 of file Events.hh.

◆ EventArg

template<class EventType>
typedef detail::EventArgType<EventType>::type senf::ppi::EventImplementation< EventType >::EventArg

Definition at line 175 of file Events.hh.

Constructor & Destructor Documentation

◆ EventImplementation()

template<class EventType>
senf::ppi::EventImplementation< EventType >::EventImplementation ( )
protected

Member Function Documentation

◆ manager()

template<class EventType>
EventManager& senf::ppi::EventImplementation< EventType >::manager ( ) const

EventManager of the event.

◆ module()

template<class EventType>
module::Module& senf::ppi::EventImplementation< EventType >::module ( ) const

Module in which the event is registered.


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