Gazebo Transport

API Reference

14.1.0
Log.hh
Go to the documentation of this file.
1/*
2 * Copyright (C) 2018 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
18#ifndef GZ_TRANSPORT_LOG_LOG_HH_
19#define GZ_TRANSPORT_LOG_LOG_HH_
20
21#include <chrono>
22#include <ios>
23#include <memory>
24#include <string>
25
26#include <gz/transport/config.hh>
30#include <gz/transport/log/Export.hh>
31
32namespace gz::transport::log
33{
34 // Inline bracket to help doxygen filtering.
35 inline namespace GZ_TRANSPORT_VERSION_NAMESPACE {
36 //
38 const std::string SchemaLocationEnvVar = "GZ_TRANSPORT_LOG_SQL_PATH";
39
41 class GZ_TRANSPORT_LOG_VISIBLE Log
42 {
44 public: Log();
45
48 public: Log(Log &&_old); // NOLINT
49
51 public: ~Log();
52
55 public: bool Valid() const;
56
60 public: std::string Version() const;
61
67 public: bool Open(const std::string &_file,
68 std::ios_base::openmode _mode = std::ios_base::in);
69
73 public: std::string Filename() const;
74
80 public: const log::Descriptor *Descriptor() const;
81
89 public: bool InsertMessage(
90 const std::chrono::nanoseconds &_time,
91 const std::string &_topic, const std::string &_type,
92 const void *_data, std::size_t _len);
93
99 public: Batch QueryMessages(const QueryOptions &_options = AllTopics());
100
106
112
114 private: class Implementation;
115
116#ifdef _WIN32
117// Disable warning C4251 which is triggered by
118// std::*
119#pragma warning(push)
120#pragma warning(disable: 4251)
121#endif
123 private: std::unique_ptr<Implementation> dataPtr;
124#ifdef _WIN32
125#pragma warning(pop)
126#endif
127 };
128 }
129}
130#endif