subscriber_base.hpp
Go to the documentation of this file.
00001 /*
00002  * Copyright 2015 Aldebaran
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *     http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  *
00016 */
00017 
00018 #ifndef BASE_SUBSCRIBER_HPP
00019 #define BASE_SUBSCRIBER_HPP
00020 
00021 /*
00022  * ALDEBARAN includes
00023  */
00024 #include <qi/session.hpp>
00025 
00026 /*
00027  * LOCAL includes
00028  */
00029 #include <naoqi_driver/tools.hpp>
00030 #include "../helpers/driver_helpers.hpp"
00031 
00032 namespace naoqi
00033 {
00034 namespace subscriber
00035 {
00036 
00037 // CRTP
00038 template<class T>
00039 class BaseSubscriber
00040 {
00041 
00042 public:
00043   BaseSubscriber( const std::string& name, const std::string& topic, qi::SessionPtr session ):
00044     name_( name ),
00045     topic_( topic ),
00046     is_initialized_( false ),
00047     robot_( helpers::driver::getRobot(session) ),
00048     session_(session)
00049   {}
00050 
00051   virtual ~BaseSubscriber() {}
00052 
00053   inline std::string name() const
00054   {
00055     return name_;
00056   }
00057 
00058   inline std::string topic() const
00059   {
00060     return topic_;
00061   }
00062 
00063   inline bool isInitialized() const
00064   {
00065     return is_initialized_;
00066   }
00067 
00068 protected:
00069   std::string name_, topic_;
00070 
00071   bool is_initialized_;
00072 
00074   const robot::Robot& robot_;
00075 
00077   qi::SessionPtr session_;
00078 }; // class
00079 
00080 } // subscriber
00081 } // naoqi
00082 
00083 #endif


naoqi_driver
Author(s): Karsten Knese
autogenerated on Tue Jul 9 2019 03:21:56