File: overview.adoc

package info (click to toggle)
boost1.90 1.90.0-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 593,120 kB
  • sloc: cpp: 4,190,908; xml: 196,648; python: 34,618; ansic: 23,145; asm: 5,468; sh: 3,774; makefile: 1,161; perl: 1,020; sql: 728; ruby: 676; yacc: 478; java: 77; lisp: 24; csh: 6
file content (144 lines) | stat: -rw-r--r-- 4,480 bytes parent folder | download | duplicates (3)
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144

## Overview

### Requirements

OpenMethod requires C++17 or above. It depends on the following Boost libraries:

* Assert
* Config
* Core
* DynamicBitset
* Mp11
* Preprocessor

Boost.Test is also required to build and run the unit tests.

### Installation

The library is headers-only. You can install it system-wide, or add the path to
the `include` directory to your project's include path.

### Namespaces

#### boost::openmethod

The library's main namespace. Contains `method`, `virtual_ptr` and
`virtual_ptr_traits`, `use_classes`, the `default_registry`, etc.

#### boost::openmethod::policies

Contains the policy framework.

### Headers

#### <boost/openmethod/core.hpp>

The library's main header. Provides `method`, `virtual_ptr` and
`virtual_ptr_traits`, `use_classes`, the default policy, etc.

If `BOOST_OPENMETHOD_DEFAULT_REGISTRY` is defined before including this header,
its value is used as the default value for the `Policy` template parameter
throughout the code. Otherwise, `boost::openmethod::default_registry` is used.
Setting `BOOST_OPENMETHOD_DEFAULT_REGISTRY` after including the core header has no
effect.

#### <boost/openmethod/macros.hpp>

Provides `BOOST_REGISTER_CLASSES`, `BOOST_OPENMETHOD`,
`BOOST_OPENMETHOD_OVERRIDE` and other macros.

#### <boost/openmethod.hpp>

Convenience header. Includes `<boost/openmethod/core.hpp>` and
`<boost/openmethod/macros.hpp>`.

Also imports `boost::openmethod::virtual_ptr` in the global namespace. This is
usually regarded as bad practice. The rationale is that OpenMethod emulates a
language feature, and `virtual_ptr` is equivalent to keyword, similar to
`virtual`. Besides, the macros are global as well.

There are two ways to avoid importing `virtual_ptr` while still using the
macros:

* Define `BOOST_OPENMETHOD_NO_GLOBAL_VIRTUAL_PTR` before including
  `<boost/openmethod.hpp>`. This disables the import of `virtual_ptr` in the
  global namespace.

* Include `<boost/openmethod/core.hpp>`and `<boost/openmethod/macros.hpp>`.

#### <boost/openmethod/initialize.hpp>

Provides `intialize` and `finalize`. Typically included only by the translation
unit that contains `main`, unless dynamic loading is used in other places in the
program.

#### <boost/openmethod/interop/std_shared_ptr.hpp>

Provides support for using `std::shared_ptr` in place of plain pointers in
virtual parameters.

#### <boost/openmethod/unique_.hpp>

Provides support for using `std::unique_ptr` in place of plain pointers in
virtual parameters.

#### <boost/openmethod/inplace_vptr.hpp>

Provides support for storing v-table pointers directly in objects, in the same
manner as native virtual functions.

#### <boost/openmethod/policies.hpp>

Provides the `debug` and `release` policies in the `boost::openmethod::policies`
namespace, and `default_registry` in the `boost::openmethod` namespace, which is
an alias to either `debug` or `release`, depending on the value of the
preprocessor symbol `NDEBUG`.

Usually not included directly. Can be used to create custom policies from stock
policies, by forking them and adjusting a few policys.

#### <boost/openmethod/policies/basic_policy.hpp>

Provides the constructs used in the policy framework, essentially
`basic_policy`, `policy`, and its abstract subclasses (`rtti`, `extern_vptr`,
etc).

#### <boost/openmethod/policies/std_rtti.hpp>

Implements the `rtti` policy using standard RTTI.

#### <boost/openmethod/policies/minimal_rtti.hpp>

Implements the `rtti` policy using a minimal RTTI implementation. Can be used only with the "final" constructs, or with intrusive v-table pointers.

#### <boost/openmethod/policies/vptr_vector.hpp>

Implements the `extern_vptr` policy using a vector of pointers.

#### <boost/openmethod/policies/vptr_map.hpp>

Implements the `extern_vptr` policy using a map of pointers.

#### <boost/openmethod/policies/fast_perfect_hash.hpp>

Implements the `type_hash` policy using a perfect hash function.

#### <boost/openmethod/policies/default_error_handler.hpp>

Implements the `error_handler` policy by routing the error through a
`std::function`.

#### <boost/openmethod/policies/throw_error_handler.hpp>

Implements the `error_handler` policy by throwing an exception.

#### <boost/openmethod/policies/basic_error_output.hpp>

Implements the `output` policy using a lightweight version of
`std::ostream`.

#### <boost/openmethod/policies/basic_trace_output.hpp>

Implements the `trace` policy using a lightweight version of
`std::ostream`.