IntrospectionClient Class Reference

addtogroup gazebo_util More...

#include <util/util.hh>

Public Member Functions

 IntrospectionClient ()
 Constructor. More...
 
virtual ~IntrospectionClient ()
 Destructor. More...
 
bool IsRegistered (const std::string &_managerId, const std::string &_item) const
 Check if the _item is registered on a manager with _managerId. More...
 
bool IsRegistered (const std::string &_managerId, const std::set< std::string > &_items) const
 Check if the _items are registered on a manager with _managerId. More...
 
bool Items (const std::string &_managerId, std::set< std::string > &_items) const
 Get a copy of the items already registered. More...
 
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. More...
 
std::set< std::string > Managers () const
 Get the list of introspection managers currently available. More...
 
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. More...
 
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. More...
 
bool RemoveAllFilters () const
 Remove all existing filters. More...
 
bool RemoveFilter (const std::string &_managerId, const std::string &_filterId) const
 Remove an existing filter. More...
 
bool RemoveFilter (const std::string &_managerId, const std::string &_filterId, const std::function< void(const bool _result)> &_cb) const
 Remove an existing filter. More...
 
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. More...
 
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. More...
 
std::set< std::string > WaitForManagers (const std::chrono::milliseconds _timeOut=std::chrono::milliseconds::zero()) const
 Wait for introspection managers to appear on the network. More...
 

Detailed Description

addtogroup gazebo_util

Constructor & Destructor Documentation

◆ IntrospectionClient()

Constructor.

◆ ~IntrospectionClient()

virtual ~IntrospectionClient ( )
virtual

Destructor.

Member Function Documentation

◆ IsRegistered() [1/2]

bool IsRegistered ( const std::string &  _managerId,
const std::string &  _item 
) const

Check if the _item is registered on a manager with _managerId.

Parameters
[in]_managerIdId of the manager to query.
[in]_itemItem name for the query.
Returns
True if the introspection manager with ID==_managerId has an item registered with name == _item.

◆ IsRegistered() [2/2]

bool IsRegistered ( const std::string &  _managerId,
const std::set< std::string > &  _items 
) const

Check if the _items are registered on a manager with _managerId.

Parameters
[in]_managerIdId of the manager to query.
[in]_itemsSet of item names for the query.
Returns
True if the introspection manager with ID==_managerId has all the items registered.

◆ Items() [1/2]

bool Items ( const std::string &  _managerId,
std::set< std::string > &  _items 
) const

Get a copy of the items already registered.

This function will block until the result is received.

Parameters
[in]_managerIDID of the manager to request the operation.
[out]_itemsThe list of items.
Returns
True if the operation succeed or false otherwise (wrong managerID, transport problem).

◆ Items() [2/2]

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.

This function will not block, the result will be received in a callback function.

Parameters
[in]_managerIDID of the manager to request the operation.
[in]_cbCallback function executed when the response arrives. The callback has the following parameter:
[in]_itemsThe list of items.
[in]_resultResult of the request. If false, there was a problem executing your request.
Returns
True if the request was successfully sent.

◆ Managers()

std::set<std::string> Managers ( ) const

Get the list of introspection managers currently available.

Returns
Set of unique manager IDs.

◆ NewFilter() [1/2]

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.

This function will create a new topic for sending periodic updates of the items specified in the filter. This function will block until the result is received.

Parameters
[in]_managerIDID of the manager to request the operation.
[in]_newItemsNon-empty set of items to observe.
[out]_filterIdUnique ID of the filter. You'll need this ID for future filter updates or for removing it.
[out]_newTopicAfter the filter creation, a client should subscribe to this topic for receiving updates.
Returns
True if the filter was successfully created or false otherwise

◆ NewFilter() [2/2]

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.

This function will create a new topic for sending periodic updates of the items specified in the filter. This function will not block, the result will be received in a callback function.

Parameters
[in]_managerIDID of the manager to request the operation.
[in]_newItemsNon-empty set of items to observe.
[in]_cbCallback function executed when the response arrives. The callback has the following parameters:
[in]_filterIdUnique ID of the filter. You'll need this ID for future filter updates or for removing it.
[in]_newTopicAfter the filter creation, a client should subscribe to this topic for receiving updates.
[in]_resultResult of the request. If false, there was a problem executing your request.
Returns
True if the request was successfully sent.

◆ RemoveAllFilters()

bool RemoveAllFilters ( ) const

Remove all existing filters.

This function will block until the result is received.

Returns
True if the filters were successfully removed or false otherwise

◆ RemoveFilter() [1/2]

bool RemoveFilter ( const std::string &  _managerId,
const std::string &  _filterId 
) const

Remove an existing filter.

This function will block until the result is received.

Parameters
[in]_managerIDID of the manager to request the operation.
[in]_filterIdID of the filter to remove.
Returns
True if the filter was successfully removed or false otherwise

◆ RemoveFilter() [2/2]

bool RemoveFilter ( const std::string &  _managerId,
const std::string &  _filterId,
const std::function< void(const bool _result)> &  _cb 
) const

Remove an existing filter.

This function will not block, the result will be received in a callback function.

Parameters
[in]_managerIDID of the manager to request the operation.
[in]_filterIdID of the filter to remove.
[in]_cbCallback function executed when the response arrives. The callback has the following parameter:
[in]_resultResult of the request. If false, there was a problem executing your request.
Returns
True if the request was successfully sent.

◆ UpdateFilter() [1/2]

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.

This function will block until the result is received.

Parameters
[in]_managerIDID of the manager to request the operation.
[in]_filterIdID of the filter to update.
[in]_newItemsNon-empty set of items to be observed.
Returns
True if the filter was successfuly updated or false otherwise.

◆ UpdateFilter() [2/2]

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.

This function will not block, the result will be received in a callback function.

Parameters
[in]_managerIDID of the manager to request the operation.
[in]_filterIdID of the filter to update.
[in]_newItemsNon-empty set of items to be observed.
[in]_cbCallback function executed when the response arrives. The callback has the following parameter:
[in]_resultResult of the request. If false, there was a problem executing your request.
Returns
True if the request was successfully sent.

◆ WaitForManagers()

std::set<std::string> WaitForManagers ( const std::chrono::milliseconds  _timeOut = std::chrono::milliseconds::zero()) const

Wait for introspection managers to appear on the network.

This function is useful for clients that want to pause until one or more IntrospectionManagers becomes available (such as when gzserver is run).

Parameters
[in]_timeOutMaximum duration to wait. A value of std::chrono::duration::zero indicates that the function should wait indefinitely. An indefinite wait is the default behavior.
Returns
List of available managers.
See also
Managers()

The documentation for this class was generated from the following file: