OpenDDS  Snapshot(2023/04/28-20:55)
Public Member Functions | List of all members
OpenDDS::DCPS::EventDispatcher Class Referenceabstract

#include <EventDispatcher.h>

Inheritance diagram for OpenDDS::DCPS::EventDispatcher:
Inheritance graph
[legend]
Collaboration diagram for OpenDDS::DCPS::EventDispatcher:
Collaboration graph
[legend]

Public Member Functions

 EventDispatcher ()
 
virtual ~EventDispatcher ()
 
virtual void shutdown (bool immediate=false)=0
 
virtual bool dispatch (EventBase_rch event)=0
 
virtual long schedule (EventBase_rch event, const MonotonicTimePoint &expiration=MonotonicTimePoint::now())=0
 
virtual size_t cancel (long id)=0
 
- Public Member Functions inherited from OpenDDS::DCPS::RcObject
virtual ~RcObject ()
 
virtual void _add_ref ()
 
virtual void _remove_ref ()
 
long ref_count () const
 
WeakObject_get_weak_object () const
 

Additional Inherited Members

- Protected Member Functions inherited from OpenDDS::DCPS::RcObject
 RcObject ()
 

Detailed Description

EventDispatcher is an interface for the scheduling and dispatching of events

Implementations of EventDispatcher will accept reference counted handles to event objects derived from EventBase either for immediate dispatch (dispatch) or for future scheduled dispatch (schedule). Scheduled dispatches return id values which can be used to cancel the dispatch before the scheduled time.

Definition at line 106 of file EventDispatcher.h.

Constructor & Destructor Documentation

◆ EventDispatcher()

OpenDDS::DCPS::EventDispatcher::EventDispatcher ( )

Definition at line 46 of file EventDispatcher.cpp.

47 {
48 }

◆ ~EventDispatcher()

OpenDDS::DCPS::EventDispatcher::~EventDispatcher ( )
virtual

Definition at line 50 of file EventDispatcher.cpp.

References OPENDDS_END_VERSIONED_NAMESPACE_DECL.

51 {
52 }

Member Function Documentation

◆ cancel()

virtual size_t OpenDDS::DCPS::EventDispatcher::cancel ( long  id)
pure virtual

Cancel a scheduled event dispatch.

Parameters
idthe id of the event timer to cancel
Returns
the number of canceled events (0 for failure to cancel, 1 for success)

Implemented in OpenDDS::DCPS::ServiceEventDispatcher.

Referenced by OpenDDS::DCPS::SporadicEvent::cancel(), OpenDDS::DCPS::PeriodicEvent::disable(), and OpenDDS::DCPS::SporadicEvent::schedule().

◆ dispatch()

virtual bool OpenDDS::DCPS::EventDispatcher::dispatch ( EventBase_rch  event)
pure virtual

◆ schedule()

virtual long OpenDDS::DCPS::EventDispatcher::schedule ( EventBase_rch  event,
const MonotonicTimePoint expiration = MonotonicTimePoint::now() 
)
pure virtual

Schedule the future dispatch of an event.

Parameters
eventthe event to dispatch
expirationthe requested dispatch time (no earlier than)
Returns
-1 on a failure, otherwise the timer id for the future dispatch

Implemented in OpenDDS::DCPS::ServiceEventDispatcher.

Referenced by OpenDDS::DCPS::PeriodicEvent::enable(), OpenDDS::DCPS::PeriodicEvent::handle_event_scheduling(), and OpenDDS::DCPS::SporadicEvent::schedule().

◆ shutdown()

virtual void OpenDDS::DCPS::EventDispatcher::shutdown ( bool  immediate = false)
pure virtual

Request shutdown of this EventDispatcher, which prevents sucessful future calls to either dispatch or schedule and cancels all scheduled events.

Parameters
immediateprevent any further dispatches from event queue, otherwise allow current queue to empty

Implemented in OpenDDS::DCPS::ServiceEventDispatcher.

Referenced by OpenDDS::DCPS::TransportImpl::shutdown(), and OpenDDS::DCPS::TransportImpl::~TransportImpl().


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