set_io_reply.cpp
Go to the documentation of this file.
1 /*********************************************************************
2 * FSRobo-R Package BSDL
3 * ---------
4 * Copyright (C) 2019 FUJISOFT. All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without modification,
7 * are permitted provided that the following conditions are met:
8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice,
11 * this list of conditions and the following disclaimer in the documentation and/or
12 * other materials provided with the distribution.
13 * 3. Neither the name of the copyright holder nor the names of its contributors
14 * may be used to endorse or promote products derived from this software without
15 * specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
21 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
25 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *********************************************************************/
28 
29 #include <string>
34 
37 
38 namespace fsrobo_r_driver
39 {
40 namespace simple_message
41 {
42 namespace io_control_reply
43 {
44 
46 {
47  this->init();
48 }
49 
51 {
52 }
53 
55 {
56  // TODO: is success a good initial value?
58 }
59 
61 {
62  this->setResultCode(result_code);
63 }
64 
66 {
67  this->setResultCode(src.getResultCode());
68 }
69 
71 {
72  bool rslt = this->result_code_ == rhs.result_code_;
73 
74  return rslt;
75 }
76 
78 {
79  LOG_COMM("Executing SetIOReply load");
80 
81  if (!buffer->load(this->result_code_))
82  {
83  LOG_ERROR("Failed to load SetIOReply result_code");
84  return false;
85  }
86 
87  LOG_COMM("SetIOReply data successfully loaded");
88  return true;
89 }
90 
92 {
93  LOG_COMM("Executing SetIOReply unload");
94 
95  if (!buffer->unload(this->result_code_))
96  {
97  LOG_ERROR("Failed to unload SetIOReply result_code");
98  return false;
99  }
100 
101  LOG_COMM("SetIOReply data successfully unloaded");
102  return true;
103 }
104 
105 }
106 }
107 }
#define LOG_COMM(format,...)
bool load(industrial::shared_types::shared_bool value)
#define LOG_ERROR(format,...)
industrial::shared_types::shared_int getResultCode() const
Returns the result code.
Definition: set_io_reply.h:117
void init()
Initializes a empty motion control reply.
void setResultCode(industrial::shared_types::shared_int result_code)
Sets the result code.
Definition: set_io_reply.h:107
void copyFrom(SetIOReply &src)
Copies the passed in value.
bool unload(industrial::byte_array::ByteArray *buffer)
bool load(industrial::byte_array::ByteArray *buffer)
Class encapsulated set io reply data. These messages are sent by the FSRobo-R controller in response ...
Definition: set_io_reply.h:73
industrial::shared_types::shared_int result_code_
The result code.
Definition: set_io_reply.h:148
bool unload(industrial::shared_types::shared_bool &value)
bool operator==(SetIOReply &rhs)
== operator implementation


fsrobo_r_driver
Author(s): F-ROSROBO
autogenerated on Sun Feb 9 2020 03:58:29