Skip to content

Commit 650e4a7

Browse files
committed
finish documenting headers
1 parent 850a80f commit 650e4a7

2 files changed

Lines changed: 100 additions & 9 deletions

File tree

doc/initialize.adoc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,5 @@ auto finalize() -> void;
4040
De-allocates the resources allocated by `initialize` for the `Policy`, including
4141
resources allocated by the facets in `Policy`. Resources are de-allocated in an
4242
arbitrary order. It is not necessary to call `finalize` between calls to
43-
`initialize`. It may be required to cooperate with memory leak detection tools.
43+
`initialize`. It is provided mainly for the benefit of memory leak detection
44+
schemes.

doc/overview.adoc

Lines changed: 98 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,31 +24,121 @@ the `include` directory to your project's include path.
2424
#### boost::openmethod
2525

2626
The library's main namespace. Contains `method`, `virtual_ptr` and
27-
`virtual_ptr_traits`, `use_classes`, the `debug` and `release` policies, etc.
27+
`virtual_ptr_traits`, `use_classes`, the `default_policy`, etc.
2828

2929
#### boost::openmethod::policies
3030

31-
Contains the policy classes and their facets.
31+
Contains the policy framework.
3232

3333
### Headers
3434

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

37-
The library's main header. Contains `method`, `virtual_ptr` and
38-
`virtual_ptr_traits`, `use_classes`, the `debug` and `release` policies, etc.
37+
The library's main header. Provides `method`, `virtual_ptr` and
38+
`virtual_ptr_traits`, `use_classes`, the default policy, etc.
3939

40-
#### <boost/openmethod/compiler.hpp>
41-
42-
Defines `intialize` and `finalize`, which are used to register classes and
40+
If `BOOST_OPENMETHOD_DEFAULT_POLICY` is defined before including this header,
41+
its value is used as the default value for the `Policy` template parameter
42+
throughout the code. Otherwise, `boost::openmethod::default_policy` is used.
43+
Setting `BOOST_OPENMETHOD_DEFAULT_POLICY` after including the core header has no
44+
effect.
4345

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

48+
Provides `BOOST_REGISTER_CLASSES`, `BOOST_OPENMETHOD`,
49+
`BOOST_OPENMETHOD_OVERRIDE` and other macros.
50+
4651
#### <boost/openmethod.hpp>
4752

48-
#### <boost/openmethod/policies.hpp>
53+
Convenience header. Includes `<boost/openmethod/core.hpp>` and
54+
`<boost/openmethod/macros.hpp>`.
55+
56+
Also imports `boost::openmethod::virtual_ptr` in the global namespace. This is
57+
usually regarded as bad practice. The rationale is that OpenMethod emulates a
58+
language feature, and `virtual_ptr` is equivalent to keyword, similar to
59+
`virtual`. Besides, the macros are global as well.
60+
61+
There are two ways to avoid importing `virtual_ptr` while still using the
62+
macros:
63+
64+
* Define `BOOST_OPENMETHOD_NO_GLOBAL_VIRTUAL_PTR` before including
65+
`<boost/openmethod.hpp>`. This disables the import of `virtual_ptr` in the
66+
global namespace.
67+
68+
* Include `<boost/openmethod/core.hpp>`and `<boost/openmethod/macros.hpp>`.
69+
70+
#### <boost/openmethod/compiler.hpp>
71+
72+
Provides `intialize` and `finalize`. Typically included only by the translation
73+
unit that contains `main`, unless dynamic loading is used in other places in the
74+
program.
4975

5076
#### <boost/openmethod/shared_ptr.hpp>
5177

78+
Provides support for using `std::shared_ptr` in place of plain pointers in
79+
virtual parameters.
80+
5281
#### <boost/openmethod/unique_.hpp>
5382

83+
Provides support for using `std::unique_ptr` in place of plain pointers in
84+
virtual parameters.
85+
5486
#### <boost/openmethod/with_vptr.hpp>
87+
88+
Provides support for storing v-table pointers directly in objects, in the same
89+
manner as native virtual functions.
90+
91+
#### <boost/openmethod/policies.hpp>
92+
93+
Provides the `debug` and `release` policies in the `boost::openmethod::policies`
94+
namespace, and `default_policy` in the `boost::openmethod` namespace, which is
95+
an alias to either `debug` or `release`, depending on the value of the
96+
preprocessor symbol `NDEBUG`.
97+
98+
Usually not included directly. Can be used to create custom policies from stock
99+
policies, by forking them and adjusting a few facets.
100+
101+
#### <boost/openmethod/policies/basic_policy.hpp>
102+
103+
Provides the constructs used in the policy framework, essentially
104+
`basic_policy`, `facet`, and its abstract subclasses (`rtti`, `extern_vptr`,
105+
etc).
106+
107+
#### <boost/openmethod/policies/std_rtti.hpp>
108+
109+
Implements the `rtti` facet using standard RTTI.
110+
111+
#### <boost/openmethod/policies/minimal_rtti.hpp>
112+
113+
Implements the `rtti` facet using a minimal RTTI implementation. Can be used only with the "final" constructs, or with intrusive v-table pointers.
114+
115+
#### <boost/openmethod/policies/vptr_vector.hpp>
116+
117+
Implements the `extern_vptr` facet using a vector of pointers.
118+
119+
#### <boost/openmethod/policies/vptr_map.hpp>
120+
121+
Implements the `extern_vptr` facet using a map of pointers.
122+
123+
#### <boost/openmethod/policies/fast_perfect_hash.hpp>
124+
125+
Implements the `type_hash` facet using a perfect hash function.
126+
127+
#### <boost/openmethod/policies/vectored_error_handler.hpp>
128+
129+
Implements the `error_handler` facet by routing the error through a
130+
`std::function`.
131+
132+
#### <boost/openmethod/policies/throw_error_handler.hpp>
133+
134+
Implements the `error_handler` facet by throwing an exception.
135+
136+
#### <boost/openmethod/policies/basic_error_output.hpp>
137+
138+
Implements the `error_output` facet using a lightweight version of
139+
`std::ostream`.
140+
141+
#### <boost/openmethod/policies/basic_trace_output.hpp>
142+
143+
Implements the `trace_output` facet using a lightweight version of
144+
`std::ostream`.

0 commit comments

Comments
 (0)