naoqidriver
log.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 CONVERTERS_LOG_HPP
19 #define CONVERTERS_LOG_HPP
20 
21 #include <rosgraph_msgs/Log.h>
22 
24 #include "converter_base.hpp"
25 
26 #include <qicore/logmanager.hpp>
27 #include <qicore/loglistener.hpp>
28 
29 namespace naoqi
30 {
31 namespace converter
32 {
33 
34 class LogConverter : public BaseConverter<LogConverter>
35 {
36 
37  typedef boost::function<void(rosgraph_msgs::Log&) > Callback_t;
38 
39 public:
40  LogConverter( const std::string& name, float frequency, const qi::SessionPtr& sessions );
41 
42  void reset( );
43 
44  void registerCallback( const message_actions::MessageAction action, Callback_t cb );
45 
46  void callAll( const std::vector<message_actions::MessageAction>& actions );
47 
48 private:
50  void set_qi_logger_level();
51 
52  qi::LogManagerPtr logger_;
54  qi::LogLevel log_level_;
55  qi::LogListenerPtr listener_;
56 
57  std::map<message_actions::MessageAction, Callback_t> callbacks_;
58 };
59 
60 } //publisher
61 } //naoqi
62 
63 #endif
void set_qi_logger_level()
Definition: log.cpp:156
std::string name() const
Definition: converter_base.hpp:54
float frequency() const
Definition: converter_base.hpp:59
qi::LogLevel log_level_
Definition: log.hpp:54
void callAll(const std::vector< message_actions::MessageAction > &actions)
Definition: log.cpp:135
boost::function< void(rosgraph_msgs::Log &) > Callback_t
Definition: log.hpp:37
void reset()
Definition: log.cpp:152
MessageAction
Definition: message_actions.h:9
Definition: audio.cpp:29
std::map< message_actions::MessageAction, Callback_t > callbacks_
Definition: log.hpp:57
LogConverter(const std::string &name, float frequency, const qi::SessionPtr &sessions)
Definition: log.cpp:110
Definition: log.hpp:34
void registerCallback(const message_actions::MessageAction action, Callback_t cb)
Definition: log.cpp:130
Definition: converter_base.hpp:40
qi::LogManagerPtr logger_
Definition: log.hpp:52
qi::LogListenerPtr listener_
Definition: log.hpp:55