quit.h
Go to the documentation of this file.
1 /*
2  * Copyright 2018 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_QUIT_H
18 #define SCIP2_RESPONSE_QUIT_H
19 
20 #include <boost/asio.hpp>
21 
22 #include <string>
23 #include <map>
24 
26 
27 namespace scip2
28 {
29 class ResponseQT : public Response
30 {
31 public:
32  using Callback = boost::function<void(
33  const boost::posix_time::ptime &,
34  const std::string &,
35  const std::string &)>;
36 
37 protected:
39 
40 public:
41  std::string getCommandCode() const
42  {
43  return std::string("QT");
44  }
45  void operator()(
46  const boost::posix_time::ptime &time_read,
47  const std::string &echo_back,
48  const std::string &status,
49  std::istream &stream)
50  {
51  if (cb_)
52  cb_(time_read, echo_back, status);
53  }
55  {
56  cb_ = cb;
57  }
58 };
59 
60 } // namespace scip2
61 
62 #endif // SCIP2_RESPONSE_QUIT_H
std::string getCommandCode() const
Definition: quit.h:41
boost::function< void(const boost::posix_time::ptime &, const std::string &, const std::string &)> Callback
Definition: quit.h:35
void registerCallback(Callback cb)
Definition: quit.h:54
void operator()(const boost::posix_time::ptime &time_read, const std::string &echo_back, const std::string &status, std::istream &stream)
Definition: quit.h:45
Callback cb_
Definition: quit.h:38


urg_stamped
Author(s): Atsushi Watanabe
autogenerated on Thu Jun 6 2019 19:55:58