Gazebo Transport

API Reference

13.4.0
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
34 {
35  namespace transport
36  {
37  namespace log
38  {
39  // Inline bracket to help doxygen filtering.
40  inline namespace GZ_TRANSPORT_VERSION_NAMESPACE {
41  //
45  class GZ_TRANSPORT_LOG_VISIBLE QueryOptions
46  {
52  const Descriptor &_descriptor) const = 0;
53 
68 
75 
77  public: virtual ~QueryOptions() = default;
78  };
79 
83  class GZ_TRANSPORT_LOG_VISIBLE TimeRangeOption
84  {
87  public: explicit TimeRangeOption(const QualifiedTimeRange &_timeRange);
88 
91  public: TimeRangeOption(const TimeRangeOption &_other);
92 
95  public: TimeRangeOption(TimeRangeOption &&_other); // NOLINT
96 
101 
105  public: const QualifiedTimeRange &TimeRange() const;
106 
112 
114  public: ~TimeRangeOption();
115 
117  private: class Implementation;
118 
119 #ifdef _WIN32
120 // Disable warning C4251 which is triggered by
121 // std::*
122 #pragma warning(push)
123 #pragma warning(disable: 4251)
124 #endif
126  private: std::unique_ptr<Implementation> dataPtr;
127 #ifdef _WIN32
128 #pragma warning(pop)
129 #endif
130  };
131 
134  class GZ_TRANSPORT_LOG_VISIBLE TopicList final
135  : public virtual QueryOptions,
136  public virtual TimeRangeOption
137  {
142  public: TopicList(
143  const std::set<std::string> &_topics = { },
144  const QualifiedTimeRange &_timeRange = QualifiedTimeRange::AllTime());
145 
151  public: template <typename Container>
153  const Container &_topics,
154  const QualifiedTimeRange &_timeRange = QualifiedTimeRange::AllTime());
155 
160  public: TopicList(
161  const std::string &_singleTopic,
162  const QualifiedTimeRange &_timeRange = QualifiedTimeRange::AllTime());
163 
166  public: TopicList(const TopicList &_other);
167 
170  public: TopicList(TopicList &&_other); // NOLINT(whitespace/operators)
171 
176 
180  public: const std::set<std::string> &Topics() const;
181 
182  // Documentation inherited
184  const Descriptor &_descriptor) const override;
185 
187  public: ~TopicList();
188 
190  private: class Implementation;
191 
192 #ifdef _WIN32
193 // Disable warning C4251 which is triggered by
194 // std::*
195 #pragma warning(push)
196 #pragma warning(disable: 4251)
197 #endif
199  private: std::unique_ptr<Implementation> dataPtr;
200 #ifdef _WIN32
201 #pragma warning(pop)
202 #endif
203  };
204 
207  class GZ_TRANSPORT_LOG_VISIBLE TopicPattern final
208  : public virtual QueryOptions,
209  public virtual TimeRangeOption
210  {
215  public: TopicPattern(
216  const std::regex &_pattern,
217  const QualifiedTimeRange &_timeRange = QualifiedTimeRange::AllTime());
218 
221  public: TopicPattern(const TopicPattern &_other);
222 
225  public: TopicPattern(TopicPattern &&_other); // NOLINT
226 
230  public: std::regex &Pattern();
231 
235  public: const std::regex &Pattern() const;
236 
237  // Documentation inherited
239  const Descriptor &_descriptor) const override;
240 
242  public: ~TopicPattern();
243 
245  private: class Implementation;
246 
247 #ifdef _WIN32
248 // Disable warning C4251 which is triggered by
249 // std::*
250 #pragma warning(push)
251 #pragma warning(disable: 4251)
252 #endif
254  private: std::unique_ptr<Implementation> dataPtr;
255 #ifdef _WIN32
256 #pragma warning(pop)
257 #endif
258  };
259 
262  class GZ_TRANSPORT_LOG_VISIBLE AllTopics final
263  : public virtual QueryOptions,
264  public virtual TimeRangeOption
265  {
269  public: explicit AllTopics(
270  const QualifiedTimeRange &_timeRange = QualifiedTimeRange::AllTime());
271 
274  public: AllTopics(const AllTopics &_other);
275 
278  public: AllTopics(AllTopics &&_other); // NOLINT(whitespace/operators)
279 
280  // Documentation inherited
282  const Descriptor &_descriptor) const override;
283 
285  public: ~AllTopics();
286 
288  private: class Implementation;
289 
290 #ifdef _WIN32
291 // Disable warning C4251 which is triggered by
292 // std::*
293 #pragma warning(push)
294 #pragma warning(disable: 4251)
295 #endif
297  private: std::unique_ptr<Implementation> dataPtr;
298 #ifdef _WIN32
299 #pragma warning(pop)
300 #endif
301  };
302  }
303  }
304  }
305 }
306 
307 #include <gz/transport/log/detail/QueryOptions.hh>
308 
309 #endif