Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
tools
rosbag-inspector
files_container.h
Go to the documentation of this file.
1
// License: Apache 2.0. See LICENSE file in root directory.
2
// Copyright(c) 2017 Intel Corporation. All Rights Reserved.
3
4
#pragma once
5
6
#include <string>
7
#include <tuple>
8
#include <mutex>
9
#include <fstream>
10
#include <list>
11
12
#include "
rosbag_content.h
"
13
#include "
print_helpers.h
"
14
15
namespace
rosbag_inspector
16
{
17
class
files_container
18
{
19
public
:
20
size_t
size
()
21
{
22
std::lock_guard<std::mutex>
lock
(
mutex
);
23
return
m_files
.size();
24
}
25
rosbag_content
&
operator[]
(
int
index
)
26
{
27
std::lock_guard<std::mutex>
lock
(
mutex
);
28
if
(index >=
m_files
.size())
29
throw
std::out_of_range(
std::string
(
"index: "
) +
std::to_string
(index));
30
31
auto
itr =
m_files
.begin();
32
std::advance
(itr, index);
33
return
*itr;
34
}
35
int
remove_file
(
int
index
)
36
{
37
std::lock_guard<std::mutex>
lock
(
mutex
);
38
if
(index >=
m_files
.size())
39
throw
std::out_of_range(
std::string
(
"index: "
) +
std::to_string
(index));
40
41
auto
it_to_remove =
m_files
.begin();
42
std::advance
(it_to_remove, index);
43
auto
it
=
m_files
.erase(it_to_remove);
44
return
std::distance
(
m_files
.begin(),
it
);
45
}
46
void
AddFiles
(std::vector<std::string>
const
&
files
)
47
{
48
std::lock_guard<std::mutex>
lock
(
mutex
);
49
50
for
(
auto
&& file : files)
51
{
52
try
53
{
54
if
(std::find_if(
m_files
.begin(),
m_files
.end(), [file](
const
rosbag_content
&
r
) {
return
r
.path == file; }) !=
m_files
.end())
55
{
56
throw
std::runtime_error(
tmpstringstream
() <<
"File \""
<< file <<
"\" already loaded"
);
57
}
58
m_files
.emplace_back(file);
59
}
60
catch
(
const
std::exception&
e
)
61
{
62
last_error_message
+= e.what();
63
last_error_message
+=
"\n"
;
64
}
65
}
66
}
67
bool
has_errors
()
const
68
{
69
return
!
last_error_message
.empty();
70
}
71
std::string
get_last_error
()
72
{
73
return
last_error_message
;
74
}
75
void
clear_errors
()
76
{
77
last_error_message
.clear();
78
}
79
private
:
80
std::mutex
mutex
;
81
std::list<rosbag_content>
m_files
;
82
std::string
last_error_message
;
83
};
84
}
rs2::textual_icons::lock
static const textual_icon lock
Definition:
model-views.h:218
rosbag_inspector::files_container::size
size_t size()
Definition:
files_container.h:20
rosbag_inspector::files_container::operator[]
rosbag_content & operator[](int index)
Definition:
files_container.h:25
rosbag_inspector::files_container::AddFiles
void AddFiles(std::vector< std::string > const &files)
Definition:
files_container.h:46
rosbag_inspector::files_container::get_last_error
std::string get_last_error()
Definition:
files_container.h:71
rosbag_inspector::files_container::remove_file
int remove_file(int index)
Definition:
files_container.h:35
rosbag_inspector::files_container::mutex
std::mutex mutex
Definition:
files_container.h:80
rosbag_inspector::tmpstringstream
Definition:
print_helpers.h:30
string
GLsizei const GLchar *const * string
Definition:
glad/glad/glad.h:2862
rmse.e
e
Definition:
rmse.py:177
distance
GLsizei GLsizei GLfloat distance
Definition:
glext.h:10563
index
GLuint index
Definition:
glad/glad/glad.h:2778
rosbag_inspector
Definition:
files_container.h:15
rosbag_inspector::files_container
Definition:
files_container.h:17
rosbag_content.h
r
GLdouble GLdouble r
Definition:
glad/glad/glad.h:1854
rosbag_inspector::files_container::has_errors
bool has_errors() const
Definition:
files_container.h:67
files
files_container files
Definition:
rs-rosbag-inspector.cpp:36
print_helpers.h
rosbag_inspector::rosbag_content
Definition:
rosbag_content.h:29
rosbag_inspector::files_container::clear_errors
void clear_errors()
Definition:
files_container.h:75
it
static auto it
Definition:
openvino-face-detection.cpp:372
rosbag_inspector::files_container::m_files
std::list< rosbag_content > m_files
Definition:
files_container.h:81
rosbag_inspector::files_container::last_error_message
std::string last_error_message
Definition:
files_container.h:82
advance
unsigned char advance
Definition:
stb_easy_font.h:106
std::to_string
std::string to_string(T value)
Definition:
android_helpers.h:16
librealsense2
Author(s): Sergey Dorodnicov
, Doron Hirshberg
, Mark Horn
, Reagan Lopez
, Itay Carpis
autogenerated on Mon May 3 2021 02:47:14