Collage  1.1.2
High-performance C++ library for developing object-oriented distributed applications.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Pages
co::Dispatcher Class Reference

A class providing command dispatch functionality to networked objects. More...

#include <dispatcher.h>

+ Inheritance diagram for co::Dispatcher:
+ Collaboration diagram for co::Dispatcher:

Public Types

typedef CommandFunc< DispatcherFunc
 The signature of the base Dispatcher callback. More...
 

Public Member Functions

Dispatcheroperator= (const Dispatcher &)
 
template<typename T >
void registerCommand (const uint32_t command, const CommandFunc< T > &func, CommandQueue *queue)
 Register a command member function for a command. More...
 
virtual CO_API bool dispatchCommand (ICommand &command)
 Dispatch a command from the receiver thread to the registered queue. More...
 

Protected Member Functions

CO_API Dispatcher (const Dispatcher &from)
 
CO_API bool _cmdUnknown (ICommand &command)
 The default handler for handling commands. More...
 

Detailed Description

A class providing command dispatch functionality to networked objects.

Command dispatch in performed through a command queue and command handler table.

Definition at line 38 of file dispatcher.h.

Member Typedef Documentation

The signature of the base Dispatcher callback.

Version
1.0

Definition at line 42 of file dispatcher.h.

Member Function Documentation

CO_API bool co::Dispatcher::_cmdUnknown ( ICommand command)
protected

The default handler for handling commands.

Parameters
commandthe command
Returns
false
virtual CO_API bool co::Dispatcher::dispatchCommand ( ICommand command)
virtual

Dispatch a command from the receiver thread to the registered queue.

Parameters
commandthe command.
Returns
true if the command was dispatched, false if not.
See Also
registerCommand
Version
1.0

Reimplemented in co::LocalNode.

template<typename T >
void co::Dispatcher::registerCommand ( const uint32_t  command,
const CommandFunc< T > &  func,
CommandQueue queue 
)

Register a command member function for a command.

If the destination queue is 0, the command function is invoked directly upon dispatch, otherwise it is pushed to the given queue and invoked during the processing of the command queue.

Parameters
commandthe command.
functhe functor to handle the command.
queuethe queue to which the the command is dispatched
Version
1.0

Definition at line 94 of file dispatcher.h.


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