9 #ifndef _QI_TRACKABLE_HPP_
10 # define _QI_TRACKABLE_HPP_
12 # include <boost/thread/mutex.hpp>
13 # include <boost/shared_ptr.hpp>
14 # include <boost/thread/condition_variable.hpp>
15 # include <boost/function.hpp>
17 # include <ka/typetraits.hpp>
19 # include <ka/macroregular.hpp>
59 boost::weak_ptr<T>
weakPtr()
const;
75 boost::shared_ptr<T> _ptr;
76 boost::condition_variable _cond;
84 virtual const char*
what()
const throw()
86 return "Pointer Lock failed";
96 template<
typename RF,
typename AF> boost::function<RF>
bind(
const AF& fun, ...);
106 template<
typename F,
typename ARG0>
107 boost::function<F>
track(boost::function<F> f,
const ARG0& arg0);
115 template<
typename F,
typename ARG0>
116 boost::function<F>
trackWithFallback(boost::function<
void()> onFail, boost::function<F> f,
const ARG0& arg0);
123 template<
typename Proc,
typename T>
132 auto operator()(F&& f) const -> decltype(
142 template<
typename Proc,
typename T>
145 return {std::forward<Proc>(fallback), t};
161 auto operator()(F&& f) const -> decltype(
164 return trackSilent(std::forward<F>(f), _trackable);
179 #endif // _QI_TRACKABLE_HPP_
auto trackWithFallback(boost::function< void()> onFail, F &&f, T &&toTrack) -> decltype(detail::BindTransform< T >::wrap(std::forward< T >(toTrack), std::forward< F >(f), std::move(onFail)))
auto track(F &&f, T &&toTrack) -> decltype(trackWithFallback(detail::throwPointerLockException, std::forward< F >(f), std::forward< T >(toTrack)))
QI_API_DEPRECATED_MSG(Use default constructor instead) Trackable(T *ptr)
TrackWithFallbackTransfo< ka::Decay< Proc >, T > trackWithFallbackTransfo(Proc &&fallback, T *t)
TrackSilentTransfo< T > trackSilentTransfo(T *t)
Various macros for qi. (deprecated, export API, disallow copy, ..) <includename>qi/macro.hpp</includename> .
boost::weak_ptr< T > weakPtr() const
Object tracking by blocking destruction while shared pointers are present.
virtual const char * what() const
auto trackSilent(F &&f, T &&toTrack) -> decltype(trackWithFallback(
std::enable_if< std::is_function< RF >::value, boost::function< RF > >::type bind(AF &&fun, Arg0 &&arg0, Args &&...args)
Trackable()
Default constructor.
Common base class to templates Trackable for compile-time detection.