Realistic 3D camera system
3D camera system components
signal_set_service.hpp
Go to the documentation of this file.
1 //
2 // signal_set_service.hpp
3 // ~~~~~~~~~~~~~~~~~~~~~~
4 //
5 // Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com)
6 //
7 // Distributed under the Boost Software License, Version 1.0. (See accompanying
8 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
9 //
10 
11 #ifndef ASIO_SIGNAL_SET_SERVICE_HPP
12 #define ASIO_SIGNAL_SET_SERVICE_HPP
13 
14 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
15 # pragma once
16 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
17 
18 #include "asio/detail/config.hpp"
19 #include "asio/async_result.hpp"
21 #include "asio/error.hpp"
22 #include "asio/io_service.hpp"
23 
25 
26 namespace asio {
27 
30 #if defined(GENERATING_DOCUMENTATION)
32 #else
33  : public asio::detail::service_base<signal_set_service>
34 #endif
35 {
36 public:
37 #if defined(GENERATING_DOCUMENTATION)
38  static asio::io_service::id id;
40 #endif
41 
42 public:
44 #if defined(GENERATING_DOCUMENTATION)
45  typedef implementation_defined implementation_type;
46 #else
48 #endif
49 
52  : asio::detail::service_base<signal_set_service>(io_service),
53  service_impl_(io_service)
54  {
55  }
56 
58  void construct(implementation_type& impl)
59  {
60  service_impl_.construct(impl);
61  }
62 
64  void destroy(implementation_type& impl)
65  {
66  service_impl_.destroy(impl);
67  }
68 
70  asio::error_code add(implementation_type& impl,
71  int signal_number, asio::error_code& ec)
72  {
73  return service_impl_.add(impl, signal_number, ec);
74  }
75 
77  asio::error_code remove(implementation_type& impl,
78  int signal_number, asio::error_code& ec)
79  {
80  return service_impl_.remove(impl, signal_number, ec);
81  }
82 
84  asio::error_code clear(implementation_type& impl,
85  asio::error_code& ec)
86  {
87  return service_impl_.clear(impl, ec);
88  }
89 
91  asio::error_code cancel(implementation_type& impl,
92  asio::error_code& ec)
93  {
94  return service_impl_.cancel(impl, ec);
95  }
96 
97  // Start an asynchronous operation to wait for a signal to be delivered.
98  template <typename SignalHandler>
99  ASIO_INITFN_RESULT_TYPE(SignalHandler,
100  void (asio::error_code, int))
101  async_wait(implementation_type& impl,
102  ASIO_MOVE_ARG(SignalHandler) handler)
103  {
105  SignalHandler, void (asio::error_code, int)> init(
106  ASIO_MOVE_CAST(SignalHandler)(handler));
107 
108  service_impl_.async_wait(impl, init.handler);
109 
110  return init.result.get();
111  }
112 
113 private:
114  // Destroy all user-defined handler objects owned by the service.
115  void shutdown_service()
116  {
117  service_impl_.shutdown_service();
118  }
119 
120  // Perform any fork-related housekeeping.
121  void fork_service(asio::io_service::fork_event event)
122  {
123  service_impl_.fork_service(event);
124  }
125 
126  // The platform-specific implementation.
127  detail::signal_set_service service_impl_;
128 };
129 
130 } // namespace asio
131 
133 
134 #endif // ASIO_SIGNAL_SET_SERVICE_HPP
ASIO_DECL asio::error_code remove(implementation_type &impl, int signal_number, asio::error_code &ec)
ASIO_INITFN_RESULT_TYPE(SignalHandler, void(asio::error_code, int)) async_wait(implementation_type &impl
asio::error_code add(implementation_type &impl, int signal_number, asio::error_code &ec)
Add a signal to a signal_set.
ASIO_MOVE_ARG(SignalHandler) handler)
Class used to uniquely identify a service.
Definition: io_service.hpp:665
Provides core I/O functionality.
Definition: io_service.hpp:184
asio::error_code cancel(implementation_type &impl, asio::error_code &ec)
Cancel all operations associated with the signal set.
detail::signal_set_service::implementation_type implementation_type
The type of a signal set implementation.
asio::basic_streambuf< Allocator > MatchCondition enable_if< is_match_condition< MatchCondition >::value >::type *detail::async_result_init< ReadHandler, void(asio::error_code, std::size_t)> init(ASIO_MOVE_CAST(ReadHandler)(handler))
ASIO_DECL asio::error_code add(implementation_type &impl, int signal_number, asio::error_code &ec)
void destroy(implementation_type &impl)
Destroy a signal set implementation.
fork_event
Fork-related event notifications.
Definition: io_service.hpp:501
ASIO_DECL void destroy(implementation_type &impl)
void construct(implementation_type &impl)
Construct a new signal set implementation.
Class to represent an error code value.
Definition: error_code.hpp:80
static asio::detail::service_id< signal_set_service > id
Definition: io_service.hpp:748
ASIO_DECL void fork_service(asio::io_service::fork_event fork_ev)
ASIO_DECL asio::error_code clear(implementation_type &impl, asio::error_code &ec)
void async_wait(implementation_type &impl, Handler &handler)
handler_type< Handler, Signature >::type handler
#define ASIO_MOVE_CAST(type)
Definition: config.hpp:138
Default service implementation for a signal set.
async_result< typename handler_type< Handler, Signature >::type > result
null_event event
Definition: event.hpp:36
service_base(asio::io_service &io_service)
Definition: io_service.hpp:751
ASIO_DECL asio::error_code cancel(implementation_type &impl, asio::error_code &ec)
Base class for all io_service services.
Definition: io_service.hpp:674
signal_set_service(asio::io_service &io_service)
Construct a new signal set service for the specified io_service.
ASIO_DECL void construct(implementation_type &impl)
asio::error_code clear(implementation_type &impl, asio::error_code &ec)
Remove all signals from a signal_set.