subscriber_base.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 2015 Aldebaran
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 
18 #ifndef BASE_SUBSCRIBER_HPP
19 #define BASE_SUBSCRIBER_HPP
20 
21 /*
22  * ALDEBARAN includes
23  */
24 #include <qi/session.hpp>
25 
26 /*
27  * LOCAL includes
28  */
29 #include <naoqi_driver/tools.hpp>
30 #include "../helpers/driver_helpers.hpp"
31 
32 namespace naoqi
33 {
34 namespace subscriber
35 {
36 
37 // CRTP
38 template<class T>
40 {
41 
42 public:
43  BaseSubscriber( const std::string& name, const std::string& topic, qi::SessionPtr session ):
44  name_( name ),
45  topic_( topic ),
46  is_initialized_( false ),
47  robot_( helpers::driver::getRobot(session) ),
48  session_(session)
49  {}
50 
51  virtual ~BaseSubscriber() {}
52 
53  inline std::string name() const
54  {
55  return name_;
56  }
57 
58  inline std::string topic() const
59  {
60  return topic_;
61  }
62 
63  inline bool isInitialized() const
64  {
65  return is_initialized_;
66  }
67 
68 protected:
69  std::string name_, topic_;
70 
72 
75 
77  qi::SessionPtr session_;
78 }; // class
79 
80 } // subscriber
81 } // naoqi
82 
83 #endif
BaseSubscriber(const std::string &name, const std::string &topic, qi::SessionPtr session)
const robot::Robot & getRobot(const qi::SessionPtr &session)


naoqi_driver
Author(s): Karsten Knese
autogenerated on Sat Feb 15 2020 03:24:26