12 fut.
connect(&AutoService::onServiceModified,
this, fut);
14 _session->serviceRegistered.connect(&AutoService::onServiceAdded,
this, _2);
15 _session->serviceUnregistered.connect(&AutoService::onServiceRemoved,
this, _2);
30 boost::mutex::scoped_lock scoped_lock(_mutex);
44 boost::mutex::scoped_lock scoped_lock(_mutex);
46 if (!_promise.future().isFinished())
54 boost::mutex::scoped_lock scoped_lock(_mutex);
63 void AutoService<T>::onServiceAdded(
const std::string& name)
67 boost::mutex::scoped_lock scoped_lock(_mutex);
69 future.
connect(&AutoService::onServiceModified,
this, future);
82 boost::mutex::scoped_lock scoped_lock(_mutex);
87 throw std::runtime_error(
"Service " + _name +
" unavailable");
93 boost::mutex::scoped_lock scoped_lock(_mutex);
98 throw std::runtime_error(
"Service " + _name +
" unavailable");
101 template <
typename T>
104 boost::mutex::scoped_lock scoped_lock(_mutex);
108 throw std::runtime_error(
"Service " + _name +
" unavailable");
111 template <
typename T>
114 boost::mutex::scoped_lock scoped_lock(_mutex);
118 throw std::runtime_error(
"Service " + _name +
" unavailable");
121 template <
typename T>
128 template <
typename T>
131 return _promise.future();
134 template <
typename T>
137 boost::mutex::scoped_lock scoped_lock(_mutex);
139 return _object.asGenericObject();
141 throw std::runtime_error(
"Service " + _name +
" unavailable");
153 virtual void forbiden() = 0;
159 template <
typename T>
qi::GenericObject * asGenericObject() const
boost::shared_ptr< Session > SessionPtr
void destroy()
Stop and flush the logging system.
void connect(const AF &fun, FutureCallbackType type=FutureCallbackType_Auto)
qi::detail::Keeper< T > operator->()
qi::FutureSync< void > waitForReady()
AutoService(const std::string &name, qi::SessionPtr session)
Keeper(qi::Object< T > &obj)
Object tracking by blocking destruction while shared pointers are present.
const ValueType & value(int msecs=FutureTimeout_Infinite) const
Return the value associated to a Future.
bool hasError(int msecs=FutureTimeout_Infinite) const