5 #ifndef CVMFS_UTIL_ASYNC_H_
6 #define CVMFS_UTIL_ASYNC_H_
8 #ifdef CVMFS_NAMESPACE_GUARD
9 namespace CVMFS_NAMESPACE_GUARD {
20 template <
typename ParamT>
24 virtual void operator()(
const ParamT &value)
const = 0;
31 virtual void operator()()
const = 0;
44 template <
typename ParamT>
47 typedef void (*CallbackFunction)(
const ParamT &value);
49 explicit Callback(CallbackFunction
function) : function_(function) {}
50 void operator()(
const ParamT &value)
const { function_(value); }
59 typedef void (*CallbackFunction)();
61 explicit Callback(CallbackFunction
function) : function_(function) {}
83 template <
typename ParamT,
class DelegateT>
86 typedef void (DelegateT::*CallbackMethod)(
const ParamT &value);
92 void operator()(
const ParamT &value)
const { (delegate_->*method_)(value); }
99 template <
class DelegateT>
102 typedef void (DelegateT::*CallbackMethod)();
105 delegate_(delegate), method_(method) {}
128 template <
typename ParamT,
class DelegateT,
typename ClosureDataT>
131 typedef void (DelegateT::*CallbackMethod)(
const ParamT &value,
132 const ClosureDataT closure_data);
140 closure_data_(data) {}
143 (delegate_->*method_)(value, closure_data_);
152 template <
class DelegateT,
typename ClosureDataT>
155 typedef void (DelegateT::*CallbackMethod)(
const ClosureDataT closure_data);
161 delegate_(delegate), method_(method), closure_data_(data) {}
163 void operator()()
const { (delegate_->*method_)(closure_data_); }
189 template <
class ParamT>
203 template <
class DelegateT,
typename ClosureDataT>
206 CallbackMethod method,
208 const ClosureDataT &closure_data)
221 template <
class DelegateT>
224 DelegateT *delegate) {
247 template <
class DelegateT>
249 void (DelegateT::*method)()) {
250 (*delegate.*method)();
255 #ifdef CVMFS_NAMESPACE_GUARD
259 #endif // CVMFS_UTIL_ASYNC_H_
CallbackFunction function_
const ClosureDataT closure_data_
void operator()(const ParamT &value) const
static CallbackTN * MakeCallback(typename BoundCallback< ParamT, DelegateT >::CallbackMethod method, DelegateT *delegate)
Callback(CallbackFunction function)
const ClosureDataT closure_data_
void operator()(const ParamT &value) const
BoundCallback(CallbackMethod method, DelegateT *delegate)
Callback(CallbackFunction function)
void operator()(const ParamT &value) const
BoundCallback(CallbackMethod method, DelegateT *delegate)
BoundClosure(CallbackMethod method, DelegateT *delegate, ClosureDataT data)
static CallbackTN * MakeCallback(typename Callback< ParamT >::CallbackFunction function)
void ThreadProxy(DelegateT *delegate, void(DelegateT::*method)())
CallbackBase< ParamT > CallbackTN
CallbackFunction function_
BoundClosure(CallbackMethod method, DelegateT *delegate, ClosureDataT data)
static CallbackTN * MakeClosure(typename BoundClosure< ParamT, DelegateT, ClosureDataT >::CallbackMethod method, DelegateT *delegate, const ClosureDataT &closure_data)