Gazebo Transport
API Reference
14.1.0
insert_drive_file
Tutorials
library_books
Classes
toc
Namespaces
insert_drive_file
Files
launch
Gazebo Website
Index
List
Hierarchy
Members: All
Members: Functions
Members: Variables
Members: Typedefs
Members: Enumerations
Members: Enumerator
List
Members
Functions
Typedefs
Variables
Enumerations
Enumerator
src
gz-transport
log
include
gz
transport
log
Playback.hh
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2017 Open Source Robotics Foundation
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
#ifndef GZ_TRANSPORT_LOG_PLAYBACK_HH_
18
#define GZ_TRANSPORT_LOG_PLAYBACK_HH_
19
20
#include <chrono>
21
#include <memory>
22
#include <regex>
23
#include <string>
24
25
#include <gz/transport/config.hh>
26
#include <gz/transport/log/Export.hh>
27
#include <
gz/transport/NodeOptions.hh
>
28
29
namespace
gz::transport::log
30
{
31
// Inline bracket to help doxygen filtering.
32
inline
namespace
GZ_TRANSPORT_VERSION_NAMESPACE {
33
//
34
// Forward declarations
35
class
PlaybackHandle;
36
using
PlaybackHandlePtr
=
std::shared_ptr<PlaybackHandle>
;
37
43
class
GZ_TRANSPORT_LOG_VISIBLE
Playback
44
{
48
public
:
explicit
Playback
(
const
std::string
&_file,
49
const
NodeOptions &_nodeOptions = NodeOptions());
50
53
public
:
Playback
(
Playback
&&_old);
// NOLINT
54
56
public
:
~Playback
();
57
87
public
: [[nodiscard]]
PlaybackHandlePtr
Start
(
88
const
std::chrono::nanoseconds
&_waitAfterAdvertising =
89
std::chrono::seconds
(1),
90
bool
_msgWaiting =
true
)
const
;
91
94
public
:
bool
Valid
()
const
;
95
102
public
:
bool
AddTopic
(
const
std::string
&_topic);
103
110
public
: int64_t
AddTopic
(
const
std::regex
&_topic);
111
121
public
:
bool
RemoveTopic
(
const
std::string
&_topic);
122
133
public
: int64_t
RemoveTopic
(
const
std::regex
&_topic);
134
136
private
:
class
Implementation;
137
138
#ifdef _WIN32
139
// Disable warning C4251 which is triggered by
140
// std::*
141
#pragma warning(push)
142
#pragma warning(disable: 4251)
143
#endif
145
private
:
std::unique_ptr<Implementation>
dataPtr;
146
#ifdef _WIN32
147
#pragma warning(pop)
148
#endif
149
};
150
159
class
GZ_TRANSPORT_LOG_VISIBLE
PlaybackHandle
160
{
162
public
:
void
Stop
();
163
166
public
:
void
Seek
(
const
std::chrono::nanoseconds
&_newElapsedTime);
167
171
public
:
void
Step
(
const
std::chrono::nanoseconds
&_stepDuration);
172
174
public
:
void
Pause
();
175
177
public
:
void
Resume
();
178
180
public
:
bool
IsPaused
()
const
;
181
183
public
:
void
WaitUntilFinished
();
184
187
public
:
bool
Finished
()
const
;
188
191
public
:
std::chrono::nanoseconds
StartTime
()
const
;
192
195
public
:
std::chrono::nanoseconds
CurrentTime
()
const
;
196
199
public
:
std::chrono::nanoseconds
EndTime
()
const
;
200
202
public
:
~PlaybackHandle
();
203
204
// Friendship
205
friend
class
Playback
;
206
207
// Forward declaration of implementation class
208
private
:
class
Implementation;
209
211
private
:
PlaybackHandle
(
212
std::unique_ptr<Implementation>
&&_internal);
// NOLINT
213
214
#ifdef _WIN32
215
// Disable warning C4251 which is triggered by
216
// std::*
217
#pragma warning(push)
218
#pragma warning(disable: 4251)
219
#endif
221
private
:
std::unique_ptr<Implementation>
dataPtr;
222
#ifdef _WIN32
223
#pragma warning(pop)
224
#endif
225
};
226
}
227
}
228
#endif