converters/touch.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 TOUCH_EVENT_CONVERTER_HPP
19 #define TOUCH_EVENT_CONVERTER_HPP
20 
21 /*
22 * LOCAL includes
23 */
24 #include "converter_base.hpp"
26 
27 /*
28 * ROS includes
29 */
30 #include <naoqi_bridge_msgs/Bumper.h>
31 #include <naoqi_bridge_msgs/HandTouch.h>
32 #include <naoqi_bridge_msgs/HeadTouch.h>
33 
34 /*
35 * ALDEBARAN includes
36 */
37 #include <qi/anymodule.hpp>
38 
39 namespace naoqi{
40 
41 namespace converter{
42 
43 template <class T>
44 class TouchEventConverter : public BaseConverter<TouchEventConverter<T> >
45 {
46 
47  typedef boost::function<void(T&) > Callback_t;
48 
49 public:
50  TouchEventConverter(const std::string& name, const float& frequency, const qi::SessionPtr& session);
51 
53 
54  virtual void reset();
55 
57 
58  void callAll(const std::vector<message_actions::MessageAction>& actions, T& msg);
59 
60 private:
62  std::map<message_actions::MessageAction, Callback_t> callbacks_;
63  T msg_;
64 };
65 
66 }
67 
68 }
69 
70 #endif // TOUCH_CONVERTER_HPP
naoqi::converter::TouchEventConverter::~TouchEventConverter
~TouchEventConverter()
Definition: converters/touch.cpp:40
naoqi::converter::TouchEventConverter::registerCallback
void registerCallback(const message_actions::MessageAction action, Callback_t cb)
Definition: converters/touch.cpp:49
converter
naoqi::message_actions::MessageAction
MessageAction
Definition: message_actions.h:9
naoqi::converter::TouchEventConverter::callAll
void callAll(const std::vector< message_actions::MessageAction > &actions, T &msg)
Definition: converters/touch.cpp:55
naoqi::converter::BaseConverter< TouchEventConverter< T > >::name
std::string name() const
Definition: converter_base.hpp:55
naoqi
Definition: converter.hpp:29
naoqi::converter::TouchEventConverter::callbacks_
std::map< message_actions::MessageAction, Callback_t > callbacks_
Definition: converters/touch.hpp:62
naoqi::converter::TouchEventConverter::msg_
T msg_
Definition: converters/touch.hpp:63
naoqi::converter::TouchEventConverter
Definition: converters/touch.hpp:44
naoqi::converter::TouchEventConverter::reset
virtual void reset()
Definition: converters/touch.cpp:44
naoqi::converter::BaseConverter
Definition: converter_base.hpp:40
naoqi::converter::BaseConverter< TouchEventConverter< T > >::frequency
float frequency() const
Definition: converter_base.hpp:60
message_actions.h
converter_base.hpp
naoqi::converter::TouchEventConverter::TouchEventConverter
TouchEventConverter(const std::string &name, const float &frequency, const qi::SessionPtr &session)
Definition: converters/touch.cpp:34
naoqi::converter::TouchEventConverter::Callback_t
boost::function< void(T &) > Callback_t
Definition: converters/touch.hpp:47


naoqi_driver
Author(s): Karsten Knese
autogenerated on Sat Feb 3 2024 03:50:06