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

#include <EventDispatcher.h>

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

Public Types

typedef void(Delegate::* PMF) ()
 

Public Member Functions

 PmfEvent (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::PmfEvent< Delegate >

PmfEvent is a helper class for adapting void member funtions of existing classes into dispatchable events

Definition at line 49 of file EventDispatcher.h.

Member Typedef Documentation

◆ PMF

template<typename Delegate >
typedef void(Delegate::* OpenDDS::DCPS::PmfEvent< Delegate >::PMF) ()

Definition at line 51 of file EventDispatcher.h.

Constructor & Destructor Documentation

◆ PmfEvent()

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

Definition at line 53 of file EventDispatcher.h.

54  : delegate_(delegate)
55  , function_(function)
56  {}
WeakRcHandle< Delegate > delegate_

Member Function Documentation

◆ handle_event()

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

Called when the event is dispatched by an EventDispatcher.

Implements OpenDDS::DCPS::EventBase.

Definition at line 58 of file EventDispatcher.h.

59  {
60  RcHandle<Delegate> handle = delegate_.lock();
61  if (handle) {
62  ((*handle).*function_)();
63  }
64  }
RcHandle< T > lock() const
Definition: RcObject.h:188
WeakRcHandle< Delegate > delegate_

Member Data Documentation

◆ delegate_

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

Definition at line 67 of file EventDispatcher.h.

◆ function_

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

Definition at line 68 of file EventDispatcher.h.


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