Gazebo Transport

API Reference

13.4.1
QueryOptions.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_QUERYOPTIONS_HH_
19 #define GZ_TRANSPORT_LOG_QUERYOPTIONS_HH_
20 
21 #include <memory>
22 #include <regex>
23 #include <set>
24 #include <string>
25 #include <vector>
26 
27 #include <gz/transport/config.hh>
28 #include <gz/transport/log/Export.hh>
32 
33 namespace gz::transport::log
34 {
35  // Inline bracket to help doxygen filtering.
36  inline namespace GZ_TRANSPORT_VERSION_NAMESPACE {
37  //
41  class GZ_TRANSPORT_LOG_VISIBLE QueryOptions
42  {
48  const Descriptor &_descriptor) const = 0;
49 
64 
71 
73  public: virtual ~QueryOptions() = default;
74  };
75 
79  class GZ_TRANSPORT_LOG_VISIBLE TimeRangeOption
80  {
83  public: explicit TimeRangeOption(const QualifiedTimeRange &_timeRange);
84 
87  public: TimeRangeOption(const TimeRangeOption &_other);
88 
91  public: TimeRangeOption(TimeRangeOption &&_other); // NOLINT
92 
97 
101  public: const QualifiedTimeRange &TimeRange() const;
102 
108 
110  public: ~TimeRangeOption();
111 
113  private: class Implementation;
114 
115 #ifdef _WIN32
116 // Disable warning C4251 which is triggered by
117 // std::*
118 #pragma warning(push)
119 #pragma warning(disable: 4251)
120 #endif
122  private: std::unique_ptr<Implementation> dataPtr;
123 #ifdef _WIN32
124 #pragma warning(pop)
125 #endif
126  };
127 
130  class GZ_TRANSPORT_LOG_VISIBLE TopicList final
131  : public virtual QueryOptions,
132  public virtual TimeRangeOption
133  {
138  public: TopicList(
139  const std::set<std::string> &_topics = { },
140  const QualifiedTimeRange &_timeRange = QualifiedTimeRange::AllTime());
141 
147  public: template <typename Container>
149  const Container &_topics,
150  const QualifiedTimeRange &_timeRange = QualifiedTimeRange::AllTime());
151 
156  public: TopicList(
157  const std::string &_singleTopic,
158  const QualifiedTimeRange &_timeRange = QualifiedTimeRange::AllTime());
159 
162  public: TopicList(const TopicList &_other);
163 
166  public: TopicList(TopicList &&_other); // NOLINT(whitespace/operators)
167 
172 
176  public: const std::set<std::string> &Topics() const;
177 
178  // Documentation inherited
180  const Descriptor &_descriptor) const override;
181 
183  public: ~TopicList();
184 
186  private: class Implementation;
187 
188 #ifdef _WIN32
189 // Disable warning C4251 which is triggered by
190 // std::*
191 #pragma warning(push)
192 #pragma warning(disable: 4251)
193 #endif
195  private: std::unique_ptr<Implementation> dataPtr;
196 #ifdef _WIN32
197 #pragma warning(pop)
198 #endif
199  };
200 
203  class GZ_TRANSPORT_LOG_VISIBLE TopicPattern final
204  : public virtual QueryOptions,
205  public virtual TimeRangeOption
206  {
211  public: TopicPattern(
212  const std::regex &_pattern,
213  const QualifiedTimeRange &_timeRange = QualifiedTimeRange::AllTime());
214 
217  public: TopicPattern(const TopicPattern &_other);
218 
221  public: TopicPattern(TopicPattern &&_other); // NOLINT
222 
226  public: std::regex &Pattern();
227 
231  public: const std::regex &Pattern() const;
232 
233  // Documentation inherited
235  const Descriptor &_descriptor) const override;
236 
238  public: ~TopicPattern();
239 
241  private: class Implementation;
242 
243 #ifdef _WIN32
244 // Disable warning C4251 which is triggered by
245 // std::*
246 #pragma warning(push)
247 #pragma warning(disable: 4251)
248 #endif
250  private: std::unique_ptr<Implementation> dataPtr;
251 #ifdef _WIN32
252 #pragma warning(pop)
253 #endif
254  };
255 
258  class GZ_TRANSPORT_LOG_VISIBLE AllTopics final
259  : public virtual QueryOptions,
260  public virtual TimeRangeOption
261  {
265  public: explicit AllTopics(
266  const QualifiedTimeRange &_timeRange = QualifiedTimeRange::AllTime());
267 
270  public: AllTopics(const AllTopics &_other);
271 
274  public: AllTopics(AllTopics &&_other); // NOLINT(whitespace/operators)
275 
276  // Documentation inherited
278  const Descriptor &_descriptor) const override;
279 
281  public: ~AllTopics();
282 
284  private: class Implementation;
285 
286 #ifdef _WIN32
287 // Disable warning C4251 which is triggered by
288 // std::*
289 #pragma warning(push)
290 #pragma warning(disable: 4251)
291 #endif
293  private: std::unique_ptr<Implementation> dataPtr;
294 #ifdef _WIN32
295 #pragma warning(pop)
296 #endif
297  };
298  }
299 }
300 
301 #include <gz/transport/log/detail/QueryOptions.hh>
302 
303 #endif