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 /* 00019 * LOCAL includes 00020 */ 00021 #include "touch.hpp" 00022 00023 /* 00024 * BOOST includes 00025 */ 00026 #include <boost/foreach.hpp> 00027 #define for_each BOOST_FOREACH 00028 00029 namespace naoqi{ 00030 00031 namespace converter{ 00032 00033 template <class T> 00034 TouchEventConverter<T>::TouchEventConverter(const std::string& name, const float& frequency, const qi::SessionPtr& session) 00035 : BaseConverter<TouchEventConverter<T> >(name, frequency, session) 00036 { 00037 } 00038 00039 template <class T> 00040 TouchEventConverter<T>::~TouchEventConverter() { 00041 } 00042 00043 template <class T> 00044 void TouchEventConverter<T>::reset() 00045 { 00046 } 00047 00048 template <class T> 00049 void TouchEventConverter<T>::registerCallback( const message_actions::MessageAction action, Callback_t cb ) 00050 { 00051 callbacks_[action] = cb; 00052 } 00053 00054 template <class T> 00055 void TouchEventConverter<T>::callAll(const std::vector<message_actions::MessageAction>& actions, T& msg) 00056 { 00057 msg_ = msg; 00058 for_each( message_actions::MessageAction action, actions ) 00059 { 00060 callbacks_[action](msg_); 00061 } 00062 } 00063 00064 // http://stackoverflow.com/questions/8752837/undefined-reference-to-template-class-constructor 00065 template class TouchEventConverter<naoqi_bridge_msgs::Bumper>; 00066 template class TouchEventConverter<naoqi_bridge_msgs::HandTouch>; 00067 template class TouchEventConverter<naoqi_bridge_msgs::HeadTouch>; 00068 } 00069 00070 }