Skip to content

Commit e140c97

Browse files
committed
registry.hpp -> preamble.hpp
1 parent 5777722 commit e140c97

21 files changed

+176
-90
lines changed

doc/modules/ROOT/examples/custom_rtti.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ struct Dog : Animal {
3131
static constexpr unsigned static_type = 3;
3232
};
3333

34-
#include <boost/openmethod/registry.hpp>
34+
#include <boost/openmethod/preamble.hpp>
3535
#include <boost/openmethod/policies/vptr_vector.hpp>
3636

3737
// tag::policy[]

doc/modules/ROOT/examples/deferred_custom_rtti.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ struct Dog : virtual Animal {
7676
static custom_type_info type_info;
7777
};
7878

79-
#include <boost/openmethod/registry.hpp>
79+
#include <boost/openmethod/preamble.hpp>
8080
#include <boost/openmethod/policies/vptr_vector.hpp>
8181

8282
namespace bom = boost::openmethod;

doc/modules/ROOT/pages/headers.adoc

Lines changed: 113 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,45 +2,140 @@
22
= xref:headers.adoc[Headers]
33
:toc:
44

5-
### boost/openmethod.hpp
5+
{empty}
66

7-
Convenience header. Includes `core.hpp` and `macros.hpp`. This is the header
8-
that most users should use.
7+
*NOTE*: The two important headers are:
98

10-
### boost/openmethod/core.hpp
9+
* xref:#main[`boost/openmethod.hpp`] to define open-methods and overriders using
10+
convenient macros.
1111
12-
Defines all the core constructs of the library: `method`, `virtual_ptr`,
13-
`use_classes`, `virtual_traits`, etc. Does not define any public macros apart
14-
from `BOOST_OPENMETHOD_DEFAULT_REGISTRY`. Users with a severe allergy to macros
15-
should use this header.
12+
* xref:#initialize[`boost/openmethod.hpp/initialize`] to initialize the library.
13+
Typically only included in the translation unit containing `main`.
1614
17-
### boost/openmethod/macros.hpp
15+
The following headers make it possible to use standard smart pointers in virtual
16+
parameters:
1817

19-
Defines all the public macros of the library, such as `BOOST_OPENMETHOD`,
20-
`BOOST_OPENMETHOD_CLASSES`, etc. This header includes `core.hpp`.
18+
* xref:#std_shared_ptr[`boost/openmethod/interop/std_shared_ptr.hpp`] to use
19+
`std::shared_ptr` in virtual parameters.
2120
22-
### boost/openmethod/registry.hpp
21+
* xref:#std_unique_ptr[`boost/openmethod/interop/std_unique_ptr.hpp`] to use
22+
`std::unique_ptr` in virtual parameters.
2323
24-
Defines `registry` and stock policies.
24+
*The other headers are for advanced use*.
2525

26-
### boost/openmethod/default_registry.hpp
26+
### boost/openmethod/preamble.hpp
2727

28-
### boost/openmethod/policies/default_error_handler.hpp
28+
Defines `registry` and stock policies. Also defines all the types and functions
29+
necessary to the definition of `registry`.
2930

30-
### boost/openmethod/policies/fast_perfect_hash.hpp
31+
Most users should not include this header directly, unless for the purpose of
32+
overriding the default registry.
3133

3234
### boost/openmethod/policies/std_rtti.hpp
3335

34-
### boost/openmethod/policies/static_rtti.hpp
36+
Includes all the headers above.
37+
38+
Provides an implementation of the `rtti` policy using standard RTTI.
39+
40+
### boost/openmethod/policies/fast_perfect_hash.hpp
41+
42+
Includes all the headers above.
43+
44+
Provides an implementation of the `hash` policy using a fast perfect hash
45+
function.
46+
47+
### boost/openmethod/policies/vptr_vector.hpp
48+
49+
Includes all the headers above.
50+
51+
Provides an implementation of the `vptr` policy that stores the v-table pointers
52+
in a `std::vector` indexed by type ids, possibly hashed.
53+
54+
### boost/openmethod/policies/default_error_handler.hpp
55+
56+
Includes all the headers above.
57+
58+
Provides an implementation of the `error_handler` policy that calls a
59+
`std::function<void(openmethod_error)>` when an error is encountered, and before
60+
the library aborts the program.
3561

3662
### boost/openmethod/policies/stderr_output.hpp
3763

