src
log_database.cpp
Go to the documentation of this file.
1
// *****************************************************************************
2
//
3
// Copyright (c) 2015, Southwest Research Institute® (SwRI®)
4
// All rights reserved.
5
//
6
// Redistribution and use in source and binary forms, with or without
7
// modification, are permitted provided that the following conditions are met:
8
// * Redistributions of source code must retain the above copyright
9
// notice, this list of conditions and the following disclaimer.
10
// * Redistributions in binary form must reproduce the above copyright
11
// notice, this list of conditions and the following disclaimer in the
12
// documentation and/or other materials provided with the distribution.
13
// * Neither the name of Southwest Research Institute® (SwRI®) nor the
14
// names of its contributors may be used to endorse or promote products
15
// derived from this software without specific prior written permission.
16
//
17
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20
// ARE DISCLAIMED. IN NO EVENT SHALL Southwest Research Institute® BE LIABLE
21
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
23
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
24
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25
// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26
// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
27
// DAMAGE.
28
//
29
// *****************************************************************************
30
31
#include <
swri_console/log_database.h
>
32
33
namespace
swri_console
34
{
35
LogDatabase::LogDatabase
()
36
:
37
min_time_(
ros
::
TIME_MAX
)
38
{
39
}
40
41
LogDatabase::~LogDatabase
()
42
{
43
}
44
45
void
LogDatabase::clear
()
46
{
47
std::map<std::string, size_t>::iterator iter;
48
msg_counts_
.clear();
49
log_
.clear();
50
Q_EMIT
databaseCleared
();
51
}
52
53
void
LogDatabase::queueMessage
(
const
rosgraph_msgs::LogConstPtr
msg
)
54
{
55
if
(
msg
->header.stamp <
min_time_
) {
56
min_time_
=
msg
->header.stamp;
57
Q_EMIT
minTimeUpdated
();
58
}
59
60
msg_counts_
[
msg
->name]++;
61
62
LogEntry
log
;
63
log
.stamp =
msg
->header.stamp;
64
log
.level =
msg
->level;
65
log
.node =
msg
->name;
66
log
.file =
msg
->file;
67
log
.function =
msg
->function;
68
log
.line =
msg
->line;
69
log
.text = QString(
msg
->msg.c_str()).split(
'\n'
);
70
log
.seq =
msg
->header.seq;
71
new_msgs_
.push_back(
log
);
72
}
73
74
void
LogDatabase::processQueue
()
75
{
76
if
(
new_msgs_
.empty()) {
77
return
;
78
}
79
80
log_
.insert(
log_
.end(),
81
new_msgs_
.begin(),
82
new_msgs_
.end());
83
new_msgs_
.clear();
84
85
Q_EMIT
messagesAdded
();
86
}
87
}
// namespace swri_console
swri_console::LogDatabase::clear
void clear()
Definition:
log_database.cpp:45
swri_console::LogDatabase::new_msgs_
std::deque< LogEntry > new_msgs_
Definition:
log_database.h:81
swri_console::LogDatabase::processQueue
void processQueue()
Definition:
log_database.cpp:74
ros
swri_console::LogDatabase::databaseCleared
void databaseCleared()
swri_console::LogDatabase::messagesAdded
void messagesAdded()
swri_console::LogDatabase::queueMessage
void queueMessage(const rosgraph_msgs::LogConstPtr msg)
Definition:
log_database.cpp:53
swri_console::LogDatabase::min_time_
ros::Time min_time_
Definition:
log_database.h:83
swri_console::LogDatabase::log_
std::deque< LogEntry > log_
Definition:
log_database.h:80
swri_console::LogEntry
Definition:
log_database.h:43
log_database.h
swri_console::LogDatabase::minTimeUpdated
void minTimeUpdated()
swri_console::LogDatabase::~LogDatabase
~LogDatabase()
Definition:
log_database.cpp:41
swri_console
Definition:
bag_reader.h:40
TIME_MAX
const ROSTIME_DECL Time TIME_MAX
console_generator.msg
msg
Definition:
console_generator.py:58
swri_console::LogDatabase::msg_counts_
std::map< std::string, size_t > msg_counts_
Definition:
log_database.h:79
swri_console::LogDatabase::LogDatabase
LogDatabase()
Definition:
log_database.cpp:35
swri_console::LogDatabase::log
const std::deque< LogEntry > & log()
Definition:
log_database.h:64
swri_console
Author(s): P. J. Reed
, Jerry Towler
, David Anthony
autogenerated on Sat Sep 23 2023 02:55:36