Gazebo Transport

API Reference

11.4.1
gz/transport/log/QualifiedTime.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 #ifndef GZ_TRANSPORT_LOG_QUALIFIEDTIME_HH_
18 #define GZ_TRANSPORT_LOG_QUALIFIEDTIME_HH_
19 
20 #include <chrono>
21 #include <cstdint>
22 #include <memory>
23 
24 #include <gz/transport/config.hh>
25 #include <gz/transport/log/Export.hh>
26 
28 {
29  // Inline bracket to help doxygen filtering.
30  inline namespace IGNITION_TRANSPORT_VERSION_NAMESPACE {
31  //
40  class IGNITION_TRANSPORT_LOG_VISIBLE QualifiedTime
41  {
44  public: enum class Qualifier : int64_t
45  {
49  INCLUSIVE = 0,
50 
55  EXCLUSIVE
56  };
57 
71 
77  public: QualifiedTime(const Time &_time,
78  Qualifier _qualifier = Qualifier::INCLUSIVE);
79 
86  public: template <typename Rep, typename Period>
88  Qualifier _qualifier = Qualifier::INCLUSIVE)
89  : QualifiedTime(static_cast<const Time &>(_time), _qualifier) { }
90 
95  public: QualifiedTime(/* Indeterminate */);
96 
99  public: QualifiedTime(const QualifiedTime &_other);
100 
104  public: QualifiedTime &operator=(const QualifiedTime &_other);
105 
108  public: QualifiedTime(QualifiedTime &&_old) = default; // NOLINT
109 
112  public: QualifiedTime &operator=(
113  QualifiedTime &&) = default; // NOLINT(build/c++11)
114 
120  public: bool operator==(const QualifiedTime &_other) const;
121 
125  public: bool operator!=(const QualifiedTime &_other) const;
126 
136  public: bool IsIndeterminate() const;
137 
143  public: const Time *GetTime() const;
144 
150  public: const Qualifier *GetQualifier() const;
151 
157  public: void SetTime(const Time &_time,
158  Qualifier _qualifier = Qualifier::INCLUSIVE);
159 
162  public: void Clear();
163 
165  public: ~QualifiedTime();
166 
168  private: class Implementation;
169 
170 #ifdef _WIN32
171 // Disable warning C4251 which is triggered by
172 // std::*
173 #pragma warning(push)
174 #pragma warning(disable: 4251)
175 #endif
176  private: std::unique_ptr<Implementation, void (*)(Implementation*)> dataPtr;
179 #ifdef _WIN32
180 #pragma warning(pop)
181 #endif
182  };
183 
188  class IGNITION_TRANSPORT_LOG_VISIBLE QualifiedTimeRange
189  {
196  public: QualifiedTimeRange(
197  const QualifiedTime &_begin,
198  const QualifiedTime &_end);
199 
202  public: QualifiedTimeRange(const QualifiedTimeRange &_other);
203 
207  public: QualifiedTimeRange &operator=(const QualifiedTimeRange &_other);
208 
211  public: QualifiedTimeRange(QualifiedTimeRange &&_old); // NOLINT
212 
215  public: QualifiedTimeRange &operator=(
216  QualifiedTimeRange &&) = default; // NOLINT(build/c++11)
217 
222  public: bool operator==(const QualifiedTimeRange &_other) const;
223 
227  public: bool operator!=(const QualifiedTimeRange &_other) const;
228 
232  public: static QualifiedTimeRange From(const QualifiedTime &_begin);
233 
238  public: static QualifiedTimeRange Until(const QualifiedTime &_end);
239 
242  public: static QualifiedTimeRange AllTime();
243 
246  public: const QualifiedTime &Beginning() const;
247 
250  public: const QualifiedTime &Ending() const;
251 
261  public: bool SetBeginning(const QualifiedTime &_begin);
262 
272  public: bool SetEnding(const QualifiedTime &_end);
273 
283  public: bool SetRange(const QualifiedTime &_begin,
284  const QualifiedTime &_end);
285 
290  public: bool Valid() const;
291 
293  public: ~QualifiedTimeRange();
294 
296  private: class Implementation;
297 
298 #ifdef _WIN32
299 // Disable warning C4251 which is triggered by
300 // std::*
301 #pragma warning(push)
302 #pragma warning(disable: 4251)
303 #endif
304  private: std::unique_ptr<Implementation, void(*)(Implementation*)> dataPtr;
307 #ifdef _WIN32
308 #pragma warning(pop)
309 #endif
310  };
311  }
312 }
313 
314 #endif
The QualifiedTimeRange class provides a pair of qualified times that represent a range....
Definition: gz/transport/log/QualifiedTime.hh:188
QualifiedTime(const std::chrono::duration< Rep, Period > &_time, Qualifier _qualifier=Qualifier::INCLUSIVE)
Construct a qualified time specifier. This allows implicit conversion from any std::chrono::duration ...
Definition: gz/transport/log/QualifiedTime.hh:87
STL class.
Since time is continuous, it may be difficult to know the exact time stamp of a desired message....
Definition: gz/transport/log/QualifiedTime.hh:40
Definition: gz/transport/log/Batch.hh:27
Qualifier
The Qualifier determines the behavior of how a message is selected.
Definition: gz/transport/log/QualifiedTime.hh:44