64+
Includes all the headers above.
65+
66+
Provides an implementation of the `output` policy that writes diagnostics to
67+
the C standard error stream (not using iostreams).
68+
69+
### boost/openmethod/default_registry.hpp
70+
71+
Includes all the headers above.
72+
73+
Defines the default registry, which contains all the stock policies listed
74+
above.
75+
76+
Most users should not include this header directly, unless for the purpose of
77+
overriding the default registry.
78+
79+
### boost/openmethod/core.hpp
80+
81+
Includes all the headers above.
82+
83+
Defines the main constructs of the library: methods, overriders and virtual
84+
pointers, and mechanisms to implement them. Does not define any public macros
85+
apart from `BOOST_OPENMETHOD_DEFAULT_REGISTRY`, if it is not defined already.
86+
87+
Users with a severe allergy to macros can include this header.
88+
89+
### boost/openmethod/macros.hpp
90+
91+
Includes all the headers above.
92+
93+
Defines the public macros of the library, such as `BOOST_OPENMETHOD`,
94+
`BOOST_OPENMETHOD_CLASSES`, etc.
95+
96+
There is little point in including this header directly, as it has the same
97+
effect as including `boost/openmethod.hpp`, which is shorter.
98+
99+
[#main]
100+
### boost/openmethod.hpp
101+
102+
Includes all the headers above.
103+
104+
This is the header that most users should include.
105+
106+
### boost/openmethod/policies/static_rtti.hpp
107+
108+
Includes `preamble.hpp`.
109+
110+
Provides a minimal implementation of the `rtti` policy that does not depend on
111+
standard RTTI.
112+
38113
### boost/openmethod/policies/throw_error_handler.hpp
39114

115+
Includes `preamble.hpp`.
116+
117+
Provides an implementation of the `error_handler` policy that throws errors as
118+
exceptions.
119+
40120
### boost/openmethod/policies/vptr_map.hpp
41121

42-
### boost/openmethod/policies/vptr_vector.hpp
122+
Includes `preamble.hpp`.
123+
124+
Provides an implementation of the `vptr` policy that stores the v-table pointers
125+
in a map (by default a `std::map`) indexed by type ids.
43126

127+
[#std_shared_ptr]
44128
### boost/openmethod/interop/std_shared_ptr.hpp
45129

130+
Includes `core.hpp`.
131+
132+
Provides a `virtual_traits` specialization that make it possible to use a
133+
`std::shared_ptr` in place of a raw pointer or reference in virtual parameters.
134+
135+
[#std_unique_ptr]
46136
### boost/openmethod/interop/std_unique_ptr.hpp
137+
138+
Includes `core.hpp`.
139+
140+
Provides a `virtual_traits` specialization that make it possible to use a
141+
`std::unique_ptr` in place of a raw pointer or reference in virtual parameters.

include/boost/openmethod/core.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#include <boost/mp11/integral.hpp>
2121
#include <boost/mp11/list.hpp>
2222

23-
#include <boost/openmethod/registry.hpp>
23+
#include <boost/openmethod/preamble.hpp>
2424
#include <boost/openmethod/default_registry.hpp>
2525

2626
#ifndef BOOST_OPENMETHOD_DEFAULT_REGISTRY

include/boost/openmethod/default_registry.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#ifndef BOOST_OPENMETHOD_DEFAULT_REGISTRY_HPP
77
#define BOOST_OPENMETHOD_DEFAULT_REGISTRY_HPP
88

9-
#include <boost/openmethod/registry.hpp>
9+
#include <boost/openmethod/preamble.hpp>
1010
#include <boost/openmethod/policies/std_rtti.hpp>
1111
#include <boost/openmethod/policies/vptr_vector.hpp>
1212
#include <boost/openmethod/policies/stderr_output.hpp>

include/boost/openmethod/initialize.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
#define BOOST_OPENMETHOD_COMPILER_HPP
88

99
#include <boost/openmethod/core.hpp>
10-
#include <boost/openmethod/options.hpp>
1110
#include <boost/openmethod/detail/ostdstream.hpp>
1211

1312
#include <algorithm>

include/boost/openmethod/interop/std_shared_ptr.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
// See accompanying file LICENSE_1_0.txt
44
// or copy at http://www.boost.org/LICENSE_1_0.txt)
55

6-
#ifndef BOOST_OPENMETHOD_SHARED_PTR_HPP
7-
#define BOOST_OPENMETHOD_SHARED_PTR_HPP
6+
#ifndef BOOST_OPENMETHOD_INTEROP_SHARED_PTR_HPP
7+
#define BOOST_OPENMETHOD_INTEROP_SHARED_PTR_HPP
88

99
#include <boost/openmethod/core.hpp>
1010
#include <memory>

include/boost/openmethod/interop/std_unique_ptr.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
// See accompanying file LICENSE_1_0.txt
44
// or copy at http://www.boost.org/LICENSE_1_0.txt)
55

6-
#ifndef BOOST_OPENMETHOD_UNIQUE_PTR_HPP
7-
#define BOOST_OPENMETHOD_UNIQUE_PTR_HPP
6+
#ifndef BOOST_OPENMETHOD_INTEROP_UNIQUE_PTR_HPP
7+
#define BOOST_OPENMETHOD_INTEROP_UNIQUE_PTR_HPP
88

99
#include <boost/openmethod/core.hpp>
1010

include/boost/openmethod/options.hpp

Lines changed: 0 additions & 50 deletions
This file was deleted.

include/boost/openmethod/policies/default_error_handler.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#ifndef BOOST_OPENMETHOD_POLICY_VECTORED_ERROR_HPP
77
#define BOOST_OPENMETHOD_POLICY_VECTORED_ERROR_HPP
88

9-
#include <boost/openmethod/registry.hpp>
9+
#include <boost/openmethod/preamble.hpp>
1010

1111
#include <functional>
1212
#include <variant>

0 commit comments

Comments
 (0)