reset.h
Go to the documentation of this file.
1 /*
2  * Copyright 2020-2021 The urg_stamped Authors
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef SCIP2_RESPONSE_RESET_H
18 #define SCIP2_RESPONSE_RESET_H
19 
20 #include <boost/asio.hpp>
21 
22 #include <string>
23 
25 
26 namespace scip2
27 {
28 class ResponseRS : public Response
29 {
30 public:
31  using Callback = boost::function<void(
32  const boost::posix_time::ptime&,
33  const std::string&,
34  const std::string&)>;
35 
36 protected:
38 
39 public:
40  std::string getCommandCode() const
41  {
42  return std::string("RS");
43  }
44  void operator()(
45  const boost::posix_time::ptime& time_read,
46  const std::string& echo_back,
47  const std::string& status,
48  std::istream& stream)
49  {
50  if (cb_)
51  cb_(time_read, echo_back, status);
52  }
54  {
55  cb_ = cb;
56  }
57 };
58 
59 class ResponseRT : public Response
60 {
61 public:
62  using Callback = boost::function<void(
63  const boost::posix_time::ptime&,
64  const std::string&,
65  const std::string&)>;
66 
67 protected:
69 
70 public:
71  std::string getCommandCode() const
72  {
73  return std::string("RT");
74  }
75  void operator()(
76  const boost::posix_time::ptime& time_read,
77  const std::string& echo_back,
78  const std::string& status,
79  std::istream& stream)
80  {
81  if (cb_)
82  cb_(time_read, echo_back, status);
83  }
85  {
86  cb_ = cb;
87  }
88 };
89 } // namespace scip2
90 
91 #endif // SCIP2_RESPONSE_RESET_H
std::string getCommandCode() const
Definition: reset.h:40
std::string getCommandCode() const
Definition: reset.h:71
boost::function< void(const boost::posix_time::ptime &, const std::string &, const std::string &)> Callback
Definition: reset.h:34
void operator()(const boost::posix_time::ptime &time_read, const std::string &echo_back, const std::string &status, std::istream &stream)
Definition: reset.h:75
boost::function< void(const boost::posix_time::ptime &, const std::string &, const std::string &)> Callback
Definition: reset.h:65
void registerCallback(Callback cb)
Definition: reset.h:84
void registerCallback(Callback cb)
Definition: reset.h:53
void operator()(const boost::posix_time::ptime &time_read, const std::string &echo_back, const std::string &status, std::istream &stream)
Definition: reset.h:44
Callback cb_
Definition: reset.h:68
Callback cb_
Definition: reset.h:37


urg_stamped
Author(s): Atsushi Watanabe
autogenerated on Tue May 11 2021 02:14:05