Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-08-17 08:52:04

0001 // Copyright (c) 2018-2025 Jean-Louis Leroy
0002 // Distributed under the Boost Software License, Version 1.0.
0003 // See accompanying file LICENSE_1_0.txt
0004 // or copy at http://www.boost.org/LICENSE_1_0.txt)
0005 
0006 #ifndef BOOST_OPENMETHOD_DEFAULT_REGISTRY_HPP
0007 #define BOOST_OPENMETHOD_DEFAULT_REGISTRY_HPP
0008 
0009 #include <boost/openmethod/preamble.hpp>
0010 #include <boost/openmethod/policies/std_rtti.hpp>
0011 #include <boost/openmethod/policies/vptr_vector.hpp>
0012 #include <boost/openmethod/policies/stderr_output.hpp>
0013 #include <boost/openmethod/policies/fast_perfect_hash.hpp>
0014 #include <boost/openmethod/policies/default_error_handler.hpp>
0015 
0016 namespace boost::openmethod {
0017 
0018 //! Default registry.
0019 //!
0020 //! `default_registry` is a predefined @ref registry, and the default value of
0021 //! {{BOOST_OPENMETHOD_DEFAULT_REGISTRY}}.
0022 //! It contains the following policies:
0023 //! @li @ref policies::std_rtti: Use standard RTTI.
0024 //! @li @ref policies::fast_perfect_hash: Use a fast perfect hash function to
0025 //!   map type ids to indices.
0026 //! @li @ref policies::vptr_vector: Store v-table pointers in a `std::vector`.
0027 //! @li @ref policies::default_error_handler: Write short diagnostic messages.
0028 //! @li @ref policies::stderr_output: Write messages to `stderr`.
0029 //!
0030 //! If
0031 //! {{BOOST_OPENMETHOD_ENABLE_RUNTIME_CHECKS}}
0032 //! is defined, `default_registry` also includes the @ref runtime_checks policy.
0033 //!
0034 //! @note Use `BOOST_OPENMETHOD_ENABLE_RUNTIME_CHECKS` with caution, as
0035 //! inconsistent use of the macro can cause ODR violations. If defined, it must
0036 //! be in all the translation units in the program that use `default_registry`,
0037 //! including those pulled from libraries.
0038 struct default_registry
0039     : registry<
0040           policies::std_rtti, policies ::vptr_vector,
0041           policies::fast_perfect_hash, policies::default_error_handler,
0042           policies::stderr_output
0043 #ifdef BOOST_OPENMETHOD_ENABLE_RUNTIME_CHECKS
0044           ,
0045           policies::runtime_checks
0046 #endif
0047           > {
0048 };
0049 
0050 namespace detail {
0051 
0052 static odr_check<default_registry> default_registry_odr_check_instance;
0053 
0054 }
0055 
0056 //! Indirect registry.
0057 //!
0058 //! `indirect_registry` is a predefined @ref registry that uses the same
0059 //! policies as @ref default_registry, plus the @ref indirect_vptr policy.
0060 //!
0061 //! @see indirect_vptr.
0062 struct indirect_registry : default_registry::with<policies::indirect_vptr> {};
0063 
0064 } // namespace boost::openmethod
0065 
0066 #endif