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_CONVERTER_HPP 00019 #define BASE_CONVERTER_HPP 00020 00021 /* 00022 * LOCAL includes 00023 */ 00024 #include <naoqi_driver/tools.hpp> 00025 #include "../helpers/driver_helpers.hpp" 00026 00027 /* 00028 * ALDEBARAN includes 00029 */ 00030 #include <qi/session.hpp> 00031 #include <qi/anyobject.hpp> 00032 00033 namespace naoqi 00034 { 00035 namespace converter 00036 { 00037 00038 // CRTP 00039 template<class T> 00040 class BaseConverter 00041 { 00042 00043 public: 00044 BaseConverter( const std::string& name, float frequency, qi::SessionPtr session ): 00045 name_( name ), 00046 frequency_( frequency ), 00047 robot_( helpers::driver::getRobot(session) ), 00048 session_(session), 00049 record_enabled_(false) 00050 {} 00051 00052 virtual ~BaseConverter() {} 00053 00054 inline std::string name() const 00055 { 00056 return name_; 00057 } 00058 00059 inline float frequency() const 00060 { 00061 return frequency_; 00062 } 00063 00064 protected: 00065 std::string name_; 00066 00068 float frequency_; 00070 const robot::Robot& robot_; 00071 00073 qi::SessionPtr session_; 00074 00076 bool record_enabled_; 00077 }; // class 00078 00079 } // converter 00080 } // naoqi 00081 00082 #endif