OpenDDS  Snapshot(2023/04/07-19:43)
Public Types | Public Member Functions | Private Attributes | List of all members
OpenDDS::DCPS::PmfNowEvent< Delegate > Class Template Reference

#include <EventDispatcher.h>

Inheritance diagram for OpenDDS::DCPS::PmfNowEvent< Delegate >:
Inheritance graph
[legend]
Collaboration diagram for OpenDDS::DCPS::PmfNowEvent< Delegate >:
Collaboration graph
[legend]

Public Types

typedef void(Delegate::* PMF) (const MonotonicTimePoint &)
 

Public Member Functions

 PmfNowEvent (RcHandle< Delegate > delegate, PMF function)
 
void handle_event ()
 Called when the event is dispatched by an EventDispatcher. More...
 
- Public Member Functions inherited from OpenDDS::DCPS::EventBase
virtual ~EventBase ()
 
virtual void handle_error ()
 Only called when an exception is caught during handle_event. More...
 
virtual void handle_cancel ()
 
void operator() ()
 
- 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
 

Private Attributes

WeakRcHandle< Delegatedelegate_
 
PMF function_
 

Additional Inherited Members

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

Detailed Description

template<typename Delegate>
class OpenDDS::DCPS::PmfNowEvent< Delegate >

PmfNowEvent is a helper class for adapting MonotonicTimePoint-accepting member funtions of existing classes into dispatchable events. (c.f. PmfEvent)

Definition at line 76 of file EventDispatcher.h.

Member Typedef Documentation

◆ PMF

template<typename Delegate >
typedef void(Delegate::* OpenDDS::DCPS::PmfNowEvent< Delegate >::PMF) (const MonotonicTimePoint &)

Definition at line 78 of file EventDispatcher.h.

Constructor & Destructor Documentation

◆ PmfNowEvent()

template<typename Delegate >
OpenDDS::DCPS::PmfNowEvent< Delegate >::PmfNowEvent ( RcHandle< Delegate delegate,
PMF  function 
)
inline

Definition at line 80 of file EventDispatcher.h.

81  : delegate_(delegate)
82  , function_(function)
83  {}
WeakRcHandle< Delegate > delegate_

Member Function Documentation

◆ handle_event()

template<typename Delegate >
void OpenDDS::DCPS::PmfNowEvent< Delegate >::handle_event ( )
inlinevirtual

Called when the event is dispatched by an EventDispatcher.

Implements OpenDDS::DCPS::EventBase.

Definition at line 85 of file EventDispatcher.h.

References OpenDDS::DCPS::TimePoint_T< MonotonicClock >::now().

86  {
87  RcHandle<Delegate> handle = delegate_.lock();
88  if (handle) {
89  ((*handle).*function_)(MonotonicTimePoint::now());
90  }
91  }
WeakRcHandle< Delegate > delegate_
static TimePoint_T< MonotonicClock > now()
Definition: TimePoint_T.inl:41
RcHandle< T > lock() const
Definition: RcObject.h:188

Member Data Documentation

◆ delegate_

template<typename Delegate >
WeakRcHandle<Delegate> OpenDDS::DCPS::PmfNowEvent< Delegate >::delegate_
private

Definition at line 94 of file EventDispatcher.h.

◆ function_

template<typename Delegate >
PMF OpenDDS::DCPS::PmfNowEvent< Delegate >::function_
private

Definition at line 95 of file EventDispatcher.h.


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