$search

industrial::message_handler::MessageHandler Class Reference

Interface definition for message handlers. The interface defines the callback function that should execute when a message is received. More...

#include <message_handler.h>

Inheritance diagram for industrial::message_handler::MessageHandler:
Inheritance graph
[legend]

List of all members.

Public Member Functions

bool callback (industrial::simple_message::SimpleMessage &in)
 Callback function that should be executed when a message arrives DO NOT OVERRIDE THIS FUNCTION. It performs message validation before the internal callback (which should be overridden) is called. If one is required the callback sends a message reply.
int getMsgType ()
 Gets message type that callback expects.
 MessageHandler ()
 Constructor.
 ~MessageHandler ()
 Destructor.

Protected Member Functions

industrial::smpl_msg_connection::SmplMsgConnectiongetConnection ()
 Gets connectoin for message replies.
bool init (int msg_type, industrial::smpl_msg_connection::SmplMsgConnection *connection)
 Class initializer.

Private Member Functions

virtual bool internalCB (industrial::simple_message::SimpleMessage &in)=0
 Virtual callback function.
void setConnection (industrial::smpl_msg_connection::SmplMsgConnection *connection)
 Sets connection for message replies.
void setMsgType (int msg_type)
 Sets message type that callback expects.
bool validateMsg (industrial::simple_message::SimpleMessage &in)
 Validates incoming message for processing by internal callback.

Private Attributes

industrial::smpl_msg_connection::SmplMsgConnectionconnection_
 Reference to reply connection (called if incoming message requires a reply).
int msg_type_
 Message type expected by callback.

Detailed Description

Interface definition for message handlers. The interface defines the callback function that should execute when a message is received.

Defines the interface used for function callbacks when a message is received. When used in conjunction with a message_manager (link) generic message handling can be achieved.

THIS CLASS IS NOT THREAD-SAFE

Definition at line 68 of file message_handler.h.


Constructor & Destructor Documentation

industrial::message_handler::MessageHandler::MessageHandler ( void   ) 

Constructor.

Definition at line 50 of file message_handler.cpp.

industrial::message_handler::MessageHandler::~MessageHandler ( void   ) 

Destructor.

Definition at line 57 of file message_handler.cpp.


Member Function Documentation

bool industrial::message_handler::MessageHandler::callback ( industrial::simple_message::SimpleMessage in  ) 

Callback function that should be executed when a message arrives DO NOT OVERRIDE THIS FUNCTION. It performs message validation before the internal callback (which should be overridden) is called. If one is required the callback sends a message reply.

Parameters:
in incoming message
Returns:
true on success, false otherwise

Definition at line 91 of file message_handler.cpp.

industrial::smpl_msg_connection::SmplMsgConnection* industrial::message_handler::MessageHandler::getConnection (  )  [inline, protected]

Gets connectoin for message replies.

Returns:
connection reference

Definition at line 112 of file message_handler.h.

int industrial::message_handler::MessageHandler::getMsgType (  )  [inline]

Gets message type that callback expects.

Returns:
message type

Definition at line 100 of file message_handler.h.

bool industrial::message_handler::MessageHandler::init ( int  msg_type,
industrial::smpl_msg_connection::SmplMsgConnection connection 
) [protected]

Class initializer.

Parameters:
msg_type type of message expected
connection simple message connection that will be used to send replies.
Returns:
true on success, false otherwise (an invalid message type)

Reimplemented in industrial::ping_handler::PingHandler.

Definition at line 62 of file message_handler.cpp.

virtual bool industrial::message_handler::MessageHandler::internalCB ( industrial::simple_message::SimpleMessage in  )  [private, pure virtual]

Virtual callback function.

Parameters:
in incoming message
Returns:
true on success, false otherwise

Implemented in industrial::ping_handler::PingHandler.

void industrial::message_handler::MessageHandler::setConnection ( industrial::smpl_msg_connection::SmplMsgConnection connection  )  [inline, private]

Sets connection for message replies.

Parameters:
connection connection reference

Definition at line 163 of file message_handler.h.

void industrial::message_handler::MessageHandler::setMsgType ( int  msg_type  )  [inline, private]

Sets message type that callback expects.

Parameters:
msg_type message type

Definition at line 174 of file message_handler.h.

bool industrial::message_handler::MessageHandler::validateMsg ( industrial::simple_message::SimpleMessage in  )  [private]

Validates incoming message for processing by internal callback.

Parameters:
in incoming message
Returns:
true on if valid, false otherwise

Definition at line 109 of file message_handler.cpp.


Member Data Documentation

Reference to reply connection (called if incoming message requires a reply).

Definition at line 133 of file message_handler.h.

Message type expected by callback.

Definition at line 138 of file message_handler.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends


simple_message
Author(s): Shaun Edwards
autogenerated on Mon Mar 4 11:36:30 2013