ULogToRosout.h
Go to the documentation of this file.
1 /*
2 Copyright (c) 2010-2022, Mathieu Labbe
3 All rights reserved.
4 
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions are met:
7  * Redistributions of source code must retain the above copyright
8  notice, this list of conditions and the following disclaimer.
9  * Redistributions in binary form must reproduce the above copyright
10  notice, this list of conditions and the following disclaimer in the
11  documentation and/or other materials provided with the distribution.
12  * Neither the names of its contributors may be used to endorse or promote products
13  derived from this software without specific prior written permission.
14 
15 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
19 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */
26 
27 #include <ros/ros.h>
29 
30 namespace rtabmap_ros {
31 
33 {
34 public:
36  {
38  }
39  virtual ~ULogToRosout()
40  {
42  }
43 protected:
44  virtual bool handleEvent(UEvent * event)
45  {
46  if(event->getClassName().compare("ULogEvent") == 0)
47  {
48  ULogEvent * logEvent = (ULogEvent *)event;
49  if(logEvent->getCode() == ULogger::kDebug)
50  {
51  ROS_DEBUG("%s", logEvent->getMsg().c_str());
52  }
53  else if(logEvent->getCode() == ULogger::kInfo)
54  {
55  ROS_INFO("%s", logEvent->getMsg().c_str());
56  }
57  else if(logEvent->getCode() == ULogger::kWarning)
58  {
59  ROS_WARN("%s", logEvent->getMsg().c_str());
60  }
61  else if(logEvent->getCode() == ULogger::kError)
62  {
63  ROS_ERROR("%s", logEvent->getMsg().c_str());
64  }
65  else if(logEvent->getCode() == ULogger::kFatal)
66  {
67  ROS_FATAL("%s", logEvent->getMsg().c_str());
68  }
69  return true;
70  }
71  return false;
72  }
73 };
74 
75 }
#define ROS_FATAL(...)
#define ROS_WARN(...)
int getCode() const
virtual std::string getClassName() const=0
const std::string & getMsg() const
#define ROS_INFO(...)
virtual bool handleEvent(UEvent *event)
Definition: ULogToRosout.h:44
void registerToEventsManager()
void unregisterFromEventsManager()
#define ROS_ERROR(...)
#define ROS_DEBUG(...)


rtabmap_ros
Author(s): Mathieu Labbe
autogenerated on Tue Jan 24 2023 04:04:40