Robot Raconteur Core C++ Library
Loading...
Searching...
No Matches
RobotRaconteur::SubObjectSubscription Class Reference

Subscription for sub objects of the default client. More...

#include <Subscription.h>

Public Member Functions

template<typename T>
boost::shared_ptr< T > GetDefaultClient ()
 Get the "default client" sub object.
template<typename T>
bool TryGetDefaultClient (boost::shared_ptr< T > &client_out)
 Try getting the "default client" sub object.
template<typename T>
boost::shared_ptr< T > GetDefaultClientWait (int32_t timeout=RR_TIMEOUT_INFINITE)
 Get the "default client" sub object, waiting for a specified timeout.
template<typename T>
bool TryGetDefaultClientWait (boost::shared_ptr< T > &client_out, int32_t timeout=RR_TIMEOUT_INFINITE)
 Try getting the "default client" sub object, waiting for a specified timeout.
template<typename T>
void AsyncGetDefaultClient (boost::function< void(const boost::shared_ptr< T > &, const boost::shared_ptr< RobotRaconteurException > &)> handler, int32_t timeout=RR_TIMEOUT_INFINITE)
 Asynchronously get the "default client" sub object.
void Close ()
 Closes the sub object subscription.

Detailed Description

Subscription for sub objects of the default client.

SubObjectSubscription is used to access sub objects of the default client. Sub objects are objects within a service that are not the root object. Sub objects are typically referenced using objref members, however they can also be referenced using a service path. The SubObjectSubscription class is used to automatically access sub objects of the default client.

Use ServiceSubscription::SubscribeSubObject() to create a SubObjectSubscription.

This class should not be used to access Pipe or Wire members. Use the ServiceSubscription::SubscribePipe() and ServiceSubscription::SubscribeWire() functions to access Pipe and Wire members.

Member Function Documentation

◆ AsyncGetDefaultClient()

template<typename T>
void RobotRaconteur::SubObjectSubscription::AsyncGetDefaultClient ( boost::function< void(const boost::shared_ptr< T > &, const boost::shared_ptr< RobotRaconteurException > &)> handler,
int32_t timeout = RR_TIMEOUT_INFINITE )
inline

Asynchronously get the "default client" sub object.

Asynchronous version of GetDefaultClient()

The handler function is called when the client is retrieved or an error occurs.

Template Parameters
TThe type of the sub object
Parameters
handlerThe handler function
timeoutThe timeout in milliseconds

◆ Close()

void RobotRaconteur::SubObjectSubscription::Close ( )

Closes the sub object subscription.

Sub object subscriptions are automatically closed when the parent ServiceSubscription is closed or when the node is shut down.

◆ GetDefaultClient()

template<typename T>
boost::shared_ptr< T > RobotRaconteur::SubObjectSubscription::GetDefaultClient ( )
inline

Get the "default client" sub object.

The sub object is retrieved from the default client. The default client is the first client that connected to the service. If no clients are currently connected, an exception is thrown.

Clients using GetDefaultClient() should not store a reference to the client. Call GetDefaultClient() each time the client is needed.

Template Parameters
TThe type of the sub object
Returns
RR_SHARED_PTR<T> The sub object

◆ GetDefaultClientWait()

template<typename T>
boost::shared_ptr< T > RobotRaconteur::SubObjectSubscription::GetDefaultClientWait ( int32_t timeout = RR_TIMEOUT_INFINITE)
inline

Get the "default client" sub object, waiting for a specified timeout.

The sub object is retrieved from the default client. The default client is the first client that connected to the service. If no clients are currently connected, an exception is thrown.

Clients using GetDefaultClient() should not store a reference to the client. Call GetDefaultClient() each time the client is needed.

This function blocks the current thread until the client is retrieved or the timeout is reached.

Template Parameters
TThe type of the sub object
Parameters
timeoutThe timeout in milliseconds
Returns
RR_SHARED_PTR<T> The sub object

◆ TryGetDefaultClient()

template<typename T>
bool RobotRaconteur::SubObjectSubscription::TryGetDefaultClient ( boost::shared_ptr< T > & client_out)
inline

Try getting the "default client" sub object.

Same as GetDefaultClient(), but returns a bool for success or failure instead of throwing an exception on failure.

Template Parameters
TThe type of the sub object
Parameters
client_out[out] The sub object
Returns
true The sub object was retrieved successfully
false The sub object could not be retrieved

◆ TryGetDefaultClientWait()

template<typename T>
bool RobotRaconteur::SubObjectSubscription::TryGetDefaultClientWait ( boost::shared_ptr< T > & client_out,
int32_t timeout = RR_TIMEOUT_INFINITE )
inline

Try getting the "default client" sub object, waiting for a specified timeout.

Same as GetDefaultClientWait(), but returns a bool for success or failure instead of throwing an exception on failure.

Template Parameters
TThe type of the sub object
Parameters
client_out[out] The sub object
timeoutThe timeout in milliseconds
Returns
true The sub object was retrieved successfully
false The sub object could not be retrieved

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