Realistic 3D camera system
3D camera system components
basic_signal_set.hpp
Go to the documentation of this file.
1 //
2 // basic_signal_set.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_BASIC_SIGNAL_SET_HPP
12 #define ASIO_BASIC_SIGNAL_SET_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 
20 #include "asio/basic_io_object.hpp"
23 #include "asio/error.hpp"
25 
27 
28 namespace asio {
29 
31 
92 template <typename SignalSetService = signal_set_service>
94  : public basic_io_object<SignalSetService>
95 {
96 public:
98 
105  : basic_io_object<SignalSetService>(io_service)
106  {
107  }
108 
110 
123  : basic_io_object<SignalSetService>(io_service)
124  {
125  asio::error_code ec;
126  this->service.add(this->implementation, signal_number_1, ec);
127  asio::detail::throw_error(ec, "add");
128  }
129 
131 
147  int signal_number_2)
148  : basic_io_object<SignalSetService>(io_service)
149  {
150  asio::error_code ec;
151  this->service.add(this->implementation, signal_number_1, ec);
152  asio::detail::throw_error(ec, "add");
153  this->service.add(this->implementation, signal_number_2, ec);
154  asio::detail::throw_error(ec, "add");
155  }
156 
158 
177  int signal_number_2, int signal_number_3)
178  : basic_io_object<SignalSetService>(io_service)
179  {
180  asio::error_code ec;
181  this->service.add(this->implementation, signal_number_1, ec);
182  asio::detail::throw_error(ec, "add");
183  this->service.add(this->implementation, signal_number_2, ec);
184  asio::detail::throw_error(ec, "add");
185  this->service.add(this->implementation, signal_number_3, ec);
186  asio::detail::throw_error(ec, "add");
187  }
188 
190 
198  void add(int signal_number)
199  {
200  asio::error_code ec;
201  this->service.add(this->implementation, signal_number, ec);
202  asio::detail::throw_error(ec, "add");
203  }
204 
206 
214  asio::error_code add(int signal_number,
215  asio::error_code& ec)
216  {
217  return this->service.add(this->implementation, signal_number, ec);
218  }
219 
221 
232  void remove(int signal_number)
233  {
234  asio::error_code ec;
235  this->service.remove(this->implementation, signal_number, ec);
236  asio::detail::throw_error(ec, "remove");
237  }
238 
240 
251  asio::error_code remove(int signal_number,
252  asio::error_code& ec)
253  {
254  return this->service.remove(this->implementation, signal_number, ec);
255  }
256 
258 
266  void clear()
267  {
268  asio::error_code ec;
269  this->service.clear(this->implementation, ec);
270  asio::detail::throw_error(ec, "clear");
271  }
272 
274 
283  {
284  return this->service.clear(this->implementation, ec);
285  }
286 
288 
308  void cancel()
309  {
310  asio::error_code ec;
311  this->service.cancel(this->implementation, ec);
312  asio::detail::throw_error(ec, "cancel");
313  }
314 
316 
337  {
338  return this->service.cancel(this->implementation, ec);
339  }
340 
342 
366  template <typename SignalHandler>
367  ASIO_INITFN_RESULT_TYPE(SignalHandler,
368  void (asio::error_code, int))
369  async_wait(ASIO_MOVE_ARG(SignalHandler) handler)
370  {
371  // If you get an error on the following line it means that your handler does
372  // not meet the documented type requirements for a SignalHandler.
373  ASIO_SIGNAL_HANDLER_CHECK(SignalHandler, handler) type_check;
374 
375  return this->service.async_wait(this->implementation,
376  ASIO_MOVE_CAST(SignalHandler)(handler));
377  }
378 };
379 
380 } // namespace asio
381 
383 
384 #endif // ASIO_BASIC_SIGNAL_SET_HPP
void throw_error(const asio::error_code &err)
Definition: throw_error.hpp:31
asio::error_code clear(asio::error_code &ec)
Remove all signals from a signal_set.
Provides core I/O functionality.
Definition: io_service.hpp:184
void add(int signal_number)
Add a signal to a signal_set.
basic_signal_set(asio::io_service &io_service, int signal_number_1, int signal_number_2, int signal_number_3)
Construct a signal set and add three signals.
Base class for all I/O objects.
#define ASIO_SIGNAL_HANDLER_CHECK(handler_type, handler)
Provides signal functionality.
basic_signal_set(asio::io_service &io_service, int signal_number_1, int signal_number_2)
Construct a signal set and add two signals.
void clear()
Remove all signals from a signal_set.
asio::error_code add(int signal_number, asio::error_code &ec)
Add a signal to a signal_set.
basic_signal_set(asio::io_service &io_service, int signal_number_1)
Construct a signal set and add one signal.
basic_signal_set(asio::io_service &io_service)
Construct a signal set without adding any signals.
asio::basic_streambuf< Allocator > CompletionCondition ASIO_MOVE_ARG(ReadHandler) handler)
Definition: read.hpp:704
void cancel()
Cancel all operations associated with the signal set.
Class to represent an error code value.
Definition: error_code.hpp:80
ASIO_INITFN_RESULT_TYPE(SignalHandler, void(asio::error_code, int)) async_wait(ASIO_MOVE_ARG(SignalHandler) handler)
Start an asynchronous operation to wait for a signal to be delivered.
#define ASIO_MOVE_CAST(type)
Definition: config.hpp:138
asio::error_code cancel(asio::error_code &ec)
Cancel all operations associated with the signal set.