naoqidriver
float.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 MEMORY_FLOAT_CONVERTER_HPP
19 #define MEMORY_FLOAT_CONVERTER_HPP
20 
21 /*
22 * LOCAL includes
23 */
24 #include "../converter_base.hpp"
26 
27 /*
28 * ROS includes
29 */
30 #include <naoqi_bridge_msgs/FloatStamped.h>
31 
32 namespace naoqi
33 {
34 namespace converter
35 {
36 
37 class MemoryFloatConverter : public BaseConverter<MemoryFloatConverter>
38 {
39  typedef boost::function<void(naoqi_bridge_msgs::FloatStamped&)> Callback_t;
40 
41 public:
42 
43  MemoryFloatConverter( const std::string& name, const float& frequency, const qi::SessionPtr& session, const std::string& memory_key );
44 
45  void reset();
46 
47  void registerCallback( const message_actions::MessageAction action, Callback_t cb );
48 
49  void callAll( const std::vector<message_actions::MessageAction>& actions );
50 
51 private:
52  bool convert();
53 
54 private:
56  std::string memory_key_;
58  qi::AnyObject p_memory_;
59 
60  std::map<message_actions::MessageAction, Callback_t> callbacks_;
61  naoqi_bridge_msgs::FloatStamped msg_;
62 
63 }; // class
64 
65 } //publisher
66 } // naoqi
67 
68 #endif
void registerCallback(const message_actions::MessageAction action, Callback_t cb)
Definition: float.cpp:40
std::string name() const
Definition: converter_base.hpp:54
float frequency() const
Definition: converter_base.hpp:59
MemoryFloatConverter(const std::string &name, const float &frequency, const qi::SessionPtr &session, const std::string &memory_key)
Definition: float.cpp:34
std::string memory_key_
Definition: float.hpp:56
std::map< message_actions::MessageAction, Callback_t > callbacks_
Definition: float.hpp:60
MessageAction
Definition: message_actions.h:9
Definition: audio.cpp:29
boost::function< void(naoqi_bridge_msgs::FloatStamped &)> Callback_t
Definition: float.hpp:39
Definition: converter_base.hpp:40
bool convert()
Definition: float.cpp:45
void reset()
Definition: float.cpp:73
naoqi_bridge_msgs::FloatStamped msg_
Definition: float.hpp:61
void callAll(const std::vector< message_actions::MessageAction > &actions)
Definition: float.cpp:63
qi::AnyObject p_memory_
Definition: float.hpp:58