From 31b48568cb02a3340648f0c155eccf63f65b9dc3 Mon Sep 17 00:00:00 2001
From: Jean-Louis Leroy
Date: Fri, 5 Sep 2025 15:28:45 -0400
Subject: [PATCH] doc, compiler to registry, simplify policies
---
.github/workflows/ci.yml | 67 +
.gitignore | 1 +
CMakeLists.txt | 215 +-
ce/2-method-vptr-final.cpp | 2 +-
ce/2-method-vptr.cpp | 2 +-
ce/2-method.cpp | 2 +-
ce/uni-method-vptr-final.cpp | 2 +-
ce/uni-method-vptr.cpp | 2 +-
ce/uni-method.cpp | 2 +-
dev/local-flat.sh | 2 +-
doc/.gitignore | 6 +
doc/antora.yml | 32 +
doc/basic_policy.adoc | 16 +-
doc/build_antora.sh | 28 +
doc/default_error_handler.adoc | 2 +-
doc/deferred_static_rtti.adoc | 6 +-
doc/error_handler.adoc | 4 +-
doc/error_output.adoc | 8 +-
doc/facet.adoc | 6 +-
doc/html/index.html | 212 +-
doc/index.html | 21 +
doc/initialize.adoc | 6 +-
doc/local-playbook.yml | 54 +
doc/minimal_rtti.adoc | 8 +-
.../modules/ROOT/examples}/CMakeLists.txt | 6 +
.../ROOT/examples}/accept_no_visitors.cpp | 2 +-
.../modules/ROOT/examples}/adventure.cpp | 2 +-
.../modules/ROOT/examples}/ast.cpp | 2 +-
.../modules/ROOT/examples}/ast_unique_ptr.cpp | 2 +-
.../modules/ROOT/examples}/asteroids.cpp | 2 +-
.../modules/ROOT/examples}/core_api.cpp | 2 +-
.../modules/ROOT/examples}/custom_rtti.cpp | 16 +-
.../ROOT/examples}/default_error_handler.cpp | 2 +-
.../ROOT/examples}/deferred_custom_rtti.cpp | 17 +-
{example => doc/modules/ROOT/examples}/dl.hpp | 6 +-
.../modules/ROOT/examples}/dl_main.cpp | 16 +-
.../modules/ROOT/examples}/dl_shared.cpp | 2 +-
.../modules/ROOT/examples}/friendship.cpp | 2 +-
.../friendship_across_namespaces.cpp | 2 +-
.../headers_namespaces/CMakeLists.txt | 0
.../examples}/headers_namespaces/animal.hpp | 0
.../ROOT/examples}/headers_namespaces/cat.cpp | 0
.../ROOT/examples}/headers_namespaces/cat.hpp | 0
.../ROOT/examples}/headers_namespaces/dog.cpp | 0
.../ROOT/examples}/headers_namespaces/dog.hpp | 0
.../examples}/headers_namespaces/main.cpp | 2 +-
.../main_unrelated_namespaces.cpp | 2 +-
.../main_using_directive.cpp | 2 +-
.../modules/ROOT/examples}/hello_world.cpp | 2 +-
.../modules/ROOT/examples}/matrix.cpp | 2 +-
.../modules/ROOT/examples}/next.cpp | 2 +-
.../modules/ROOT/examples}/slides.cpp | 2 +-
doc/modules/ROOT/examples/static_rtti.cpp | 56 +
.../modules/ROOT/examples}/synopsis.cpp | 2 +-
.../ROOT/examples}/throw_error_handler.cpp | 2 +-
.../modules/ROOT/examples}/virtual_.cpp | 2 +-
.../modules/ROOT/examples}/virtual_func.cpp | 0
.../modules/ROOT/examples}/virtual_ptr.cpp | 2 +-
doc/modules/ROOT/images/AuthorityDiagram.svg | 154 +
doc/modules/ROOT/images/ClassHierarchy.svg | 152 +
doc/modules/ROOT/images/HelpCard.svg | 494 +
doc/modules/ROOT/images/PartsDiagram.svg | 145 +
doc/modules/ROOT/images/repo-logo.png | Bin 0 -> 113619 bytes
doc/modules/ROOT/nav.adoc | 15 +
.../ROOT/pages}/BOOST_OPENMETHOD.adoc | 4 +-
.../ROOT/pages}/BOOST_OPENMETHOD_CLASSES.adoc | 2 +-
.../BOOST_OPENMETHOD_DECLARE_OVERRIDER.adoc | 0
.../BOOST_OPENMETHOD_DEFAULT_REGISTRY.adoc | 0
.../BOOST_OPENMETHOD_DEFINE_OVERRIDER.adoc | 0
.../ROOT/pages}/BOOST_OPENMETHOD_GUIDE.adoc | 0
.../ROOT/pages}/BOOST_OPENMETHOD_ID.adoc | 0
.../BOOST_OPENMETHOD_INLINE_OVERRIDE.adoc | 0
.../pages}/BOOST_OPENMETHOD_OVERRIDE.adoc | 0
.../pages}/BOOST_OPENMETHOD_OVERRIDER.adoc | 0
.../pages}/BOOST_OPENMETHOD_OVERRIDERS.adoc | 0
.../pages}/BOOST_OPENMETHOD_REGISTER.adoc | 0
doc/{ => modules/ROOT/pages}/core_api.adoc | 12 +-
doc/{ => modules/ROOT/pages}/custom_rtti.adoc | 108 +-
.../ROOT/pages}/dynamic_loading.adoc | 16 +-
.../ROOT/pages}/error_handling.adoc | 15 +-
doc/{ => modules/ROOT/pages}/friendship.adoc | 4 +-
.../ROOT/pages}/headers_namespaces.adoc | 18 +-
doc/{ => modules/ROOT/pages}/hello_world.adoc | 17 +-
doc/modules/ROOT/pages/index.adoc | 76 +
.../ROOT/pages}/multiple_dispatch.adoc | 4 +-
doc/{ => modules/ROOT/pages}/performance.adoc | 10 +-
doc/modules/ROOT/pages/policies.adoc | 72 +
doc/modules/ROOT/pages/reference.adoc | 176 +
.../ROOT/pages}/smart_pointers.adoc | 4 +-
.../ROOT/pages}/virtual_ptr_alt.adoc | 6 +-
doc/mrdocs.yml | 63 +
doc/output.adoc | 2 +-
doc/overview.adoc | 24 +-
doc/package-lock.json | 2938 +
doc/package.json | 15 +
doc/policies.adoc | 91 -
doc/reference.adoc | 48 -
doc/restricted_output_stream.adoc | 14 +-
doc/rtti.adoc | 13 +-
doc/std_rtti.adoc | 2 +-
doc/tagfiles/boost-openmethod-doxygen.tag.xml | 955 +
.../boost-openmethod-macros-doxygen.tag.xml | 7 +
doc/tagfiles/cppreference-doxygen-web.tag.xml | 68914 ++++++++++++++++
doc/throw_error_handler.adoc | 2 +-
doc/trace.adoc | 2 +-
doc/trace_output.adoc | 10 +-
doc/type_hash.adoc | 12 +-
doc/vptr.adoc | 10 +-
doc/vptr_map.adoc | 6 +-
doc/vptr_vector.adoc | 6 +-
docs | 1 -
include/boost/openmethod/core.hpp | 542 +-
include/boost/openmethod/default_registry.hpp | 8 +-
include/boost/openmethod/detail/mrdocs.hpp | 82 +
.../boost/openmethod/detail/ostdstream.hpp | 8 +-
include/boost/openmethod/detail/trace.hpp | 10 +-
include/boost/openmethod/detail/types.hpp | 15 +-
.../{compiler.hpp => initialize.hpp} | 293 +-
include/boost/openmethod/inplace_vptr.hpp | 19 +-
.../policies/default_error_handler.hpp | 44 +-
.../openmethod/policies/fast_perfect_hash.hpp | 150 +-
.../openmethod/policies/minimal_rtti.hpp | 26 -
.../boost/openmethod/policies/static_rtti.hpp | 49 +
.../boost/openmethod/policies/std_rtti.hpp | 61 +-
.../openmethod/policies/stderr_output.hpp | 5 +
.../policies/throw_error_handler.hpp | 18 +-
.../policies/vectored_error_handler.hpp | 2 +-
.../boost/openmethod/policies/vptr_map.hpp | 63 +-
.../boost/openmethod/policies/vptr_vector.hpp | 109 +-
include/boost/openmethod/registry.hpp | 597 +-
include/boost/openmethod/shared_ptr.hpp | 7 +-
include/boost/openmethod/unique_ptr.hpp | 5 +-
index.html | 21 +
test/CMakeLists.txt | 55 +-
test/cmake_install_test/main.cpp | 2 +-
test/cmake_subdir_test/main.cpp | 2 +-
test/test_compiler.cpp | 101 +-
test/test_core.cpp | 6 +-
test/test_custom_rtti.cpp | 18 +-
test/test_dispatch.cpp | 22 +-
test/test_intrusive.cpp | 18 +-
test/test_member_method.cpp | 2 +-
test/test_n2216.cpp | 6 +-
test/test_namespaces.cpp | 2 +-
test/test_pointer_to_method.cpp | 2 +-
test/test_policies.cpp | 14 +-
test/test_rolex.cpp | 2 +-
test/test_runtime_errors.cpp | 16 +-
...est_shared_virtual_ptr_value_semantics.cpp | 10 +-
test/test_static_rtti.cpp | 59 +
...est_unique_virtual_ptr_value_semantics.cpp | 4 +-
test/test_util.hpp | 16 +-
test/test_virtual_ptr_dispatch.cpp | 24 +-
test/test_virtual_ptr_value_semantics.cpp | 8 +-
test/test_virtual_ptr_value_semantics.hpp | 8 +-
155 files changed, 76728 insertions(+), 1307 deletions(-)
create mode 100644 doc/.gitignore
create mode 100644 doc/antora.yml
create mode 100755 doc/build_antora.sh
create mode 100644 doc/index.html
create mode 100644 doc/local-playbook.yml
rename {example => doc/modules/ROOT/examples}/CMakeLists.txt (96%)
rename {example => doc/modules/ROOT/examples}/accept_no_visitors.cpp (98%)
rename {example => doc/modules/ROOT/examples}/adventure.cpp (98%)
rename {example => doc/modules/ROOT/examples}/ast.cpp (97%)
rename {example => doc/modules/ROOT/examples}/ast_unique_ptr.cpp (97%)
rename {example => doc/modules/ROOT/examples}/asteroids.cpp (97%)
rename {example => doc/modules/ROOT/examples}/core_api.cpp (98%)
rename {example => doc/modules/ROOT/examples}/custom_rtti.cpp (89%)
rename {example => doc/modules/ROOT/examples}/default_error_handler.cpp (96%)
rename {example => doc/modules/ROOT/examples}/deferred_custom_rtti.cpp (89%)
rename {example => doc/modules/ROOT/examples}/dl.hpp (81%)
rename {example => doc/modules/ROOT/examples}/dl_main.cpp (83%)
rename {example => doc/modules/ROOT/examples}/dl_shared.cpp (91%)
rename {example => doc/modules/ROOT/examples}/friendship.cpp (97%)
rename {example => doc/modules/ROOT/examples}/friendship_across_namespaces.cpp (98%)
rename {example => doc/modules/ROOT/examples}/headers_namespaces/CMakeLists.txt (100%)
rename {example => doc/modules/ROOT/examples}/headers_namespaces/animal.hpp (100%)
rename {example => doc/modules/ROOT/examples}/headers_namespaces/cat.cpp (100%)
rename {example => doc/modules/ROOT/examples}/headers_namespaces/cat.hpp (100%)
rename {example => doc/modules/ROOT/examples}/headers_namespaces/dog.cpp (100%)
rename {example => doc/modules/ROOT/examples}/headers_namespaces/dog.hpp (100%)
rename {example => doc/modules/ROOT/examples}/headers_namespaces/main.cpp (96%)
rename {example => doc/modules/ROOT/examples}/headers_namespaces/main_unrelated_namespaces.cpp (91%)
rename {example => doc/modules/ROOT/examples}/headers_namespaces/main_using_directive.cpp (95%)
rename {example => doc/modules/ROOT/examples}/hello_world.cpp (99%)
rename {example => doc/modules/ROOT/examples}/matrix.cpp (99%)
rename {example => doc/modules/ROOT/examples}/next.cpp (97%)
rename {example => doc/modules/ROOT/examples}/slides.cpp (99%)
create mode 100644 doc/modules/ROOT/examples/static_rtti.cpp
rename {example => doc/modules/ROOT/examples}/synopsis.cpp (99%)
rename {example => doc/modules/ROOT/examples}/throw_error_handler.cpp (97%)
rename {example => doc/modules/ROOT/examples}/virtual_.cpp (98%)
rename {example => doc/modules/ROOT/examples}/virtual_func.cpp (100%)
rename {example => doc/modules/ROOT/examples}/virtual_ptr.cpp (97%)
create mode 100644 doc/modules/ROOT/images/AuthorityDiagram.svg
create mode 100644 doc/modules/ROOT/images/ClassHierarchy.svg
create mode 100644 doc/modules/ROOT/images/HelpCard.svg
create mode 100644 doc/modules/ROOT/images/PartsDiagram.svg
create mode 100644 doc/modules/ROOT/images/repo-logo.png
create mode 100644 doc/modules/ROOT/nav.adoc
rename doc/{ => modules/ROOT/pages}/BOOST_OPENMETHOD.adoc (96%)
rename doc/{ => modules/ROOT/pages}/BOOST_OPENMETHOD_CLASSES.adoc (93%)
rename doc/{ => modules/ROOT/pages}/BOOST_OPENMETHOD_DECLARE_OVERRIDER.adoc (100%)
rename doc/{ => modules/ROOT/pages}/BOOST_OPENMETHOD_DEFAULT_REGISTRY.adoc (100%)
rename doc/{ => modules/ROOT/pages}/BOOST_OPENMETHOD_DEFINE_OVERRIDER.adoc (100%)
rename doc/{ => modules/ROOT/pages}/BOOST_OPENMETHOD_GUIDE.adoc (100%)
rename doc/{ => modules/ROOT/pages}/BOOST_OPENMETHOD_ID.adoc (100%)
rename doc/{ => modules/ROOT/pages}/BOOST_OPENMETHOD_INLINE_OVERRIDE.adoc (100%)
rename doc/{ => modules/ROOT/pages}/BOOST_OPENMETHOD_OVERRIDE.adoc (100%)
rename doc/{ => modules/ROOT/pages}/BOOST_OPENMETHOD_OVERRIDER.adoc (100%)
rename doc/{ => modules/ROOT/pages}/BOOST_OPENMETHOD_OVERRIDERS.adoc (100%)
rename doc/{ => modules/ROOT/pages}/BOOST_OPENMETHOD_REGISTER.adoc (100%)
rename doc/{ => modules/ROOT/pages}/core_api.adoc (88%)
rename doc/{ => modules/ROOT/pages}/custom_rtti.adoc (54%)
rename doc/{ => modules/ROOT/pages}/dynamic_loading.adoc (79%)
rename doc/{ => modules/ROOT/pages}/error_handling.adoc (58%)
rename doc/{ => modules/ROOT/pages}/friendship.adoc (87%)
rename doc/{ => modules/ROOT/pages}/headers_namespaces.adoc (92%)
rename doc/{ => modules/ROOT/pages}/hello_world.adoc (85%)
create mode 100644 doc/modules/ROOT/pages/index.adoc
rename doc/{ => modules/ROOT/pages}/multiple_dispatch.adoc (82%)
rename doc/{ => modules/ROOT/pages}/performance.adoc (93%)
create mode 100644 doc/modules/ROOT/pages/policies.adoc
create mode 100644 doc/modules/ROOT/pages/reference.adoc
rename doc/{ => modules/ROOT/pages}/smart_pointers.adoc (82%)
rename doc/{ => modules/ROOT/pages}/virtual_ptr_alt.adoc (92%)
create mode 100644 doc/mrdocs.yml
create mode 100644 doc/package-lock.json
create mode 100644 doc/package.json
delete mode 100644 doc/policies.adoc
delete mode 100644 doc/reference.adoc
create mode 100644 doc/tagfiles/boost-openmethod-doxygen.tag.xml
create mode 100644 doc/tagfiles/boost-openmethod-macros-doxygen.tag.xml
create mode 100644 doc/tagfiles/cppreference-doxygen-web.tag.xml
delete mode 120000 docs
create mode 100644 include/boost/openmethod/detail/mrdocs.hpp
rename include/boost/openmethod/{compiler.hpp => initialize.hpp} (83%)
delete mode 100644 include/boost/openmethod/policies/minimal_rtti.hpp
create mode 100644 include/boost/openmethod/policies/static_rtti.hpp
create mode 100644 index.html
create mode 100644 test/test_static_rtti.cpp
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 08e4c8c..d669548 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -36,6 +36,10 @@ env:
LCOV_BRANCH_COVERAGE: 0
CODECOV_NAME: Github Actions
+permissions:
+ id-token: write
+ pages: write
+
jobs:
posix:
defaults:
@@ -292,6 +296,8 @@ jobs:
rmdir /s /q boost-ci-cloned
- name: Setup Boost
+ env:
+ BOOST_BRANCH: master
run: ci\github\install.bat
- name: Run tests
@@ -453,3 +459,64 @@ jobs:
cmake -G "${{matrix.generator}}" -DBOOST_CI_INSTALL_TEST=ON -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DBUILD_SHARED_LIBS=${{matrix.build_shared}} -DCMAKE_PREFIX_PATH=$HOME/local ..
cmake --build . --config ${{matrix.build_type}} -j$B2_JOBS
ctest --output-on-failure --build-config ${{matrix.build_type}}
+ antora:
+ name: Antora Docs
+ runs-on: ubuntu-latest
+ defaults:
+ run:
+ shell: bash
+ steps:
+ - name: Install packages
+ uses: alandefreitas/cpp-actions/package-install@v1.8.10
+ with:
+ apt-get: git cmake
+
+ - name: Clone Boost.OpenMethod
+ uses: actions/checkout@v4
+
+ - name: Clone Boost
+ uses: alandefreitas/cpp-actions/boost-clone@v1.8.10
+ id: boost-clone
+ with:
+ branch: ${{ (github.ref_name == 'master' && github.ref_name) || 'develop' }}
+ boost-dir: ../boost-source
+ scan-modules-dir: .
+ scan-modules-ignore: openmethod
+
+ - uses: actions/setup-node@v4
+ with:
+ node-version: 18
+
+ - name: Build Antora Docs
+ # env:
+ # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ run: |
+ git config --global --add safe.directory "$(pwd)"
+
+ cd ..
+ BOOST_SRC_DIR="$(pwd)/boost-source"
+ export BOOST_SRC_DIR
+ cd Boost.OpenMethod
+
+ cd doc
+ bash ./build_antora.sh
+
+ # Antora returns zero even if it fails, so we check if the site directory exists
+ if [ ! -d "build/site" ]; then
+ echo "Antora build failed"
+ exit 1
+ fi
+
+ - name: Create Antora Docs Artifact
+ uses: actions/upload-artifact@v4
+ with:
+ name: antora-docs-${{ matrix.name }}
+ path: doc/build/site
+
+ - name: Upload static files as artifact
+ uses: actions/upload-pages-artifact@v3
+ with:
+ path: doc/build/site
+
+ - name: Deploy to GitHub Pages
+ uses: actions/deploy-pages@v4
diff --git a/.gitignore b/.gitignore
index a500e63..4aaeb4c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,6 +4,7 @@ build/
builds/
**/#*#
dependencies/*
+Dependencies/*
extern/*
tests/benchmarks_parameters.hpp
**/vcpkg_installed
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f6272ed..c6b7ec2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,55 +1,64 @@
-# Generated by `boostdep --cmake openmethod`
-# Copyright 2020, 2021 Peter Dimov
-# Distributed under the Boost Software License, Version 1.0.
-# https://www.boost.org/LICENSE_1_0.txt
+#
+# Copyright (c) 2019 Vinnie Falco (vinnie.falco@gmail.com)
+# Copyright (c) 2021 DMitry Arkhipov (grisumbras@gmail.com)
+# Copyright (c) 2022 Alan de Freitas (alandefreitas@gmail.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)
+#
+# Official repository: https://github.com/boostorg/openmethod
+#
-cmake_minimum_required(VERSION 3.5...3.20)
+#-------------------------------------------------
+#
+# Project
+#
+#-------------------------------------------------
-project(boost_openmethod VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX)
+cmake_minimum_required(VERSION 3.8...3.20)
+
+set(BOOST_OPENMETHOD_VERSION 1)
+
+if (BOOST_SUPERPROJECT_VERSION)
+ set(BOOST_OPENMETHOD_VERSION ${BOOST_SUPERPROJECT_VERSION})
+endif ()
+
+project(boost_openmethod VERSION "${BOOST_OPENMETHOD_VERSION}" LANGUAGES CXX)
set(BOOST_OPENMETHOD_IS_ROOT OFF)
-if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
+
+if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
set(BOOST_OPENMETHOD_IS_ROOT ON)
-endif()
+endif ()
+set(__ignore__ ${CMAKE_C_COMPILER})
-if(BOOST_OPENMETHOD_IS_ROOT)
- include(CTest)
-endif()
-if(NOT BOOST_SUPERPROJECT_VERSION)
- option(BOOST_OPENMETHOD_INSTALL "Install boost::openmethod files" ON)
- option(BOOST_OPENMETHOD_BUILD_TESTS "Build boost::openmethod tests" ${BUILD_TESTING})
- option(BOOST_OPENMETHOD_BUILD_EXAMPLES "Build boost::openmethod examples" ${BOOST_OPENMETHOD_IS_ROOT})
-else()
- set(BOOST_OPENMETHOD_BUILD_TESTS ${BUILD_TESTING})
-endif()
+#-------------------------------------------------
+#
+# Options
+#
+#-------------------------------------------------
+option(BOOST_OPENMETHOD_BUILD_TESTS "Build boost::openmethod tests even if BUILD_TESTING is OFF" OFF)
+option(BOOST_OPENMETHOD_BUILD_EXAMPLES "Build boost::openmethod examples" ${BOOST_OPENMETHOD_IS_ROOT})
+option(BOOST_OPENMETHOD_MRDOCS_BUILD "Build the target for MrDocs: see mrdocs.yml" OFF)
+option(BOOST_OPENMETHOD_WARNINGS_AS_ERRORS "Treat warnings as errors" OFF)
-if(BOOST_OPENMETHOD_IS_ROOT)
- #
- # Building inside Boost tree, but as a separate project e.g. on Travis or
- # other CI, or when producing Visual Studio Solution and Projects.
+# Check if environment variable BOOST_SRC_DIR is set
+if (NOT DEFINED BOOST_SRC_DIR AND DEFINED ENV{BOOST_SRC_DIR})
+ set(DEFAULT_BOOST_SRC_DIR "$ENV{BOOST_SRC_DIR}")
+else ()
+ set(DEFAULT_BOOST_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../..")
+endif ()
+set(BOOST_SRC_DIR ${DEFAULT_BOOST_SRC_DIR} CACHE STRING "Boost source dir to use when running CMake from this directory")
- set(BOOST_INCLUDE_LIBRARIES openmethod)
- set(BOOST_EXCLUDE_LIBRARIES openmethod)
- list(APPEND BOOST_INCLUDE_LIBRARIES test)
- if(BOOST_OPENMETHOD_BUILD_EXAMPLES)
- # list(APPEND BOOST_INCLUDE_LIBRARIES optional)
- endif()
+#-------------------------------------------------
+#
+# Boost modules
+#
+#-------------------------------------------------
+# The boost super-project requires one explicit dependency per-line.
- set(CMAKE_FOLDER _deps)
- add_subdirectory(../.. _deps/boost EXCLUDE_FROM_ALL)
- unset(CMAKE_FOLDER)
-endif()
-
-add_library(boost_openmethod INTERFACE)
-add_library(Boost::openmethod ALIAS boost_openmethod)
-
-target_compile_features(boost_openmethod INTERFACE cxx_std_17)
-
-target_include_directories(boost_openmethod INTERFACE include)
-
-target_link_libraries(
- boost_openmethod
- INTERFACE
+set(
+ BOOST_OPENMETHOD_DEPENDENCIES
Boost::assert
Boost::config
Boost::core
@@ -58,11 +67,119 @@ target_link_libraries(
Boost::preprocessor
)
-if(BOOST_OPENMETHOD_BUILD_TESTS)
- enable_testing()
- add_subdirectory(test)
+
+foreach (BOOST_OPENMETHOD_DEPENDENCY ${BOOST_OPENMETHOD_DEPENDENCIES})
+ if (BOOST_OPENMETHOD_DEPENDENCY MATCHES "^[ ]*Boost::([A-Za-z0-9_]+)[ ]*$")
+ list(APPEND BOOST_OPENMETHOD_INCLUDE_LIBRARIES ${CMAKE_MATCH_1})
+ endif ()
+endforeach ()
+# Conditional dependencies
+if (NOT BOOST_OPENMETHOD_MRDOCS_BUILD)
+ if (BUILD_TESTING OR BOOST_OPENMETHOD_BUILD_TESTS)
+ set(BOOST_OPENMETHOD_UNIT_TEST_LIBRARIES test)
+ endif()
+ if (BOOST_OPENMETHOD_BUILD_EXAMPLES)
+ #set(BOOST_OPENMETHOD_EXAMPLE_LIBRARIES json regex beast)
+ endif()
+endif()
+# Complete dependency list
+set(BOOST_INCLUDE_LIBRARIES ${BOOST_OPENMETHOD_INCLUDE_LIBRARIES} ${BOOST_OPENMETHOD_UNIT_TEST_LIBRARIES} ${BOOST_OPENMETHOD_EXAMPLE_LIBRARIES})
+set(BOOST_EXCLUDE_LIBRARIES openmethod)
+
+#-------------------------------------------------
+#
+# Add Boost Subdirectory
+#
+#-------------------------------------------------
+if (BOOST_OPENMETHOD_IS_ROOT)
+ set(CMAKE_FOLDER Dependencies)
+ # Find absolute BOOST_SRC_DIR
+ if (NOT IS_ABSOLUTE ${BOOST_SRC_DIR})
+ set(BOOST_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/${BOOST_SRC_DIR}")
+ endif ()
+
+ # Validate BOOST_SRC_DIR
+ set(BOOST_SRC_DIR_IS_VALID ON)
+ foreach (F "CMakeLists.txt" "Jamroot" "boost-build.jam" "bootstrap.sh" "libs")
+ if (NOT EXISTS "${BOOST_SRC_DIR}/${F}")
+ message(STATUS "${BOOST_SRC_DIR}/${F} does not exist. Fallback to find_package.")
+ set(BOOST_SRC_DIR_IS_VALID OFF)
+ break()
+ endif ()
+ endforeach ()
+
+ # Create Boost interface targets
+ if (BOOST_SRC_DIR_IS_VALID)
+ # From BOOST_SRC_DIR
+ if (BUILD_SHARED_LIBS)
+ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
+ endif()
+ set(BOOST_EXCLUDE_LIBRARIES ${PROJECT_NAME})
+ set(PREV_BUILD_TESTING ${BUILD_TESTING})
+ set(BUILD_TESTING OFF CACHE BOOL "Build the tests." FORCE)
+ add_subdirectory(${BOOST_SRC_DIR} Dependencies/boost EXCLUDE_FROM_ALL)
+ set(BUILD_TESTING ${PREV_BUILD_TESTING} CACHE BOOL "Build the tests." FORCE)
+ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${BOOST_SRC_DIR}/tools/cmake/include")
+ else ()
+ # From Boost Package
+ find_package(Boost REQUIRED COMPONENTS container)
+ foreach (BOOST_INCLUDE_LIBRARY ${BOOST_INCLUDE_LIBRARIES})
+ if (NOT TARGET Boost::${BOOST_INCLUDE_LIBRARY})
+ add_library(Boost::${BOOST_INCLUDE_LIBRARY} ALIAS Boost::headers)
+ endif ()
+ endforeach ()
+ endif ()
+ unset(CMAKE_FOLDER)
+endif ()
+
+#-------------------------------------------------
+#
+# Library
+#
+#-------------------------------------------------
+file(GLOB_RECURSE BOOST_OPENMETHOD_HEADERS CONFIGURE_DEPENDS include/boost/*.hpp)
+set_property(GLOBAL PROPERTY USE_FOLDERS ON)
+source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR}/include/boost PREFIX "" FILES ${BOOST_OPENMETHOD_HEADERS})
+function(boost_openmethod_setup_properties target)
+ target_link_libraries(${target} INTERFACE ${BOOST_OPENMETHOD_DEPENDENCIES})
+endfunction()
+
+add_library(boost_openmethod INTERFACE ${BOOST_OPENMETHOD_HEADERS})
+add_library(Boost::openmethod ALIAS boost_openmethod)
+target_include_directories(boost_openmethod INTERFACE "${PROJECT_SOURCE_DIR}/include")
+boost_openmethod_setup_properties(boost_openmethod)
+target_compile_features(boost_openmethod INTERFACE cxx_std_17)
+
+if (BOOST_OPENMETHOD_MRDOCS_BUILD)
+ file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/mrdocs.cpp" "#include \n")
+ foreach (HEADER ${BOOST_OPENMETHOD_HEADERS})
+ string(REPLACE "${PROJECT_SOURCE_DIR}/include/" "" HEADER "${HEADER}")
+ file(APPEND "${CMAKE_CURRENT_BINARY_DIR}/mrdocs.cpp" "#include <${HEADER}>\n")
+ endforeach()
+ add_library(boost_openmethod_mrdocs "${CMAKE_CURRENT_BINARY_DIR}/mrdocs.cpp")
+ target_include_directories(boost_openmethod_mrdocs PUBLIC "${PROJECT_SOURCE_DIR}/include")
+ boost_openmethod_setup_properties(boost_openmethod_mrdocs)
+ target_link_libraries(boost_openmethod_mrdocs PUBLIC Boost::openmethod)
+ target_compile_definitions(boost_openmethod_mrdocs PUBLIC BOOST_OPENMETHOD_MRDOCS)
+ return()
endif()
-if(BOOST_OPENMETHOD_BUILD_EXAMPLES)
- add_subdirectory(example)
-endif()
+#-------------------------------------------------
+#
+# Tests
+#
+#-------------------------------------------------
+if (BUILD_TESTING OR BOOST_OPENMETHOD_BUILD_TESTS)
+ enable_testing()
+ add_subdirectory(test)
+endif ()
+
+#-------------------------------------------------
+#
+# Examples
+#
+#-------------------------------------------------
+if (BOOST_OPENMETHOD_BUILD_EXAMPLES)
+ enable_testing()
+ add_subdirectory(doc/modules/ROOT/examples)
+endif ()
diff --git a/ce/2-method-vptr-final.cpp b/ce/2-method-vptr-final.cpp
index 9913081..0adac71 100644
--- a/ce/2-method-vptr-final.cpp
+++ b/ce/2-method-vptr-final.cpp
@@ -1,7 +1,7 @@
#include
#include
#include
-#include
+#include
struct Animal {
const char* name;
diff --git a/ce/2-method-vptr.cpp b/ce/2-method-vptr.cpp
index 05492ea..2bfc279 100644
--- a/ce/2-method-vptr.cpp
+++ b/ce/2-method-vptr.cpp
@@ -1,7 +1,7 @@
#include
#include
#include
-#include
+#include
struct Animal {
const char* name;
diff --git a/ce/2-method.cpp b/ce/2-method.cpp
index aa4c7dc..4be0a11 100644
--- a/ce/2-method.cpp
+++ b/ce/2-method.cpp
@@ -1,7 +1,7 @@
#include
#include
#include
-#include
+#include
struct Animal {
const char* name;
diff --git a/ce/uni-method-vptr-final.cpp b/ce/uni-method-vptr-final.cpp
index 6749bed..5449682 100644
--- a/ce/uni-method-vptr-final.cpp
+++ b/ce/uni-method-vptr-final.cpp
@@ -2,7 +2,7 @@
#include
#include
-#include
+#include
struct Animal {
const char* name;
diff --git a/ce/uni-method-vptr.cpp b/ce/uni-method-vptr.cpp
index 5806fd9..e28658e 100644
--- a/ce/uni-method-vptr.cpp
+++ b/ce/uni-method-vptr.cpp
@@ -1,7 +1,7 @@
#include
#include
#include
-#include
+#include
struct Animal {
const char* name;
diff --git a/ce/uni-method.cpp b/ce/uni-method.cpp
index 62aed67..0ce2675 100644
--- a/ce/uni-method.cpp
+++ b/ce/uni-method.cpp
@@ -1,7 +1,7 @@
#include
#include
#include
-#include
+#include
struct Animal {
const char* name;
diff --git a/dev/local-flat.sh b/dev/local-flat.sh
index c635a36..f7cc4e4 100755
--- a/dev/local-flat.sh
+++ b/dev/local-flat.sh
@@ -4,7 +4,7 @@ python3 dev/flatten.py \
include/boost/openmethod.hpp \
include/boost/openmethod/unique_ptr.hpp \
include/boost/openmethod/shared_ptr.hpp \
- include/boost/openmethod/compiler.hpp
+ include/boost/openmethod/initialize.hpp
python3 dev/flatten.py \
flat/boost/openmethod/registry.hpp \
include/boost/openmethod/registry.hpp \
diff --git a/doc/.gitignore b/doc/.gitignore
new file mode 100644
index 0000000..84d1a29
--- /dev/null
+++ b/doc/.gitignore
@@ -0,0 +1,6 @@
+temp
+out.txt
+qbk/reference.qbk
+node_modules
+build
+reference-output
diff --git a/doc/antora.yml b/doc/antora.yml
new file mode 100644
index 0000000..718b191
--- /dev/null
+++ b/doc/antora.yml
@@ -0,0 +1,32 @@
+#
+# Copyright (c) 2023 Alan de Freitas (alandefreitas@gmail.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)
+#
+# Official repository: https://github.com/boostorg/openmethod
+#
+
+name: openmethod
+version: ~
+title: Boost.OpenMethod
+start_page: index.adoc
+asciidoc:
+ attributes:
+ source-language: asciidoc@
+ table-caption: false
+nav:
+ - modules/ROOT/nav.adoc
+ext:
+ cpp-reference:
+ config: doc/mrdocs.yml
+ cpp-tagfiles:
+ files:
+ - file: ./doc/tagfiles/boost-openmethod-doxygen.tag.xml
+ base_url: 'xref:reference:'
+ - file: ./doc/tagfiles/boost-openmethod-macros-doxygen.tag.xml
+ base_url: 'xref:reference:'
+ using-namespaces:
+ - boost::openmethod
+ - boost::openmethod::policies
+ - boost::openmethod::aliases
diff --git a/doc/basic_policy.adoc b/doc/basic_policy.adoc
index 374f58a..8f064d7 100644
--- a/doc/basic_policy.adoc
+++ b/doc/basic_policy.adoc
@@ -46,7 +46,7 @@ Defined in . Also available via
### Description
`basic_policy` implements a policy, which consists of a a collection of methods,
-classes, dispatch data, and facets, which specify how to obtain a pointer to a
+classes, dispatch data, and policys, which specify how to obtain a pointer to a
v-table from an object, how to report errors, whether to perform runtime sanity
checks, etc.
@@ -75,7 +75,7 @@ Creates a new policy from an existing one. _NewPolicy_ does not share static
variables with the original _Policy_. The new policy does not retain any
knowledge of the classes and methods registered in the original.
-`fork` forks the facets in the policy as well: any facet instantiated from a
+`fork` forks the policys in the policy as well: any policy instantiated from a
class template is assumed to take a policy as its first template argument. The
template is re-instantiated with the new policy as the first arguments, while
the other arguments remain the same.
@@ -87,9 +87,9 @@ template
using with;
```
-Requires:: _Facets_ is a list of classes that derive from `facet`.
+Requires:: _Facets_ is a list of classes that derive from `policy`.
-Returns:: A new policy containing _Facets_, and the facets from the original
+Returns:: A new policy containing _Facets_, and the policys from the original
that do not have the same category as _Facets_.
Examples::
@@ -111,9 +111,9 @@ template
using without;
```
-Requires:: _Facets_ is a list of facet categories.
+Requires:: _Facets_ is a list of policy categories.
-Returns:: A new policy containing the facets from the original that do not have
+Returns:: A new policy containing the policys from the original that do not have
the same category as _Facets_.
Examples::
@@ -130,7 +130,7 @@ Examples::
struct release;
```
-A policy that contains facets `std_rtti`, `fast_perfect_hash`, `vptr_vector` and
+A policy that contains policys `std_rtti`, `fast_perfect_hash`, `vptr_vector` and
`default_error_handler`.
#### debug
@@ -139,7 +139,7 @@ A policy that contains facets `std_rtti`, `fast_perfect_hash`, `vptr_vector` and
struct debug;
```
-The `release` policy with additional facet implementations `runtime_checks`,
+The `release` policy with additional policy implementations `runtime_checks`,
`basic_error_output` and basic_trace_output.
NOTE: `debug` extends `release` but it does not a fork it. Both policies use the
diff --git a/doc/build_antora.sh b/doc/build_antora.sh
new file mode 100755
index 0000000..b0dc2c9
--- /dev/null
+++ b/doc/build_antora.sh
@@ -0,0 +1,28 @@
+#
+# Copyright (c) 2023 Alan de Freitas (alandefreitas@gmail.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)
+#
+# Official repository: https://github.com/boostorg/openmethod
+#
+
+set -xe
+
+if [ $# -eq 0 ]
+ then
+ echo "No playbook supplied, using default playbook"
+ PLAYBOOK="local-playbook.yml"
+ else
+ PLAYBOOK=$1
+fi
+
+echo "Building documentation with Antora..."
+echo "Installing npm dependencies..."
+npm ci
+
+echo "Building docs in custom dir..."
+PATH="$(pwd)/node_modules/.bin:${PATH}"
+export PATH
+npx antora --clean --fetch "$PLAYBOOK" --stacktrace --log-level all
+echo "Done"
diff --git a/doc/default_error_handler.adoc b/doc/default_error_handler.adoc
index 71fcae7..4d2bd63 100644
--- a/doc/default_error_handler.adoc
+++ b/doc/default_error_handler.adoc
@@ -40,7 +40,7 @@ static auto error(const Error& error) -> void;
```
Calls the function last set via `set_error_handler` or, if it was never called,
-and if _Policy_ contains an `output` facet, use it to print a description
+and if _Policy_ contains an `output` policy, use it to print a description
of `error`.
#### error
diff --git a/doc/deferred_static_rtti.adoc b/doc/deferred_static_rtti.adoc
index 4019c0e..a8aab78 100644
--- a/doc/deferred_static_rtti.adoc
+++ b/doc/deferred_static_rtti.adoc
@@ -15,11 +15,11 @@ struct deferred_static_rtti : rtti {};
### Description
-`deferred_static_rtti` is a facet that defers collection of static type ids.
+`deferred_static_rtti` is a policy that defers collection of static type ids.
Some custom RTTI systems rely on static constructors to assign type ids.
OpenMethod itself relies on static constructors to register classes, methods and
-overriders, calling the `static_type` function from the `rtti` facet in the
+overriders, calling the `static_type` function from the `rtti` policy in the
process. This can result in collecting the type ids _before_ they have been
-initialized. Adding this facet to a policy moves the collection of type ids to
+initialized. Adding this policy to a policy moves the collection of type ids to
`initialize`.
diff --git a/doc/error_handler.adoc b/doc/error_handler.adoc
index b48f759..9d943ef 100644
--- a/doc/error_handler.adoc
+++ b/doc/error_handler.adoc
@@ -42,10 +42,10 @@ struct type_mismatch_error : openmethod_error {
### Description
-`error_handler` is a facet that handles errors.
+`error_handler` is a policy that handles errors.
When an error is encountered, either during `initialize` or method dispatch, the
-program is terminated via a call to `abort`. If this facet is present in the
+program is terminated via a call to `abort`. If this policy is present in the
policy, its `error` function is called with an error object. It can prevent
termination by throwing an exception.
diff --git a/doc/error_output.adoc b/doc/error_output.adoc
index e851931..e2d46b9 100644
--- a/doc/error_output.adoc
+++ b/doc/error_output.adoc
@@ -8,21 +8,21 @@ Defined in .
```c++
namespace boost::openmethod::policies {
-struct output : facet {};
+struct output : policy {};
} // boost::openmethod::policies
```
### Description
-`output` is a facet that provides a stream for writing error messages.
+`output` is a policy that provides a stream for writing error messages.
### Requirements
#### error_stream
```c++
-static RestrictedOutputStream error_stream;
+static LightweightOutputStream error_stream;
```
-A static variable that satisfies the requirements of `RestrictedOutputStream`.
+A static variable that satisfies the requirements of `LightweightOutputStream`.
diff --git a/doc/facet.adoc b/doc/facet.adoc
index 7155c9e..a4d206b 100644
--- a/doc/facet.adoc
+++ b/doc/facet.adoc
@@ -1,5 +1,5 @@
-## facet
+## policy
### Synopsis
@@ -8,7 +8,7 @@ Defined in .
```c++
namespace boost::openmethod::policies {
-struct facet {
+struct policy {
static auto finalize() -> void;
};
@@ -17,7 +17,7 @@ struct facet {
### Description
-`facet` is the base class of all facets. It provides an empty `finalize` static
+`policy` is the base class of all policys. It provides an empty `finalize` static
function which can be overriden (via shadowing) by derived classes.
### Members
diff --git a/doc/html/index.html b/doc/html/index.html
index d463a59..0e1e0c3 100644
--- a/doc/html/index.html
+++ b/doc/html/index.html
@@ -454,7 +454,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
Smart Pointers
Alternatives to virtual_ptr
Core API
-Policies and Facets
+Policies and Facets
Error Handling
Custom RTTI
Deferred RTTI
@@ -635,7 +635,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
Non-members
-facet
+policy
-RestrictedOutputStream
+LightweightOutputStream
@@ -1615,9 +1615,9 @@ readability):
mov rax, qword ptr [rsi]
-mov rdx, qword ptr [rip + hash_mult]
+mov rdx, qword ptr [rip + mult]
imul rdx, qword ptr [rax - 8]
-movzx ecx, byte ptr [rip + hash_shift]
+movzx ecx, byte ptr [rip + shift]
shr rdx, cl
mov rax, qword ptr [rip + vptrs]
mov rax, qword ptr [rax + 8*rdx]
@@ -2165,7 +2165,7 @@ added elsewhere - especially in presence of dynamic loading.
-
Policies and Facets
+
Policies and Facets
Methods and classes are scoped in a policy. A method can only reference classes
registered in the same policy. If a class is used as a virtual parameter in
@@ -2178,17 +2178,17 @@ argument, a policy class, which defaults to policies::debug in debu
and policies::release in release builds.
-
A policy has a collection of facets. Each facet belongs to a facet category. A
-policy may contain at most one facet of a given category. Facets control how
+
A policy has a collection of policys. Each policy belongs to a policy category. A
+policy may contain at most one policy of a given category. Facets control how
type information is obtained, how vptrs are fetched, how errors are handled and
printed, etc. Some are used in initialize and method dispatch; some are used
-by other facets in the same policy as part of their implementation. See the
-reference for the list of facets. Policies and facets are placed in the
+by other policys in the same policy as part of their implementation. See the
+reference for the list of policys. Policies and policys are placed in the
boost::openmethod::policies namespace. Two stock policies are provided by the
library: release and debug.
-
The release policy contains the following facets:
+
The release policy contains the following policys:
@@ -2198,8 +2198,8 @@ library: release and debug.
-| facet category |
-facet |
+policy category |
+policy |
role |
@@ -2227,7 +2227,7 @@ library: release and debug.
-
The debug policy contains the same facets as release, plus a few more:
+
The debug policy contains the same policys as release, plus a few more:
@@ -2237,8 +2237,8 @@ library: release and debug.
-| facet category |
-facet |
+policy category |
+policy |
role |
@@ -2261,12 +2261,12 @@ library: release and debug.
-
Policies, and some facets, have static variables. When it is the case, they are
+
Policies, and some policys, have static variables. When it is the case, they are
implemented as CRTP classes.
Policies can be created from scratch, using the basic_policy template, or
-constructed from existing policies by adding and removing facets. For example,
+constructed from existing policies by adding and removing policys. For example,
policies::debug is a tweak of policies::release:
@@ -2295,9 +2295,9 @@ has no effect.
Error Handling
When an error is encountered, the program is terminated by a call to abort. If
-the policy contains an error_handler facet, it provides an error member
+the policy contains an error_handler policy, it provides an error member
function (or overloaded functions) to be called with an object identifying the
-error. The release and debug policies implement the error facet with
+error. The release and debug policies implement the error policy with
default_error_handler, which wraps the error object in a variant, and calls a
handler via a std::function. By default, it prints a description of the error
to stderr in the debug policy, and does nothing in the release policy. The
@@ -2366,7 +2366,7 @@ spin
-
We can also replace the error_handler facet with our own. For example:
+
We can also replace the error_handler policy with our own. For example:
@@ -2441,7 +2441,7 @@ spin
-
Stock facet throw_error_handler does this for all the exception types:
+
Stock policy throw_error_handler does this for all the exception types:
@@ -2567,11 +2567,11 @@ them as indexes in the table of vptrs.
This time we are going to replace the default policy globally. First we need to
-define the custom RTTI facet. We must not include
+define the custom RTTI policy. We must not include
<boost/openmethod/core.hpp> or any header that includes it yet.
-
Here is the facet implementation:
+
Here is the policy implementation:
@@ -2605,7 +2605,7 @@ struct custom_rtti : bom::policies::rtti {
-
This facet is quite minimal. It does not support virtual inheritance. It would
+
This policy is quite minimal. It does not support virtual inheritance. It would
not produce good error or trace messages, because types would be represented by
their integer ids.
@@ -2678,7 +2678,7 @@ registration. It may read the custom type ids
before they are have been
initialized.
-
The solution is to add the deferred_static_rtti facet to the policy; it defers
+
The solution is to add the deferred_static_rtti policy to the policy; it defers
reading the type information until initialize is called.
@@ -2740,7 +2740,7 @@ custom_type_info Cat::type_info;
-
The rtti facet is the same, with one more function:
+
The rtti policy is the same, with one more function:
@@ -2761,14 +2761,14 @@ custom_type_info Cat::type_info;
-
Finally, the policy contains an additional facet - deferred_static_rtti:
+
Finally, the policy contains an additional policy - deferred_static_rtti:
struct custom_policy
: bom::policies::basic_policy<
custom_policy, custom_rtti,
- bom::policies::deferred_static_rtti, // <-- additional facet
+ bom::policies::deferred_static_rtti, // <-- additional policy
bom::policies::vptr_vector<custom_policy>> {};
@@ -2804,7 +2804,7 @@ implementation detail, but it uses its own policy, there is no issue.
-
The solution is to use a policy that contains the indirect_vptr facet. Instead
+
The solution is to use a policy that contains the indirect_vptr policy. Instead
of storing the vptr directly, it stores a reference to the vptr.
@@ -2828,15 +2828,15 @@ struct Carnivore : Animal {};
struct Cow : Herbivore {};
struct Wolf : Carnivore {};
-struct dynamic_policy : boost::openmethod::default_registry::with<
+struct dynamic : boost::openmethod::default_registry::with<
boost::openmethod::policies::indirect_vptr> {};
template<class Class>
-using dyn_vptr = boost::openmethod::virtual_ptr<Class, dynamic_policy>;
+using dyn_vptr = boost::openmethod::virtual_ptr<Class, dynamic>;
BOOST_OPENMETHOD(
encounter, (dyn_vptr<Animal>, dyn_vptr<Animal>), std::string,
- dynamic_policy);
+ dynamic);
@@ -2853,7 +2853,7 @@ The policy must be passed to the method as well as the
-
The indirect_vptr facet tells virtual_ptr to use a pointer to the vptr. Even
+
The indirect_vptr policy tells virtual_ptr to use a pointer to the vptr. Even
tough the value of the vptr changes when initialize is called, the vptrs are
stored in the same place (the policy’s static_vptr<Class> variables).
@@ -2876,7 +2876,7 @@ stored in the same place (the policy’s static_vptr<Class>
auto main() -> int {
using namespace boost::openmethod;
- initialize<dynamic_policy>();
+ initialize<dynamic>();
std::cout << "Before loading library\n";
- auto gracie = make_unique_virtual<Cow, dynamic_policy>();
+ auto gracie = make_unique_virtual<Cow, dynamic>();
// Wolf _willy;
- // auto willy = virtual_ptr<Wolf, dynamic_policy>(_willy);
- auto willy = make_unique_virtual<Wolf, dynamic_policy>();
+ // auto willy = virtual_ptr<Wolf, dynamic>(_willy);
+ auto willy = make_unique_virtual<Wolf, dynamic>();
std::cout << "Gracie encounters Willy -> "
<< encounter(gracie, willy); // ignore
@@ -2927,7 +2927,7 @@ BOOST_OPENMETHOD_OVERRIDE(
struct Tiger : Carnivore {};
-BOOST_OPENMETHOD_CLASSES(Tiger, Carnivore, dynamic_policy);
+BOOST_OPENMETHOD_CLASSES(Tiger, Carnivore, dynamic);
extern "C" auto make_tiger() -> Tiger* {
return new Tiger;
@@ -2957,7 +2957,7 @@ BOOST_OPENMETHOD_OVERRIDE(
std::cout << "\nAfter loading library\n";
- boost::openmethod::initialize<dynamic_policy>();
+ boost::openmethod::initialize<dynamic>();
auto make_tiger =
reinterpret_cast<Animal* (*)()>(dlsym(handle, "make_tiger"));
@@ -2986,7 +2986,7 @@ BOOST_OPENMETHOD_OVERRIDE(
std::cout << "\nAfter unloading library\n";
- boost::openmethod::initialize<dynamic_policy>();
+ boost::openmethod::initialize<dynamic>();
std::cout << "Gracie encounters Willy -> "
<< encounter(gracie, willy); // ignore
@@ -3147,71 +3147,71 @@ preprocessor symbol NDEBUG.
Usually not included directly. Can be used to create custom policies from stock
-policies, by forking them and adjusting a few facets.
+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, facet, and its abstract subclasses (rtti, extern_vptr,
+basic_policy, policy, and its abstract subclasses (rtti, extern_vptr,
etc).
<boost/openmethod/policies/std_rtti.hpp>
-
Implements the rtti facet using standard RTTI.
+
Implements the rtti policy using standard RTTI.
<boost/openmethod/policies/minimal_rtti.hpp>
-
Implements the rtti facet using a minimal RTTI implementation. Can be used only with the "final" constructs, or with intrusive v-table pointers.
+
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 facet using a vector of pointers.
+
Implements the extern_vptr policy using a vector of pointers.
<boost/openmethod/policies/vptr_map.hpp>
-
Implements the extern_vptr facet using a map of pointers.
+
Implements the extern_vptr policy using a map of pointers.
<boost/openmethod/policies/fast_perfect_hash.hpp>
-
Implements the type_hash facet using a perfect hash function.
+
Implements the type_hash policy using a perfect hash function.
<boost/openmethod/policies/default_error_handler.hpp>
-
Implements the error_handler facet by routing the error through a
+
Implements the error_handler policy by routing the error through a
std::function.
<boost/openmethod/policies/throw_error_handler.hpp>
-
Implements the error_handler facet by throwing an exception.
+
Implements the error_handler policy by throwing an exception.
<boost/openmethod/policies/basic_error_output.hpp>
-
Implements the output facet using a lightweight version of
+
Implements the output policy using a lightweight version of
std::ostream.
<boost/openmethod/policies/basic_trace_output.hpp>
-
Implements the trace facet using a lightweight version of
+
Implements the trace policy using a lightweight version of
std::ostream.
@@ -3804,7 +3804,7 @@ auto finalize() -> void;
Description
De-allocates the resources allocated by initialize for the Policy, including
-resources allocated by the facets in Policy. Resources are de-allocated in an
+resources allocated by the policys in Policy. Resources are de-allocated in an
arbitrary order. It is not necessary to call finalize between calls to
initialize. It is provided mainly for the benefit of memory leak detection
schemes.
@@ -5025,7 +5025,7 @@ using default_registry = policies::debug;
Description
basic_policy implements a policy, which consists of a a collection of methods,
-classes, dispatch data, and facets, which specify how to obtain a pointer to a
+classes, dispatch data, and policys, which specify how to obtain a pointer to a
v-table from an object, how to report errors, whether to perform runtime sanity
checks, etc.
@@ -5062,7 +5062,7 @@ variables with the original
Policy. The new policy does not retain any
knowledge of the classes and methods registered in the original.
-
fork forks the facets in the policy as well: any facet instantiated from a
+
fork forks the policys in the policy as well: any policy instantiated from a
class template is assumed to take a policy as its first template argument. The
template is re-instantiated with the new policy as the first arguments, while
the other arguments remain the same.
@@ -5080,11 +5080,11 @@ using with;
- Requires
-
-
Facets is a list of classes that derive from facet.
+Facets is a list of classes that derive from policy.
- Returns
-
-
A new policy containing Facets, and the facets from the original
+
A new policy containing Facets, and the policys from the original
that do not have the same category as Facets.
- Examples
@@ -5125,11 +5125,11 @@ using without;
- Requires
-
-
Facets is a list of facet categories.
+Facets is a list of policy categories.
- Returns
-
-
A new policy containing the facets from the original that do not have
+
A new policy containing the policys from the original that do not have
the same category as Facets.
- Examples
@@ -5159,7 +5159,7 @@ will not be used.
-
A policy that contains facets std_rtti, fast_perfect_hash, vptr_vector and
+
A policy that contains policys std_rtti, fast_perfect_hash, vptr_vector and
default_error_handler.
@@ -5171,7 +5171,7 @@ will not be used.
-
The release policy with additional facet implementations runtime_checks,
+
The release policy with additional policy implementations runtime_checks,
basic_error_output and basic_trace_output.
@@ -5197,7 +5197,7 @@ same domain.
-
facet
+
policy
Synopsis
@@ -5207,7 +5207,7 @@ same
domain.
namespace boost::openmethod::policies {
-struct facet {
+struct policy {
static auto finalize() -> void;
};
@@ -5218,7 +5218,7 @@ struct facet {
Description
-
facet is the base class of all facets. It provides an empty finalize static
+
policy is the base class of all policys. It provides an empty finalize static
function which can be overriden (via shadowing) by derived classes.
@@ -5248,7 +5248,7 @@ function which can be overriden (via shadowing) by derived classes.
namespace boost::openmethod::policies {
-struct rtti : facet {};
+struct rtti : policy {};
} // boost::openmethod::policies
@@ -5257,7 +5257,7 @@ struct rtti : facet {};
Description
-
The rtti facet provides type information for classes and objects, implements
+
The rtti policy provides type information for classes and objects, implements
downcast in presence of virtual inheritance, and writes descriptions of types to
an ostream-like object.
@@ -5377,7 +5377,7 @@ struct std_rtti : rtti {
Description
-
std_rtti is an implementation of the rtti facet that uses standard RTTI.
+
std_rtti is an implementation of the rtti policy that uses standard RTTI.
@@ -5468,14 +5468,14 @@ struct deferred_static_rtti : rtti {};
Description
-
deferred_static_rtti is a facet that defers collection of static type ids.
+
deferred_static_rtti is a policy that defers collection of static type ids.
Some custom RTTI systems rely on static constructors to assign type ids.
OpenMethod itself relies on static constructors to register classes, methods and
-overriders, calling the static_type function from the rtti facet in the
+overriders, calling the static_type function from the rtti policy in the
process. This can result in collecting the type ids before they have been
-initialized. Adding this facet to a policy moves the collection of type ids to
+initialized. Adding this policy to a policy moves the collection of type ids to
initialize.
@@ -5499,15 +5499,15 @@ initialized. Adding this facet to a policy moves the collection of type ids to
Description
-
minimal_rtti is an implementation of the rtti facet that only uses static
+
minimal_rtti is an implementation of the rtti policy that only uses static
type information.
minimal_rtti provides the only function strictly required for the rtti
-facet.
+policy.
-
This facet can be used in programs that call methods solely via
+
This policy can be used in programs that call methods solely via
virtual_ptrs created with the "final" constructs. Virtual inheritance
is not supported. Classes are not required to be polymorphic.
@@ -5523,7 +5523,7 @@ static constexpr bool is_polymorphic = false;
-
This facet does not support polymorphic classes.
+
This policy does not support polymorphic classes.
@@ -5551,7 +5551,7 @@ static auto static_type() -> type_id;
namespace boost::openmethod::policies {
-struct extern_vptr : facet {};
+struct extern_vptr : policy {};
}
@@ -5560,7 +5560,7 @@ struct extern_vptr : facet {};
Description
-
extern_vptr is a facet that stores and returns pointers to v-tables for
+
extern_vptr is a policy that stores and returns pointers to v-tables for
registered classes.
@@ -5605,14 +5605,14 @@ the same.
Synopsis
-
struct indirect_vptr : facet {};
+
struct indirect_vptr : policy {};
Description
-
indirect_vptr is a facet that makes virtual_ptrs and inplace_vptr use
+
indirect_vptr is a policy that makes virtual_ptrs and inplace_vptr use
pointers to pointers to v-tables, instead of straight pointers. As a
consequence, they remain valid after a call to initialize.
@@ -5620,7 +5620,7 @@ consequence, they remain valid after a call to
initialize.
Requirements
-
None. The facet is its own implementation.
+
None. The policy is its own implementation.
@@ -5658,7 +5658,7 @@ of indirection is added, making the policy usable in presence of dynamic
loading.
-
Policy is the policy containing the facet.
+
Policy is the policy containing the policy.
@@ -5676,7 +5676,7 @@ auto register_vptrs(ForwardIterator first, ForwardIterator last) -> void;type_id`s of the classes registered in `Policy.
-
If Policy contains a type_hash facet, call its hash_initialize
+
If Policy contains a type_hash policy, call its hash_initialize
function, and uses it to convert the type_ids to an index.
@@ -5693,7 +5693,7 @@ auto dynamic_vptr(const Class& object) -> const vptr_type&;
Obtains a type_id for object using Policy::dynamic_type. If Policy
-contains a type_hash facet, uses it to convert the result to an index;
+contains a type_hash policy, uses it to convert the result to an index;
otherwise, uses the type_id as the index.
@@ -5731,7 +5731,7 @@ the v-tables in a map. If `Policy contains indirect_vptr, a
indirection is added, making the policy usable in presence of dynamic loading.
-
Policy is the policy containing the facet.
+
Policy is the policy containing the policy.
MapAdaptor is a Boost.Mp11 quoted metafunction that returns a map type.
@@ -5763,8 +5763,8 @@ auto dynamic_vptr(const Class& object) -> const vptr_type&;Returns a pointer to the v-table for
object (by reference).
-
If Policy contains the runtime_checks facet, checks if Class is
-registered. If it is not, and Policy contains a error_handler facet, calls
+
If Policy contains the runtime_checks policy, checks if Class is
+registered. If it is not, and Policy contains a error_handler policy, calls
its error function; then calls abort.
@@ -5781,7 +5781,7 @@ its error function; then calls abort.
namespace boost::openmethod::policies {
-struct type_hash : facet {};
+struct type_hash : policy {};
} // boost::openmethod::policies
@@ -5790,7 +5790,7 @@ struct type_hash : facet {};
Description
-
type_hash is a facet that provides a hash function for a fixed set of
+
type_hash is a policy that provides a hash function for a fixed set of
type_ids.
@@ -5872,9 +5872,9 @@ function for type_ids.
hash_initialize.
-
If the policy has a runtime_checks facet, hash_type_id checks that type
+
If the policy has a runtime_checks policy, hash_type_id checks that type
corresponds to a registered class. If not, it reports a unknown_class_error
-using the policy’s error_handler facet, if present, then calls abort.
+using the policy’s error_handler policy, if present, then calls
abort.
@@ -5891,11 +5891,11 @@ function.
If no such factors cannot be found, hash_initialize reports a
-hash_search_error using the policy’s error_handler facet, if present, the
+hash_search_error using the policy’s error_handler policy, if present, the
calls abort.
-
If the policy has a trace facet, hash_initialize uses it to write a
+
If the policy has a trace policy, hash_initialize uses it to write a
summary of the search.
@@ -5947,11 +5947,11 @@ struct type_mismatch_error : openmethod_error {
Description
-
error_handler is a facet that handles errors.
+
error_handler is a policy that handles errors.
When an error is encountered, either during initialize or method dispatch, the
-program is terminated via a call to abort. If this facet is present in the
+program is terminated via a call to abort. If this policy is present in the
policy, its error function is called with an error object. It can prevent
termination by throwing an exception.
@@ -6019,7 +6019,7 @@ static auto error(const Error& error) -> void;
Calls the function last set via set_error_handler or, if it was never called,
-and if Policy contains an output facet, use it to print a description
+and if Policy contains an output policy, use it to print a description
of error.
@@ -6059,7 +6059,7 @@ struct throw_error_handler : error_handler {
Description
-
throw_error_handler is an implementation of the error_handler facet that
+
throw_error_handler is an implementation of the error_handler policy that
throws the error as an exception.
@@ -6103,7 +6103,7 @@ struct basic_error_output : output {
Description
basic_error_output is an implementation of output that writes error
-messages to a RestrictedOutputStream.
+messages to a
LightweightOutputStream.
@@ -6148,7 +6148,7 @@ struct basic_trace_output : trace {
Description
basic_error_output is an implementation of trace that writes error
-messages to a RestrictedOutputStream.
+messages to a
LightweightOutputStream.
@@ -6180,11 +6180,11 @@ open it.
-
RestrictedOutputStream
+
LightweightOutputStream
Description
-
RestrictedOutputStream is a concept describing a std::ostream-like class with
+
LightweightOutputStream is a concept describing a std::ostream-like class with
a reduced set of operations.
@@ -6194,7 +6194,7 @@ uses a small subset of the operations supported by std::ostream. By
the library uses a lightweight implementation based on the C stream functions.
-
Implementations of RestrictedOutputStream provide the following functions:
+
Implementations of LightweightOutputStream provide the following functions:
@@ -6210,7 +6210,7 @@ the library uses a lightweight implementation based on the C stream functions.
- RestrictedOutputStream& operator<<(RestrictedOutputStream& os, const char* str)
+ LightweightOutputStream& operator<<(LightweightOutputStream& os, const char* str)
|
Write a null-terminated string str to os
@@ -6218,7 +6218,7 @@ the library uses a lightweight implementation based on the C stream functions.
|
- RestrictedOutputStream& operator<<(RestrictedOutputStream& os, const std::string_view& view)
+ LightweightOutputStream& operator<<(LightweightOutputStream& os, const std::string_view& view)
|
Write a view to `os
@@ -6226,7 +6226,7 @@ the library uses a lightweight implementation based on the C stream functions.
|
- RestrictedOutputStream& operator<<(RestrictedOutputStream& os, const void* value)
+ LightweightOutputStream& operator<<(LightweightOutputStream& os, const void* value)
|
Write a representation of a pointer to os
@@ -6234,7 +6234,7 @@ the library uses a lightweight implementation based on the C stream functions.
|
- RestrictedOutputStream& operator<<(RestrictedOutputStream& os, std::size_t value)
+ LightweightOutputStream& operator<<(LightweightOutputStream& os, std::size_t value)
|
Write an unsigned integer to os
@@ -6253,4 +6253,4 @@ Last updated 2025-06-22 13:38:14 -0400
|