#include <XnVMessageListener.h>
List of all members.
Detailed Description
A XnVMessageListener is a general listener, that received Messages and handles them. It supports Multi-Threaded work, by knowing the thread it works in, and putting Messages in a Queue when accessed from other threads.
Definition at line 21 of file XnVMessageListener.h.
Member Typedef Documentation
Constructor & Destructor Documentation
XnVMessageListener::XnVMessageListener |
( |
const XnChar * |
strName = "XnVMessageListener" |
) |
|
Constructor. Create a new Message Listener
- Parameters:
-
[in] | strName | Name of the control, for log purposes. |
virtual XnVMessageListener::~XnVMessageListener |
( |
|
) |
[virtual] |
Member Function Documentation
virtual void XnVMessageListener::Activate |
( |
XnBool |
bActive |
) |
[inline, virtual] |
This method is called (by the default HandleCCMessages) when an Activation Message is received.
- Parameters:
-
[in] | bActive | TRUE if this listener is now active, FALSE if it is now inactive |
Definition at line 73 of file XnVMessageListener.h.
void XnVMessageListener::BaseUpdate |
( |
XnVMessage * |
pMessage |
) |
|
This method handles multi-thread support, calling Update only when run from the proper thread and copying the Message to a Queue when not.
- Parameters:
-
[in] | pMessage | The Message that should be handled |
virtual void XnVMessageListener::ClearQueue |
( |
|
) |
[virtual] |
const XnChar* XnVMessageListener::GetListenerName |
( |
|
) |
const |
Get the listener's name. Mostly for Log use.
- Returns:
- The current Listener's name
XnBool XnVMessageListener::GetThreadProtectecionQueueMode |
( |
|
) |
const |
Get the current multi-thread mode
- Returns:
- TRUE if queues are used, FALSE if Update will be called from anywhere
virtual void XnVMessageListener::HandleCCMessages |
( |
XnVMessage * |
pMessage |
) |
[virtual] |
Handle Control Messages. By default, it calls Activate for Activation Messages. Can be reimplemented to handle additional Message types. Is called from BaseUpdate, before Update.
- Parameters:
-
[in] | pMessage | The message to handle |
XnBool XnVMessageListener::IsInActivityThread |
( |
|
) |
const [protected] |
void XnVMessageListener::MainLoop |
( |
|
) |
[protected] |
static XN_THREAD_PROC XnVMessageListener::MessageListenerThread |
( |
XN_THREAD_PARAM |
param |
) |
[static, protected] |
XnCallbackHandle XnVMessageListener::RegisterActivate |
( |
void * |
cxt, |
|
|
ActivateCB |
CB | |
|
) |
| | |
Register for the activation event
- Parameters:
-
[in] | cxt | User's context |
[in] | CB | The Callback to call when the event is invoked. |
- Returns:
- A handle, to allow unregistration.
XnCallbackHandle XnVMessageListener::RegisterDeactivate |
( |
void * |
cxt, |
|
|
DeactivateCB |
CB | |
|
) |
| | |
Register for the deactivation event
- Parameters:
-
[in] | cxt | User's context |
[in] | CB | The Callback to call when the event is invoked. |
- Returns:
- A handle, to allow unregistration.
XnCallbackHandle XnVMessageListener::RegisterUpdate |
( |
void * |
cxt, |
|
|
MessageUpdateCB |
CB | |
|
) |
| | |
Register a callback to be called after the Message is handled
- Parameters:
-
[in] | cxt | User's context |
[in] | CB | The Callback to call when the event is invoked. |
- Returns:
- A handle, to allow unregistration.
Supply the Message Listener with run-time from its thread. Read from the Queue, and BaseUpdate.
- Parameters:
-
[in] | nSessionMaxLength | Maximum number of Messages to be handled in a single Run |
XnStatus XnVMessageListener::RunAsThread |
( |
|
) |
|
Open a thread, and run the Listener in it.
- Returns:
- XN_STATUS_OK if OK, other on error
void XnVMessageListener::SetCurrentThread |
( |
|
) |
|
Change the working thread to the one from which it is called
void XnVMessageListener::SetThreadId |
( |
XN_THREAD_ID |
hThread |
) |
|
Change the working thread, in which actual work is done
- Parameters:
-
[in] | hThread | The ID of the relevant thread |
void XnVMessageListener::SetThreadProtectionQueueMode |
( |
XnBool |
bMode |
) |
|
Change the multi-thread mode.
- Parameters:
-
void XnVMessageListener::UnregisterActivate |
( |
XnCallbackHandle |
hCB |
) |
|
Unregister from the activation event
- Parameters:
-
[in] | hCB | The handle provided on registration. |
void XnVMessageListener::UnregisterDeactivate |
( |
XnCallbackHandle |
hCB |
) |
|
Unregister from the deactivation event
- Parameters:
-
[in] | hCB | The handle provided on registration. |
void XnVMessageListener::UnregisterUpdate |
( |
XnCallbackHandle |
hCB |
) |
|
Unregister from the Message Update
- Parameters:
-
[in] | hCB | The handle provided on registration. |
virtual void XnVMessageListener::Update |
( |
XnVMessage * |
pMessage |
) |
[pure virtual] |
XnVMessageListener::XN_DECLARE_EVENT_1ARG |
( |
XnVMessageSpecificEvent |
, |
|
|
XnVMessageEvent |
, |
|
|
XnVMessage * |
, |
|
|
pMessage |
| |
|
) |
| | [protected] |
XnVMessageListener::XN_DECLARE_THREAD_SAFE_QUEUE_DECL |
( |
XNV_NITE_API |
, |
|
|
XnVMessage * |
, |
|
|
XnVMessageQueue |
| |
|
) |
| | [protected] |
Member Data Documentation
The documentation for this class was generated from the following file: