Gazebo Transport

API Reference

14.1.0
Recorder.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_RECORDER_HH_
18#define GZ_TRANSPORT_LOG_RECORDER_HH_
19
20#include <cstdint>
21#include <memory>
22#include <regex>
23#include <set>
24#include <string>
25
26#include <gz/transport/Clock.hh>
27#include <gz/transport/config.hh>
28#include <gz/transport/log/Export.hh>
29
30namespace gz::transport::log
31{
32 // Inline bracket to help doxygen filtering.
33 inline namespace GZ_TRANSPORT_VERSION_NAMESPACE {
34 //
35 enum class RecorderError : int64_t
36 {
37 SUCCESS = 0,
38 FAILED_TO_OPEN = -1,
41 INVALID_TOPIC = -4,
42 TOPIC_NOT_FOUND = -5,
44 };
45
50 class GZ_TRANSPORT_LOG_VISIBLE Recorder
51 {
53 public: Recorder();
54
57 public: Recorder(Recorder &&_old); // NOLINT
58
60 public: ~Recorder();
61
68 public: RecorderError Sync(const Clock *_clockIn);
69
74 public: RecorderError Start(const std::string &_file);
75
79 public: void Stop();
80
86 public: RecorderError AddTopic(const std::string &_topic);
87
95 public: int64_t AddTopic(const std::regex &_topic);
96
100 public: std::string Filename() const;
101
105 public: const std::set<std::string> &Topics() const;
106
110 public: std::size_t BufferSize() const;
111
117 public: void SetBufferSize(std::size_t _size);
118
120 private: class Implementation;
121
122#ifdef _WIN32
123// Disable warning C4251 which is triggered by
124// std::*
125#pragma warning(push)
126#pragma warning(disable: 4251)
127#endif
129 private: std::unique_ptr<Implementation> dataPtr;
130#ifdef _WIN32
131#pragma warning(pop)
132#endif
133 };
134 }
135}
136#endif