File: Service.qbk

package info (click to toggle)
boost1.74 1.74.0-9
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 464,084 kB
  • sloc: cpp: 3,338,324; xml: 131,293; python: 33,088; ansic: 14,336; asm: 4,034; sh: 3,351; makefile: 1,193; perl: 1,036; yacc: 478; php: 212; ruby: 102; lisp: 24; sql: 13; csh: 6
file content (40 lines) | stat: -rw-r--r-- 1,608 bytes parent folder | download | duplicates (2)
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
[/
 / Copyright (c) 2003-2020 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:Service Service requirements]

A class is a ['service] if it is publicly and unambiguously derived from
`execution_context::service`, or if it is publicly and unambiguously derived
from another service. For a service `S`, `S::key_type` shall be valid and
denote a type (C++Std [temp.deduct]), `is_base_of_v<typename S::key_type, S>`
shall be `true`, and `S` shall satisfy the `Destructible` requirements (C++Std
[destructible]).

The first parameter of all service constructors shall be an lvalue reference to
`execution_context`. This parameter denotes the `execution_context` object that
represents a set of services, of which the service object will be a member.
[inline_note These constructors may be called by the `make_service` function.]

A service shall provide an explicit constructor with a single parameter of
lvalue reference to `execution_context`. [inline_note This constructor may be
called by the `use_service` function.]

  class my_service : public execution_context::service
  {
  public:
    typedef my_service key_type;
    explicit my_service(execution_context& ctx);
    my_service(execution_context& ctx, int some_value);
  private:
    virtual void shutdown() noexcept override;
    ...
  };

A service's `shutdown` member function shall destroy all copies of user-defined
function objects that are held by the service.

[endsect]