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 
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
Interface definition for message handlers. The interface defines the callback function that should ex...
Defines an interface and common methods for sending simple messages (see simple_message). This interface makes a bare minimum of assumptions:
bool callback(industrial::simple_message::SimpleMessage &in)
Callback function that should be executed when a message arrives DO NOT OVERRIDE THIS FUNCTION...
This class defines a simple messaging protocol for communicating with an industrial robot controller...
int msg_type_
Message type expected by callback.
int getMsgType()
Gets message type that callback expects.
void setConnection(industrial::smpl_msg_connection::SmplMsgConnection *connection)
Sets connection for message replies.
bool validateMsg(industrial::simple_message::SimpleMessage &in)
Validates incoming message for processing by internal callback.
industrial::smpl_msg_connection::SmplMsgConnection * connection_
Reference to reply connection (called if incoming message requires a reply)
def msg_type(f)
industrial::smpl_msg_connection::SmplMsgConnection * getConnection()
Gets connectoin for message replies.
void setMsgType(int msg_type)
Sets message type that callback expects.
bool init(int msg_type, industrial::smpl_msg_connection::SmplMsgConnection *connection)
Class initializer.
virtual bool internalCB(industrial::simple_message::SimpleMessage &in)=0
Virtual callback function.


simple_message
Author(s): Shaun Edwards
autogenerated on Sat Sep 21 2019 03:30:09