File: Handler.qbk

package info (click to toggle)
boost1.35 1.35.0-5
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 203,856 kB
  • ctags: 337,867
  • sloc: cpp: 938,683; xml: 56,847; ansic: 41,589; python: 18,999; sh: 11,566; makefile: 664; perl: 494; yacc: 456; asm: 353; csh: 6
file content (64 lines) | stat: -rw-r--r-- 2,167 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
[/
 / Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com)
 /
 / Distributed under the Boost Software License, Version 1.0. (See accompanying
 / file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 /]

[section:Handler Handlers]

A handler must meet the requirements of `CopyConstructible` types (C++ Std,
20.1.3).

In the table below, `X` denotes a handler class, `h` denotes a value of `X`,
`p` denotes a pointer to a block of allocated memory of type `void*`, `s`
denotes the size for a block of allocated memory, and `f` denotes a function
object taking no arguments.

[table Handler requirements
  [[expression] [return type] [assertion/note\npre/post-conditions]]
  [
    [``
      using namespace boost::asio;
      asio_handler_allocate(s, &h);
    ``]
    [`void*`]
    [
      Returns a pointer to a block of memory of size `s`. The pointer must
      satisfy the same alignment requirements as a pointer returned by
      `::operator new()`. Throws `bad_alloc` on failure.\n\n The
      `asio_handler_allocate()` function is located using argument-dependent
      lookup. The function `boost::asio::asio_handler_allocate()` serves as a
      default if no user-supplied function is available.
    ]
  ]
  [
    [``
      using namespace boost::asio;
      asio_handler_deallocate(p, s, &h);
    ``]
    []
    [
      Frees a block of memory associated with a pointer `p`, of at least size
      `s`, that was previously allocated using `asio_handler_allocate()`.\n\n The
      `asio_handler_deallocate()` function is located using argument-dependent
      lookup. The function `boost::asio::asio_handler_deallocate()` serves as a
      default if no user-supplied function is available.
    ]
  ]
  [
    [``
      using namespace boost::asio;
      asio_handler_invoke(f, &h);
    ``]
    []
    [
      Causes the function object `f` to be executed as if by calling `f()`.\n\n
      The `asio_handler_invoke()` function is located using argument-dependent
      lookup. The function `boost::asio::asio_handler_invoke()` serves as a
      default if no user-supplied function is available.
    ]
  ]
]

[endsect]