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 
25 
26 namespace scip2
27 {
28 class ResponseQT : 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("QT");
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 } // namespace scip2
60 
61 #endif // SCIP2_RESPONSE_QUIT_H
std::string getCommandCode() const
Definition: quit.h:40
void registerCallback(Callback cb)
Definition: quit.h:53
boost::function< void(const boost::posix_time::ptime &, const std::string &, const std::string &)> Callback
Definition: quit.h:34
void operator()(const boost::posix_time::ptime &time_read, const std::string &echo_back, const std::string &status, std::istream &stream)
Definition: quit.h:44
Callback cb_
Definition: quit.h:37


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