IntrospectionClient.hh
Go to the documentation of this file.
1/*
2 * Copyright (C) 2016 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 GAZEBO_UTIL_INTROSPECTION_CLIENT_HH_
18#define GAZEBO_UTIL_INTROSPECTION_CLIENT_HH_
19
20#include <chrono>
21#include <functional>
22#include <memory>
23#include <set>
24#include <string>
25#include "gazebo/util/system.hh"
26
27namespace gazebo
28{
29 namespace util
30 {
31 // Forward declare private data classes.
32 class IntrospectionClientPrivate;
33
36
39 class GZ_UTIL_VISIBLE IntrospectionClient
40 {
43
45 public: virtual ~IntrospectionClient();
46
56 public: std::set<std::string> WaitForManagers(
57 const std::chrono::milliseconds _timeOut =
58 std::chrono::milliseconds::zero()) const;
59
62 public: std::set<std::string> Managers() const;
63
75 public: bool NewFilter(const std::string &_managerId,
76 const std::set<std::string> &_newItems,
77 std::string &_filterId,
78 std::string &_newTopic) const;
79
95 public: bool NewFilter(const std::string &_managerId,
96 const std::set< std::string> &_newItems,
97 const std::function <void(
98 const std::string &_filterId,
99 const std::string &_newTopic,
100 const bool _result)> &_cb) const;
101
108 public: bool UpdateFilter(const std::string &_managerId,
109 const std::string &_filterId,
110 const std::set<std::string> &_newItems) const;
111
123 public: bool UpdateFilter(const std::string &_managerId,
124 const std::string &_filterId,
125 const std::set<std::string> &_newItems,
126 const std::function <void(
127 const bool _result)> &_cb) const;
128
133 public: bool RemoveAllFilters() const;
134
140 public: bool RemoveFilter(const std::string &_managerId,
141 const std::string &_filterId) const;
142
153 public: bool RemoveFilter(const std::string &_managerId,
154 const std::string &_filterId,
155 const std::function <void(
156 const bool _result)> &_cb) const;
157
164 public: bool Items(const std::string &_managerId,
165 std::set<std::string> &_items) const;
166
177 public: bool Items(const std::string &_managerId,
178 const std::function <void(
179 const std::set<std::string> &_items,
180 const bool _result)> &_cb) const;
181
188 public: bool IsRegistered(const std::string &_managerId,
189 const std::string &_item) const;
190
197 public: bool IsRegistered(const std::string &_managerId,
198 const std::set<std::string> &_items) const;
199
205 private: bool IsManagerUsed(const std::string &_managerId) const;
206
209 private: std::unique_ptr<IntrospectionClientPrivate> dataPtr;
210 };
212 }
213}
214#endif
util
Definition Diagnostics.hh:33
addtogroup gazebo_util
Definition IntrospectionClient.hh:40
bool IsRegistered(const std::string &_managerId, const std::string &_item) const
Check if the _item is registered on a manager with _managerId.
virtual ~IntrospectionClient()
Destructor.
bool NewFilter(const std::string &_managerId, const std::set< std::string > &_newItems, const std::function< void(const std::string &_filterId, const std::string &_newTopic, const bool _result)> &_cb) const
Create a new filter for observing item updates.
bool UpdateFilter(const std::string &_managerId, const std::string &_filterId, const std::set< std::string > &_newItems) const
Update an existing filter with a different set of items.
bool IsRegistered(const std::string &_managerId, const std::set< std::string > &_items) const
Check if the _items are registered on a manager with _managerId.
std::set< std::string > Managers() const
Get the list of introspection managers currently available.
bool Items(const std::string &_managerId, const std::function< void(const std::set< std::string > &_items, const bool _result)> &_cb) const
Get a copy of the items already registered.
bool RemoveAllFilters() const
Remove all existing filters.
bool RemoveFilter(const std::string &_managerId, const std::string &_filterId, const std::function< void(const bool _result)> &_cb) const
Remove an existing filter.
bool UpdateFilter(const std::string &_managerId, const std::string &_filterId, const std::set< std::string > &_newItems, const std::function< void(const bool _result)> &_cb) const
Update an existing filter with a different set of items.
std::set< std::string > WaitForManagers(const std::chrono::milliseconds _timeOut=std::chrono::milliseconds::zero()) const
Wait for introspection managers to appear on the network.
bool RemoveFilter(const std::string &_managerId, const std::string &_filterId) const
Remove an existing filter.
bool Items(const std::string &_managerId, std::set< std::string > &_items) const
Get a copy of the items already registered.
bool NewFilter(const std::string &_managerId, const std::set< std::string > &_newItems, std::string &_filterId, std::string &_newTopic) const
Create a new filter for observing item updates.
Forward declarations for the common classes.
Definition Animation.hh:27