Gazebo Transport

API Reference

8.5.0
gz/transport/log/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 
32 namespace ignition
33 {
34  namespace transport
35  {
36  namespace log
37  {
38  // Inline bracket to help doxygen filtering.
39  inline namespace IGNITION_TRANSPORT_VERSION_NAMESPACE {
40  //
42  const std::string SchemaLocationEnvVar = "IGN_TRANSPORT_LOG_SQL_PATH";
43 
45  class IGNITION_TRANSPORT_LOG_VISIBLE Log
46  {
48  public: Log();
49 
52  public: Log(Log &&_old); // NOLINT
53 
55  public: ~Log();
56 
59  public: bool Valid() const;
60 
64  public: std::string Version() const;
65 
72  public: bool Open(const std::string &_file,
73  std::ios_base::openmode _mode = std::ios_base::in);
74 
78  public: std::string Filename() const;
79 
85  public: const log::Descriptor *Descriptor() const;
86 
94  public: bool InsertMessage(
95  const std::chrono::nanoseconds &_time,
96  const std::string &_topic, const std::string &_type,
97  const void *_data, std::size_t _len);
98 
104  public: Batch QueryMessages(
105  const QueryOptions &_options = AllTopics());
106 
111  public: std::chrono::nanoseconds StartTime() const;
112 
117  public: std::chrono::nanoseconds EndTime() const;
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
128  private: std::unique_ptr<Implementation> dataPtr;
130 #ifdef _WIN32
131 #pragma warning(pop)
132 #endif
133  };
134  }
135  }
136  }
137 }
138 #endif
Definition: gz/transport/AdvertiseOptions.hh:28
STL class.
Holds the result of a query for messages.
Definition: gz/transport/log/Batch.hh:41
Interface to a log file.
Definition: gz/transport/log/Log.hh:45
T log(T... args)
Query for all the topics.
Definition: gz/transport/log/QueryOptions.hh:262
const std::string SchemaLocationEnvVar
Name of Environment variable containing path to schema.
Definition: gz/transport/log/Log.hh:42
The Descriptor class provides meta-information about what a log contains. This may be useful for dete...
Definition: gz/transport/log/Descriptor.hh:45
The QueryOptions interface is used by Log::QueryMessages() to determine which messages are retrieved ...
Definition: gz/transport/log/QueryOptions.hh:45