14#include "messaging/message.h"
85 this->
thread = handlerThread;
109template<
class MESSAGETYPE>
inline void
118template<
class MESSAGETYPE>
inline void
127template<
class MESSAGETYPE>
inline void
136template<
class MESSAGETYPE>
inline bool
145template<
class MESSAGETYPE>
inline void
The common base class of Nebula.
Definition refcounted.h:38
The AsyncPort class runs its handlers in a separate thread, so that message processing happens in a s...
Definition asyncport.h:22
void Send(const Ptr< MESSAGETYPE > &msg)
send an asynchronous message to the port
Definition asyncport.h:110
void SendWaitInternal(const Ptr< Message > &msg)
send a message and wait for completion
Definition asyncport.cc:112
bool Peek(const Ptr< MESSAGETYPE > &msg)
peek a message whether it has been handled
Definition asyncport.h:137
bool isOpen
Definition asyncport.h:75
void ClearHandlers()
clear all attached message handlers
bool IsOpen() const
return true if port is open
Definition asyncport.h:101
virtual void Open()
open the async port
Definition asyncport.cc:43
__DeclareClass(AsyncPort)
void CancelInternal(const Ptr< Message > &msg)
cancel a pending message
Definition asyncport.cc:138
void Cancel(const Ptr< MESSAGETYPE > &msg)
cancel a pending message
Definition asyncport.h:146
Ptr< HandlerThreadBase > thread
Definition asyncport.h:74
virtual void RemoveHandler(const Ptr< Handler > &h)
dynamically remove a handler from the port
Definition asyncport.cc:85
void Wait(const Ptr< MESSAGETYPE > &msg)
wait for a message to be handled
Definition asyncport.h:128
void SetHandlerThread(const Ptr< HandlerThreadBase > &handlerThread)
set pointer to handler thread object (must be derived from HandlerThreadBase)
Definition asyncport.h:82
void SendWait(const Ptr< MESSAGETYPE > &msg)
send a message and wait for completion
Definition asyncport.h:119
virtual ~AsyncPort()
destructor
Definition asyncport.cc:28
const Ptr< HandlerThreadBase > & GetHandlerThread() const
get pointer to handler thread object
Definition asyncport.h:92
virtual void AttachHandler(const Ptr< Handler > &h)
attach a handler to the port, may be called before or after Open()
Definition asyncport.cc:75
AsyncPort()
constructor
Definition asyncport.cc:19
virtual void Close()
close the async port
Definition asyncport.cc:60
void WaitInternal(const Ptr< Message > &msg)
wait for a message to be handled
Definition asyncport.cc:152
bool PeekInternal(const Ptr< Message > &msg)
peek a message whether it has been handled
Definition asyncport.cc:127
void SendInternal(const Ptr< Message > &msg)
send an asynchronous message to the port
Definition asyncport.cc:98
Nebula's smart pointer class which manages the life time of RefCounted objects.
Definition ptr.h:38
#define n_assert(exp)
Definition debug.h:50
Definition asyncport.cc:10