SyncEvent< M, C > Class Template Reference

Class used to wrap each event object type for a given receiver. More...

#include <Syncmsg.h>

Inheritance diagram for SyncEvent< M, C >:

Public Member Functions

 SyncEvent ()
 Constructor within another object.
 
 SyncEvent (M *msg, C *target)
 Constructor takes message object to be wrapped.
 
virtual ~SyncEvent ()
 Destructor must be virtual.
 
void Init (C *rcvr)
 Set the target.
 
virtual void Deliver ()
 Deliver this message to the receiver.
 
virtual bool ShouldDelete () const
 Can delete this object.
 
void Send (M &data)
 Send data now.
 
void Send (const timespec *when, M &data)
 Send using timespec.
 
void Sendms (unsigned millisecs, M &data)
 Send in interval (milliseconds)
 
void SendAtExit (M &data)
 Send when terminating.
 

Detailed Description

template<class M, class C>
class SyncEvent< M, C >

Class used to wrap each event object type for a given receiver.

Definition at line 30 of file Syncmsg.h.

Constructor & Destructor Documentation

◆ SyncEvent() [1/2]

template<class M , class C >
SyncEvent< M, C >::SyncEvent ( )
inline

Constructor within another object.

Definition at line 38 of file Syncmsg.h.

38: _target(0), _onheap(0) {}

◆ SyncEvent() [2/2]

template<class M , class C >
SyncEvent< M, C >::SyncEvent ( M *  msg,
C *  target 
)
inline

Constructor takes message object to be wrapped.

Definition at line 41 of file Syncmsg.h.

41 :
42 _msg (*msg), _target(target), _onheap(true) { }

◆ ~SyncEvent()

template<class M , class C >
virtual SyncEvent< M, C >::~SyncEvent ( )
inlinevirtual

Destructor must be virtual.

Definition at line 45 of file Syncmsg.h.

45{ }

Member Function Documentation

◆ Init()

template<class M , class C >
void SyncEvent< M, C >::Init ( C *  rcvr)
inline

Set the target.

Definition at line 48 of file Syncmsg.h.

48 {
49 SetReceiver (rcvr);
50 _target = rcvr;
51 }

Referenced by Poll::User::User().

◆ Deliver()

template<class M , class C >
virtual void SyncEvent< M, C >::Deliver ( )
inlinevirtual

Deliver this message to the receiver.

Definition at line 54 of file Syncmsg.h.

54 {
55 _target->actualDeliver (&_msg);
56 }

◆ ShouldDelete()

template<class M , class C >
virtual bool SyncEvent< M, C >::ShouldDelete ( ) const
inlinevirtual

Can delete this object.

Definition at line 59 of file Syncmsg.h.

59{ return _onheap; }

◆ Send() [1/2]

template<class M , class C >
void SyncEvent< M, C >::Send ( M &  data)
inline

Send data now.

Definition at line 62 of file Syncmsg.h.

62 {
63 _msg = data;
64 ::Event::Manager::GetManager()->Queue (this);
65 }

◆ Send() [2/2]

template<class M , class C >
void SyncEvent< M, C >::Send ( const timespec *  when,
M &  data 
)
inline

Send using timespec.

Definition at line 68 of file Syncmsg.h.

68 {
69 _msg = data;
70
71 ::Event::Manager::GetManager()->QueueAt (this, when);
72 }

◆ Sendms()

template<class M , class C >
void SyncEvent< M, C >::Sendms ( unsigned  millisecs,
M &  data 
)
inline

Send in interval (milliseconds)

Definition at line 75 of file Syncmsg.h.

75 {
76 _msg = data;
77
78 ::Event::Manager::GetManager()->QueueAt (this, millisecs);
79 }

◆ SendAtExit()

template<class M , class C >
void SyncEvent< M, C >::SendAtExit ( M &  data)
inline

Send when terminating.

Definition at line 82 of file Syncmsg.h.

82 {
83 _msg = data;
84 ::Event::Manager::GetManager()->QueueAtExit (this);
85 }

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

All rights reserved © 2002 - 2024 Isode Ltd.