message_handler.h
Go to the documentation of this file.
1 /*
2  * Software License Agreement (BSD License)
3  *
4  * Copyright (c) 2011, Southwest Research Institute
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions are met:
9  *
10  * * Redistributions of source code must retain the above copyright
11  * notice, this list of conditions and the following disclaimer.
12  * * Redistributions in binary form must reproduce the above copyright
13  * notice, this list of conditions and the following disclaimer in the
14  * documentation and/or other materials provided with the distribution.
15  * * Neither the name of the Southwest Research Institute, nor the names
16  * of its contributors may be used to endorse or promote products derived
17  * from this software without specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
23  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29  * POSSIBILITY OF SUCH DAMAGE.
30  */
31 
32 #ifndef MESSAGE_HANDLER_H
33 #define MESSAGE_HANDLER_H
34 
35 #ifndef FLATHEADERS
38 #else
39 #include "simple_message.h"
40 #include "smpl_msg_connection.h"
41 #endif
42 
43 namespace industrial
44 {
45 namespace message_handler
46 {
47 
52 //* MessageHandler
62 
63 {
64 public:
65 
70 
75 
87 
93  int getMsgType()
94  {
95  return this->msg_type_;
96  }
97  ;
98 
99 protected:
106  {
107  return this->connection_;
108  }
109  ;
110 
119  bool init(int msg_type, industrial::smpl_msg_connection::SmplMsgConnection* connection);
120 
121 private:
122 
127 
132 
141 
150 
157  {
158  this->connection_ = connection;
159  }
160  ;
161 
167  void setMsgType(int msg_type)
168  {
169  this->msg_type_ = msg_type;
170  }
171  ;
172 
173 };
174 
175 } //namespace message_handler
176 } //namespace industrial
177 
178 #endif //MESSAGE_HANDLER_H
industrial::message_handler::MessageHandler::validateMsg
bool validateMsg(industrial::simple_message::SimpleMessage &in)
Validates incoming message for processing by internal callback.
Definition: message_handler.cpp:106
industrial::message_handler::MessageHandler::callback
bool callback(industrial::simple_message::SimpleMessage &in)
Callback function that should be executed when a message arrives DO NOT OVERRIDE THIS FUNCTION....
Definition: message_handler.cpp:88
industrial::message_handler::MessageHandler::~MessageHandler
~MessageHandler()
Destructor.
Definition: message_handler.cpp:54
industrial::message_handler::MessageHandler
Interface definition for message handlers. The interface defines the callback function that should ex...
Definition: message_handler.h:61
industrial
Definition: byte_array.h:45
simple_message.h
industrial::message_handler::MessageHandler::getConnection
industrial::smpl_msg_connection::SmplMsgConnection * getConnection()
Gets connectoin for message replies.
Definition: message_handler.h:105
industrial::message_handler::MessageHandler::init
bool init(int msg_type, industrial::smpl_msg_connection::SmplMsgConnection *connection)
Class initializer.
Definition: message_handler.cpp:59
industrial::message_handler::MessageHandler::MessageHandler
MessageHandler()
Constructor.
Definition: message_handler.cpp:47
industrial::message_handler::MessageHandler::setMsgType
void setMsgType(int msg_type)
Sets message type that callback expects.
Definition: message_handler.h:167
industrial::simple_message::SimpleMessage
This class defines a simple messaging protocol for communicating with an industrial robot controller.
Definition: simple_message.h:164
industrial::message_handler::MessageHandler::connection_
industrial::smpl_msg_connection::SmplMsgConnection * connection_
Reference to reply connection (called if incoming message requires a reply)
Definition: message_handler.h:126
industrial::message_handler::MessageHandler::internalCB
virtual bool internalCB(industrial::simple_message::SimpleMessage &in)=0
Virtual callback function.
industrial::smpl_msg_connection::SmplMsgConnection
Defines an interface and common methods for sending simple messages (see simple_message)....
Definition: smpl_msg_connection.h:61
msg_type
def msg_type(f)
industrial::message_handler::MessageHandler::getMsgType
int getMsgType()
Gets message type that callback expects.
Definition: message_handler.h:93
industrial::message_handler::MessageHandler::msg_type_
int msg_type_
Message type expected by callback.
Definition: message_handler.h:131
industrial::message_handler::MessageHandler::setConnection
void setConnection(industrial::smpl_msg_connection::SmplMsgConnection *connection)
Sets connection for message replies.
Definition: message_handler.h:156
smpl_msg_connection.h


simple_message
Author(s): Shaun Edwards
autogenerated on Wed Mar 2 2022 00:24:53