libqi-api
2.8.7.4
|
#include <autoservice.hpp>
Public Member Functions | |
AutoService (const std::string &name, qi::SessionPtr session) | |
~AutoService () | |
qi::detail::Keeper< T > | operator-> () |
qi::detail::Keeper< T > | operator-> () const |
T & | operator* () |
T * | get () |
const T * | get () const |
qi::FutureSync< void > | waitForReady () |
qi::GenericObject * | asGenericObject () const |
![]() | |
Trackable () | |
Default constructor. More... | |
QI_API_DEPRECATED_MSG (Use default constructor instead) Trackable(AutoService< T > *ptr) | |
~Trackable () | |
boost::weak_ptr< AutoService< T > > | weakPtr () const |
void | wait () |
![]() | |
const MetaObject & | metaObject () const |
qi::Future< AnyReference > | metaCall (unsigned int method, const GenericFunctionParameters ¶ms, MetaCallType callType=MetaCallType_Auto, Signature returnSignature=Signature()) const |
qi::Future< AnyReference > | metaCall (const std::string &nameWithOptionalSignature, const GenericFunctionParameters ¶ms, MetaCallType callType=MetaCallType_Auto, Signature returnSignature=Signature()) const |
int | findMethod (const std::string &name, const GenericFunctionParameters ¶meters) const |
void | metaPost (unsigned int event, const GenericFunctionParameters ¶ms) const |
void | metaPost (const std::string &nameWithOptionalSignature, const GenericFunctionParameters &in) const |
void | post (const std::string &eventName, Args &&...args) const |
qi::FutureSync< SignalLink > | connect (const std::string &eventName, FUNCTOR_TYPE callback, MetaCallType threadingModel=MetaCallType_Auto) const |
qi::FutureSync< SignalLink > | connect (const std::string &name, const SignalSubscriber &functor) const |
qi::FutureSync< SignalLink > | connect (unsigned int signal, const SignalSubscriber &subscriber) const |
qi::FutureSync< SignalLink > | connect (unsigned int signal, AnyObject target, unsigned int slot) const |
qi::FutureSync< void > | disconnect (SignalLink linkId) const |
qi::FutureSync< T > | property (const std::string &name) const |
qi::FutureSync< AnyValue > | property (unsigned int id) const |
qi::FutureSync< void > | setProperty (const std::string &name, const T &val) const |
qi::FutureSync< void > | setProperty (unsigned int id, const AnyValue &val) const |
ExecutionContext * | executionContext () const |
bool | isStatsEnabled () const |
void | enableStats (bool enable) const |
ObjectStatistics | stats () const |
void | clearStats () const |
bool | isTraceEnabled () const |
void | enableTrace (bool enable) |
void | forceExecutionContext (boost::shared_ptr< qi::ExecutionContext > ec) |
qi::Future< R > | async (const std::string &methodName, Args &&...args) const |
R | call (const std::string &methodName, Args &&...args) const |
Public Attributes | |
qi::Signal< void > | serviceAdded |
qi::Signal< void > | serviceRemoved |
Additional Inherited Members | |
![]() | |
void | destroy () |
Service remote that automatically reconnect
Wrapper around qi::Object<T> that automatically tries to reacquire the object from the session in case of disconnection. Throws if dereferenced while the service is unavailable. The class is templated and should be used with a remote class that will call the methods of the service. (see also the test_autoservice.cpp file)
Definition at line 38 of file autoservice.hpp.
qi::AutoService< T >::AutoService | ( | const std::string & | name, |
qi::SessionPtr | session | ||
) |
Constuctor of AutoService
Automatically provides a connection to the service
name | the name of the service to use |
session | a ref to the session that will be used to find the service. |
Definition at line 6 of file autoservice.hxx.
qi::AutoService< T >::~AutoService | ( | ) |
Definition at line 19 of file autoservice.hxx.
qi::GenericObject * qi::AutoService< T >::asGenericObject | ( | ) | const |
Definition at line 135 of file autoservice.hxx.
T * qi::AutoService< T >::get | ( | ) |
Definition at line 112 of file autoservice.hxx.
const T * qi::AutoService< T >::get | ( | ) | const |
Definition at line 102 of file autoservice.hxx.
T & qi::AutoService< T >::operator* | ( | ) |
Provides an access to the <T> var stored in the AutoService
If | the connection to the Service is unavailable, throws a runtime_exception |
Definition at line 122 of file autoservice.hxx.
qi::detail::Keeper< T > qi::AutoService< T >::operator-> | ( | ) |
Provides an access to the service
Use this operator to call any method of the <T> variable stored in the AutoService. For exemple if you have a remote class called PingRemote that have a method called ping that call the matching service, you can create an AutoService<PingRemote> autoService and write autoService->ping();
If | the connection to the Service is unavailable, throws a runtime_exception |
The compiler will recursively call operator-> on each returned object until he get a pointer We return an qi::detail::Keeper<T> to keep T* alive during the call (Object<T> will be temporary stored on stack while the call is pending)
Definition at line 80 of file autoservice.hxx.
qi::detail::Keeper< T > qi::AutoService< T >::operator-> | ( | ) | const |
Definition at line 91 of file autoservice.hxx.
qi::FutureSync< void > qi::AutoService< T >::waitForReady | ( | ) |
Notify when the service is available.
Definition at line 129 of file autoservice.hxx.
qi::Signal<void> qi::AutoService< T >::serviceAdded |
This signal is triggered when your service register.
Definition at line 84 of file autoservice.hpp.
qi::Signal<void> qi::AutoService< T >::serviceRemoved |
This signal is triggered when your service is lost.
Definition at line 89 of file autoservice.hpp.