15 #ifndef STXXL_COMPLETION_HANDLER_HEADER
16 #define STXXL_COMPLETION_HANDLER_HEADER
20 #include <stxxl/bits/namespace.h>
23 __STXXL_BEGIN_NAMESPACE
27 class completion_handler_impl
30 virtual void operator () (
request *) = 0;
31 virtual completion_handler_impl * clone()
const = 0;
32 virtual ~completion_handler_impl() { }
53 completion_handler_impl * p = sp_impl_.release();
54 sp_impl_.reset(copy.sp_impl_.release());
55 copy.sp_impl_.reset(p);
58 void operator () (
request * req)
62 template <
typename handler_type>
66 std::auto_ptr<completion_handler_impl> sp_impl_;
69 template <
typename handler_type>
70 class completion_handler1 :
public completion_handler_impl
73 handler_type handler_;
76 completion_handler1(
const handler_type & handler__) : handler_(handler__) { }
77 completion_handler1 * clone()
const
79 return new completion_handler1(*
this);
81 void operator () (
request * req)
87 template <
typename handler_type>
88 completion_handler::completion_handler(
const handler_type & handler__) :
89 sp_impl_(new completion_handler1<handler_type>(handler__))
94 #endif // !STXXL_COMPLETION_HANDLER_HEADER