├── tests ├── unit │ └── __init__.py ├── e2e │ └── __init__.py ├── integration │ ├── __init__.py │ ├── test_rebuild_query_workflow.py │ ├── test_erase_query_workflow.py │ └── test_insert_query_workflow.py ├── _ci_debug_import.py ├── conftest.py └── _ci_test_runner.py ├── src └── python_prtree │ ├── py.typed │ └── __init__.py ├── docs ├── images │ ├── 2d_fig1.png │ ├── 2d_fig2.png │ ├── 2d_fig3.png │ ├── 3d_fig1.png │ ├── 3d_fig2.png │ └── 3d_fig3.png ├── baseline │ └── system_info.txt └── README.md ├── third └── cereal │ ├── Config.cmake.in │ ├── unittests │ ├── run_valgrind.sh │ ├── run_portability_test.cmake │ ├── cpp17 │ │ ├── CMakeLists.txt │ │ ├── optional.cpp │ │ ├── variant.cpp │ │ └── variant.hpp │ ├── boost │ │ ├── CMakeLists.txt │ │ └── boost_variant.cpp │ ├── unordered_loads.cpp │ ├── valarray.cpp │ ├── set.cpp │ ├── pair.cpp │ ├── list.cpp │ ├── defer.cpp │ ├── queue.cpp │ ├── stack.cpp │ ├── tuple.cpp │ ├── atomic.cpp │ ├── bitset.cpp │ ├── chrono.cpp │ ├── deque.cpp │ ├── vector.cpp │ ├── complex.cpp │ ├── structs.cpp │ ├── multimap.cpp │ ├── multiset.cpp │ ├── forward_list.cpp │ ├── memory_cycles.cpp │ ├── unordered_map.cpp │ ├── unordered_set.cpp │ ├── priority_queue.cpp │ ├── structs_minimal.cpp │ ├── unordered_multimap.cpp │ ├── unordered_multiset.cpp │ ├── user_data_adapters.cpp │ ├── load_construct.cpp │ ├── structs_specialized.cpp │ ├── pod.cpp │ ├── array.cpp │ ├── map.cpp │ ├── memory.cpp │ ├── structs.hpp │ ├── versioning.cpp │ ├── polymorphic.cpp │ └── complex.hpp │ ├── cereal.pc.in │ ├── sandbox │ ├── sandbox_shared_lib │ │ ├── CMakeLists.txt │ │ ├── base.cpp │ │ ├── derived.cpp │ │ ├── derived.hpp │ │ └── base.hpp │ └── CMakeLists.txt │ ├── scripts │ ├── renameincludes.sh │ ├── add_rapidjson_prefix.sh │ ├── updatedoc.in │ ├── updatecoverage.sh │ └── appveyor.bat │ ├── include │ └── cereal │ │ ├── external │ │ ├── rapidjson │ │ │ ├── LICENSE │ │ │ ├── internal │ │ │ │ ├── swap.h │ │ │ │ └── strfunc.h │ │ │ ├── msinttypes │ │ │ │ └── LICENSE │ │ │ ├── cursorstreamwrapper.h │ │ │ ├── ostreamwrapper.h │ │ │ ├── memorybuffer.h │ │ │ └── memorystream.h │ │ ├── LICENSE │ │ └── rapidxml │ │ │ └── license.txt │ │ ├── types │ │ ├── map.hpp │ │ ├── unordered_map.hpp │ │ ├── functional.hpp │ │ ├── utility.hpp │ │ ├── atomic.hpp │ │ ├── complex.hpp │ │ ├── list.hpp │ │ ├── deque.hpp │ │ ├── optional.hpp │ │ ├── forward_list.hpp │ │ ├── string.hpp │ │ ├── chrono.hpp │ │ └── stack.hpp │ │ ├── version.hpp │ │ └── details │ │ ├── polymorphic_impl_fwd.hpp │ │ └── util.hpp │ ├── doc │ ├── CMakeLists.txt │ ├── footer.html │ └── mainpage.dox │ ├── appveyor.yml │ ├── LICENSE │ └── README.md ├── .gitmodules ├── Dockerfile ├── .devcontainer └── devcontainer.json ├── tools ├── profile.sh └── profile.py ├── MANIFEST.in ├── LICENSE └── include └── prtree ├── core └── detail │ └── data_type.h └── utils └── parallel.h /tests/unit/__init__.py: -------------------------------------------------------------------------------- 1 | """Unit tests for python_prtree.""" 2 | -------------------------------------------------------------------------------- /tests/e2e/__init__.py: -------------------------------------------------------------------------------- 1 | """End-to-end tests for python_prtree.""" 2 | -------------------------------------------------------------------------------- /tests/integration/__init__.py: -------------------------------------------------------------------------------- 1 | """Integration tests for python_prtree.""" 2 | -------------------------------------------------------------------------------- /src/python_prtree/py.typed: -------------------------------------------------------------------------------- 1 | # Marker file for PEP 561 2 | # This package supports type hints 3 | -------------------------------------------------------------------------------- /docs/images/2d_fig1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/atksh/python_prtree/HEAD/docs/images/2d_fig1.png -------------------------------------------------------------------------------- /docs/images/2d_fig2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/atksh/python_prtree/HEAD/docs/images/2d_fig2.png -------------------------------------------------------------------------------- /docs/images/2d_fig3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/atksh/python_prtree/HEAD/docs/images/2d_fig3.png -------------------------------------------------------------------------------- /docs/images/3d_fig1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/atksh/python_prtree/HEAD/docs/images/3d_fig1.png -------------------------------------------------------------------------------- /docs/images/3d_fig2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/atksh/python_prtree/HEAD/docs/images/3d_fig2.png -------------------------------------------------------------------------------- /docs/images/3d_fig3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/atksh/python_prtree/HEAD/docs/images/3d_fig3.png -------------------------------------------------------------------------------- /third/cereal/Config.cmake.in: -------------------------------------------------------------------------------- 1 | @PACKAGE_INIT@ 2 | 3 | include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake") 4 | -------------------------------------------------------------------------------- /third/cereal/unittests/run_valgrind.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | 5 | TESTS=./test_* 6 | 7 | for f in $TESTS 8 | do 9 | valgrind --tool=memcheck --leak-check=full $f 10 | done 11 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "pybind11"] 2 | path = third/pybind11 3 | url = https://github.com/pybind/pybind11.git 4 | [submodule "third/snappy"] 5 | path = third/snappy 6 | url = https://github.com/google/snappy 7 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM python:3.10-buster 2 | 3 | ENV PYTHONDONTWRITEBYTECODE 1 4 | ENV PYTHONUNBUFFERED 1 5 | 6 | RUN apt-get update && apt-get install -y git openssh-client vim wget curl google-perftools libgoogle-perftools-dev 7 | WORKDIR /code 8 | -------------------------------------------------------------------------------- /third/cereal/cereal.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@CMAKE_INSTALL_PREFIX@ 2 | includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@ 3 | 4 | Name: @PROJECT_NAME@ 5 | Description: cereal is a header-only C++11 serialization library 6 | URL: https://uscilab.github.io/cereal/ 7 | Version: @PROJECT_VERSION@ 8 | Cflags: -I"${includedir}" 9 | -------------------------------------------------------------------------------- /third/cereal/sandbox/sandbox_shared_lib/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(sandbox_vs_dll SHARED base.cpp derived.cpp) 2 | target_link_libraries(sandbox_vs_dll ${CEREAL_THREAD_LIBS}) 3 | target_include_directories(sandbox_vs_dll PUBLIC 4 | $ 5 | $ 6 | ) 7 | -------------------------------------------------------------------------------- /third/cereal/scripts/renameincludes.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | destdir="include_renamed" 4 | 5 | echo -n "New prefix: " 6 | read newprefix 7 | 8 | cp -r include ${destdir} 9 | 10 | newprefix=$(echo ${newprefix} | sed -e 's/\//\\\//') 11 | 12 | find ${destdir} -name '*.hpp' -exec sed -i "s/#include 7 | ( cereal::XMLOutputArchive & ar, std::uint32_t const version ); 8 | template void Base::serialize 9 | ( cereal::XMLInputArchive & ar, std::uint32_t const version ); 10 | -------------------------------------------------------------------------------- /third/cereal/sandbox/sandbox_shared_lib/derived.cpp: -------------------------------------------------------------------------------- 1 | #ifndef CEREAL_DLL_USE 2 | #define CEREAL_DLL_MAKE 3 | #endif 4 | #include "derived.hpp" 5 | 6 | template void Derived::serialize 7 | ( cereal::XMLOutputArchive & ar, std::uint32_t const version ); 8 | 9 | template void Derived::serialize 10 | ( cereal::XMLInputArchive & ar, std::uint32_t const version ); 11 | -------------------------------------------------------------------------------- /third/cereal/scripts/add_rapidjson_prefix.sh: -------------------------------------------------------------------------------- 1 | # Applies renaming within all of the rapidjson source files to add a cereal prefix 2 | find ./../include/cereal/external/rapidjson/ -type f -name \*.h -exec sed -i "s/RAPIDJSON_/CEREAL_RAPIDJSON_/g" {} \; 3 | echo "Remember to backport any cereal specific changes not in this version of RapidJSON!" 4 | echo "See https://github.com/USCiLab/cereal/commits/develop/include/cereal/external/rapidjson" 5 | -------------------------------------------------------------------------------- /.devcontainer/devcontainer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "python_prtree", 3 | "dockerFile": "../Dockerfile", 4 | "settings": { 5 | "terminal.integrated.shell.linux": "/bin/bash", 6 | "python.pythonPath": "/usr/local/bin/python" 7 | }, 8 | "extensions": [ 9 | "ms-python.python", 10 | "ms-vscode.cpptools", 11 | "mhutchie.git-graph", 12 | "twxs.cmake" 13 | ], 14 | "postCreateCommand": "sh init_develop.sh" 15 | } 16 | -------------------------------------------------------------------------------- /tools/profile.sh: -------------------------------------------------------------------------------- 1 | set -e 2 | 3 | rm -rf build dist .pytest_cache 4 | pip uninstall python_prtree -y || true 5 | DEBUG=1 pip install -v . 6 | python docs/run_profile.py 7 | 8 | so_path=src/python_prtree/PRTree.cpython-310-x86_64-linux-gnu.so 9 | google-pprof --callgrind $so_path build.prof > cg_build.prof 10 | google-pprof --callgrind $so_path find_all.prof > cg_find_all.prof 11 | google-pprof --callgrind $so_path insert.prof > cg_insert.prof -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | include README.md LICENSE CHANGES.md CONTRIBUTING.md DEVELOPMENT.md ARCHITECTURE.md 2 | include pyproject.toml setup.py 3 | global-include CMakeLists.txt *.cmake 4 | 5 | # C++ headers and source 6 | recursive-include include *.h 7 | recursive-include src/cpp *.h *.cc *.cpp 8 | 9 | # Python source 10 | recursive-include src/python_prtree *.py *.typed 11 | 12 | # Third-party dependencies (git submodules) 13 | recursive-include third * 14 | exclude third/.git* 15 | prune third/**/.git 16 | 17 | # Exclude build artifacts and caches 18 | global-exclude *.pyc __pycache__ *.so *.pyd *.dylib 19 | prune build 20 | prune dist 21 | prune .pytest_cache -------------------------------------------------------------------------------- /third/cereal/scripts/updatedoc.in: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Updates the doxygen documentation, and copies it into the appropriate place 4 | # in the gh-pages branch. 5 | 6 | set -e 7 | 8 | tempdir=`mktemp -d` 9 | branch=`git rev-parse --abbrev-ref HEAD` 10 | 11 | cp -r @PROJECT_BINARY_DIR@/doc/html/ ${tempdir} 12 | 13 | git stash 14 | git checkout gh-pages 15 | 16 | rm -rf @PROJECT_SOURCE_DIR@/assets/doxygen 17 | mkdir @PROJECT_SOURCE_DIR@/assets/doxygen 18 | cp -r ${tempdir}/html/* @PROJECT_SOURCE_DIR@/assets/doxygen/ 19 | 20 | rm -rf ${tempdir} 21 | 22 | git commit @PROJECT_SOURCE_DIR@/assets/doxygen 23 | 24 | git checkout ${branch} 25 | git stash apply 26 | -------------------------------------------------------------------------------- /third/cereal/unittests/run_portability_test.cmake: -------------------------------------------------------------------------------- 1 | macro(EXEC_CMD_CHECK) 2 | message("running ${ARGN}") 3 | execute_process(COMMAND ${ARGN} RESULT_VARIABLE CMD_RESULT) 4 | if(CMD_RESULT) 5 | message(FATAL_ERROR "Error running ${ARGN}") 6 | endif() 7 | endmacro() 8 | 9 | set(PORTABILITY_TEST_32 "${PORTABILITY_TEST_DIR}/portability_test32") 10 | set(PORTABILITY_TEST_64 "${PORTABILITY_TEST_DIR}/portability_test64") 11 | 12 | exec_cmd_check(${PORTABILITY_TEST_64} save 64) 13 | exec_cmd_check(${PORTABILITY_TEST_32} load 32) 14 | exec_cmd_check(${PORTABILITY_TEST_32} save 32) 15 | exec_cmd_check(${PORTABILITY_TEST_64} load 64) 16 | exec_cmd_check(${PORTABILITY_TEST_64} remove 64) 17 | -------------------------------------------------------------------------------- /third/cereal/sandbox/sandbox_shared_lib/derived.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "base.hpp" 3 | class Derived : public Base 4 | { 5 | public: 6 | virtual ~Derived() {} 7 | 8 | private: 9 | friend class cereal::access; 10 | template 11 | void serialize(Archive & ar, std::uint32_t const) 12 | { 13 | ar(cereal::base_class(this)); 14 | } 15 | }; 16 | 17 | extern template DECLSPECIFIER void Derived::serialize 18 | ( cereal::XMLOutputArchive & ar, std::uint32_t const version ); 19 | extern template DECLSPECIFIER void Derived::serialize 20 | ( cereal::XMLInputArchive & ar, std::uint32_t const version ); 21 | 22 | CEREAL_REGISTER_TYPE(Derived) 23 | -------------------------------------------------------------------------------- /third/cereal/include/cereal/external/rapidjson/LICENSE: -------------------------------------------------------------------------------- 1 | Tencent is pleased to support the open source community by making RapidJSON available. 2 | 3 | Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip. All rights reserved. 4 | 5 | Licensed under the MIT License (the "License"); you may not use this file except 6 | in compliance with the License. You may obtain a copy of the License at 7 | 8 | http://opensource.org/licenses/MIT 9 | 10 | Unless required by applicable law or agreed to in writing, software distributed 11 | under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 12 | CONDITIONS OF ANY KIND, either express or implied. See the License for the 13 | specific language governing permissions and limitations under the License. 14 | -------------------------------------------------------------------------------- /third/cereal/doc/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | find_package(Doxygen) 2 | if(DOXYGEN_FOUND) 3 | 4 | configure_file("${CMAKE_CURRENT_SOURCE_DIR}/doxygen.in" "${CMAKE_CURRENT_BINARY_DIR}/doxygen.cfg" @ONLY) 5 | add_custom_target(doc 6 | COMMAND ${DOXYGEN_EXECUTABLE} "${CMAKE_CURRENT_BINARY_DIR}/doxygen.cfg" 7 | WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/.." 8 | COMMENT "Generating API documentation with Doxygen" VERBATIM 9 | ) 10 | 11 | configure_file("${CMAKE_CURRENT_SOURCE_DIR}/../scripts/updatedoc.in" "${CMAKE_CURRENT_BINARY_DIR}/updatedoc.sh" @ONLY) 12 | add_custom_target(update-doc 13 | COMMAND "${CMAKE_CURRENT_BINARY_DIR}/updatedoc.sh" 14 | DEPENDS doc 15 | COMMENT "Copying documentation to gh-pages branch" VERBATIM 16 | ) 17 | 18 | endif() 19 | -------------------------------------------------------------------------------- /docs/baseline/system_info.txt: -------------------------------------------------------------------------------- 1 | System Information 2 | ================== 3 | 4 | CPU: 5 | Model name: unknown 6 | Thread(s) per core: 1 7 | Core(s) per socket: 16 8 | Socket(s): 1 9 | 10 | Memory: 11 | total used free shared buff/cache available 12 | Mem: 13Gi 340Mi 12Gi 0B 126Mi 12Gi 13 | Swap: 0B 0B 0B 14 | 15 | Kernel: 16 | Linux runsc 4.4.0 #1 SMP Sun Jan 10 15:06:54 PST 2016 x86_64 x86_64 x86_64 GNU/Linux 17 | 18 | Compiler: 19 | g++ (GCC) 13.3.0 20 | 21 | Build Configuration: 22 | - Build Type: Release with profiling symbols 23 | - Optimization: -O3 24 | - Profiling Flags: -g -fno-omit-frame-pointer 25 | - CXX Standard: C++17 26 | 27 | Date: 2025-11-04 28 | -------------------------------------------------------------------------------- /third/cereal/sandbox/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(sandbox_shared_lib) 2 | 3 | add_executable(sandbox sandbox.cpp) 4 | target_link_libraries(sandbox ${CEREAL_THREAD_LIBS}) 5 | 6 | add_executable(sandbox_json sandbox_json.cpp) 7 | target_link_libraries(sandbox_json ${CEREAL_THREAD_LIBS}) 8 | 9 | add_executable(sandbox_rtti sandbox_rtti.cpp) 10 | target_link_libraries(sandbox_rtti ${CEREAL_THREAD_LIBS}) 11 | 12 | add_executable(sandbox_vs sandbox_vs.cpp) 13 | target_link_libraries(sandbox_vs sandbox_vs_dll) 14 | 15 | if(Boost_FOUND AND NOT SKIP_PERFORMANCE_COMPARISON) 16 | add_executable(performance performance.cpp) 17 | if(MSVC) 18 | set_target_properties(performance PROPERTIES COMPILE_DEFINITIONS "BOOST_SERIALIZATION_DYN_LINK") 19 | endif() 20 | target_include_directories(performance PUBLIC ${Boost_INCLUDE_DIRS}) 21 | target_link_libraries(performance ${CEREAL_THREAD_LIBS} ${Boost_LIBRARIES}) 22 | endif() 23 | -------------------------------------------------------------------------------- /third/cereal/scripts/updatecoverage.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Updates the coverage documentation, and copies it into the appropriate place 4 | # in the gh-pages branch. 5 | # $1 from CMAKE will contain the root directory of cereal 6 | 7 | # this requires lcov 1.10 or newer 8 | 9 | set -e 10 | 11 | COVERAGE_TESTS=./coverage_* 12 | 13 | # run tests 14 | for f in $COVERAGE_TESTS 15 | do 16 | echo $f 17 | $f 18 | done 19 | 20 | # build coverage output 21 | tempdir=`mktemp -d` 22 | 23 | lcov --capture --directory $1 --output-file coverage.info --no-external 24 | lcov --remove coverage.info '*/external/*' '*/cereal/details/util.hpp' 'sandbox/*' '*/unittests/*' -o coverage.info 25 | genhtml --demangle-cpp coverage.info --output-directory ${tempdir} 26 | 27 | # copy over to gh pages 28 | git checkout gh-pages 29 | 30 | rm -rf $1/assets/coverage 31 | mkdir $1/assets/coverage 32 | cp -r ${tempdir}/* $1/assets/coverage/ 33 | rm -rf ${tempdir} 34 | -------------------------------------------------------------------------------- /tools/profile.py: -------------------------------------------------------------------------------- 1 | from python_prtree import PRTree2D 2 | import numpy as np 3 | 4 | def f(N, PRTree, dim): 5 | idx = np.arange(N) 6 | x = np.random.rand(N, 2*dim).astype(np.float32) 7 | print(x.nbytes // 1024 // 1024) # mb 8 | for i in range(dim): 9 | x[:, i+dim] = x[:, i] + x[:, i+dim] / np.sqrt(N) / 100 10 | prtree = PRTree(idx, x) 11 | x = np.random.rand(100_000, 2*dim).astype(np.float32) 12 | for i in range(dim): 13 | x[:, i+dim] = x[:, i] + x[:, i+dim] / np.sqrt(N) / 100 14 | prtree.batch_query(x) 15 | 16 | x = np.random.rand(min(N, 100_000), 2*dim).astype(np.float32) 17 | del_list = [0] 18 | for k in del_list: 19 | prtree.erase(k) 20 | 21 | for i in range(dim): 22 | x[:, i+dim] = x[:, i] + x[:, i+dim] / np.sqrt(N) / 100 23 | for i, k in enumerate(del_list): 24 | prtree.insert(k, x[i]) 25 | 26 | 27 | if __name__ == "__main__": 28 | f(10_000_000, PRTree2D, dim=2) 29 | # f(40, PRTree2D, dim=2) 30 | -------------------------------------------------------------------------------- /third/cereal/include/cereal/external/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (C) 2004-2008 René Nyffenegger 2 | 3 | This source code is provided 'as-is', without any express or implied 4 | warranty. In no event will the author be held liable for any damages 5 | arising from the use of this software. 6 | 7 | Permission is granted to anyone to use this software for any purpose, 8 | including commercial applications, and to alter it and redistribute it 9 | freely, subject to the following restrictions: 10 | 11 | 1. The origin of this source code must not be misrepresented; you must not 12 | claim that you wrote the original source code. If you use this source code 13 | in a product, an acknowledgment in the product documentation would be 14 | appreciated but is not required. 15 | 16 | 2. Altered source versions must be plainly marked as such, and must not be 17 | misrepresented as being the original source code. 18 | 19 | 3. This notice may not be removed or altered from any source distribution. 20 | 21 | René Nyffenegger rene.nyffenegger@adp-gmbh.ch 22 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 atksh 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /third/cereal/sandbox/sandbox_shared_lib/base.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #if defined (_WINDLL) 9 | #define DECLSPECIFIER __declspec(dllexport) 10 | #elif defined(MSC_VER) 11 | #define DECLSPECIFIER __declspec(dllimport) 12 | #else 13 | #define DECLSPECIFIER 14 | #endif 15 | 16 | int doit(); 17 | 18 | class VersionTest 19 | { 20 | public: 21 | int x; 22 | template 23 | void serialize( Archive & ar, const std::uint32_t /* version */ ) 24 | { ar( x ); } 25 | }; 26 | 27 | class Base 28 | { 29 | public: 30 | friend class cereal::access; 31 | 32 | template < class Archive > 33 | void serialize(Archive &, std::uint32_t const) {} 34 | virtual ~Base() {} 35 | }; 36 | 37 | extern template DECLSPECIFIER void Base::serialize 38 | ( cereal::XMLInputArchive & ar, std::uint32_t const version ); 39 | 40 | extern template DECLSPECIFIER void Base::serialize 41 | ( cereal::XMLOutputArchive & ar, std::uint32_t const version ); 42 | 43 | CEREAL_CLASS_VERSION(VersionTest, 1) 44 | -------------------------------------------------------------------------------- /src/python_prtree/__init__.py: -------------------------------------------------------------------------------- 1 | """ 2 | python_prtree - Fast spatial indexing with Priority R-Tree 3 | 4 | This package provides efficient 2D, 3D, and 4D spatial indexing using 5 | the Priority R-Tree data structure with C++ performance. 6 | 7 | Main classes: 8 | - PRTree2D: 2D spatial indexing 9 | - PRTree3D: 3D spatial indexing 10 | - PRTree4D: 4D spatial indexing 11 | 12 | Example: 13 | >>> from python_prtree import PRTree2D 14 | >>> import numpy as np 15 | >>> 16 | >>> # Create tree with bounding boxes 17 | >>> indices = np.array([1, 2, 3]) 18 | >>> boxes = np.array([ 19 | ... [0.0, 0.0, 1.0, 1.0], 20 | ... [1.0, 1.0, 2.0, 2.0], 21 | ... [2.0, 2.0, 3.0, 3.0], 22 | ... ]) 23 | >>> tree = PRTree2D(indices, boxes) 24 | >>> 25 | >>> # Query overlapping boxes 26 | >>> results = tree.query([0.5, 0.5, 1.5, 1.5]) 27 | >>> print(results) # [1, 2] 28 | 29 | For more information, see the documentation at: 30 | https://github.com/atksh/python_prtree 31 | """ 32 | 33 | from .core import PRTree2D, PRTree3D, PRTree4D 34 | 35 | __version__ = "0.7.1" 36 | 37 | __all__ = [ 38 | "PRTree2D", 39 | "PRTree3D", 40 | "PRTree4D", 41 | ] 42 | -------------------------------------------------------------------------------- /third/cereal/doc/footer.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 12 | 13 | 14 | 19 | 20 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /include/prtree/core/detail/data_type.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file data_type.h 3 | * @brief Data storage structures for PRTree 4 | * 5 | * Contains DataType class for storing index-bounding box pairs 6 | * and related utility functions. 7 | */ 8 | #pragma once 9 | 10 | #include 11 | 12 | #include "prtree/core/detail/bounding_box.h" 13 | #include "prtree/core/detail/types.h" 14 | 15 | // Phase 8: Apply C++20 concept constraints 16 | template class DataType { 17 | public: 18 | BB second; 19 | T first; 20 | 21 | DataType() noexcept = default; 22 | 23 | DataType(const T &f, const BB &s) { 24 | first = f; 25 | second = s; 26 | } 27 | 28 | DataType(T &&f, BB &&s) noexcept { 29 | first = std::move(f); 30 | second = std::move(s); 31 | } 32 | 33 | void swap(DataType& other) noexcept { 34 | using std::swap; 35 | swap(first, other.first); 36 | swap(second, other.second); 37 | } 38 | 39 | template void serialize(Archive &ar) { ar(first, second); } 40 | }; 41 | 42 | template 43 | void clean_data(DataType *b, DataType *e) { 44 | for (DataType *it = e - 1; it >= b; --it) { 45 | it->~DataType(); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /tests/_ci_debug_import.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | """Debug script to diagnose import issues in CI environments.""" 3 | import sys 4 | import pathlib 5 | import importlib.util 6 | import traceback 7 | 8 | print("=" * 60) 9 | print("CI Debug Import Check") 10 | print("=" * 60) 11 | print(f"sys.version: {sys.version}") 12 | print(f"sys.platform: {sys.platform}") 13 | print(f"sys.executable: {sys.executable}") 14 | print() 15 | 16 | try: 17 | import python_prtree 18 | print(f"[OK] python_prtree imported successfully") 19 | print(f" Location: {python_prtree.__file__}") 20 | 21 | pkg_dir = pathlib.Path(python_prtree.__file__).parent 22 | print(f" Package directory: {pkg_dir}") 23 | print(f" Contents: {sorted(x.name for x in pkg_dir.iterdir())}") 24 | print() 25 | 26 | spec = importlib.util.find_spec("python_prtree.PRTree") 27 | print(f" find_spec('python_prtree.PRTree'): {spec}") 28 | print() 29 | 30 | from python_prtree import PRTree3D 31 | print(f"[OK] PRTree3D imported successfully") 32 | print(f" PRTree3D: {PRTree3D}") 33 | print() 34 | 35 | print("=" * 60) 36 | print("All imports successful!") 37 | print("=" * 60) 38 | sys.exit(0) 39 | 40 | except Exception as e: 41 | print(f"[FAIL] IMPORT FAILED: {repr(e)}") 42 | print() 43 | traceback.print_exc() 44 | print() 45 | print("=" * 60) 46 | print("Import check failed - see traceback above") 47 | print("=" * 60) 48 | sys.exit(1) 49 | -------------------------------------------------------------------------------- /third/cereal/appveyor.yml: -------------------------------------------------------------------------------- 1 | # can use variables like {build} and {branch} 2 | version: 1.3.{build} 3 | pull_requests: 4 | do_not_increment_build_number: true 5 | 6 | branches: 7 | only: 8 | - master 9 | 10 | configuration: 11 | - Debug 12 | - Release 13 | 14 | environment: 15 | matrix: 16 | - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013 17 | VS_VERSION_MAJOR: 12 18 | BOOST_ROOT: C:\Libraries\boost_1_58_0 19 | - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 20 | VS_VERSION_MAJOR: 14 21 | BOOST_ROOT: C:\Libraries\boost_1_60_0 22 | - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 23 | VS_VERSION_MAJOR: 15 24 | BOOST_ROOT: C:\Libraries\boost_1_66_0 25 | - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 26 | VS_VERSION_MAJOR: 16 27 | BOOST_ROOT: C:\Libraries\boost_1_73_0 28 | - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022 29 | VS_VERSION_MAJOR: 17 30 | BOOST_ROOT: C:\Libraries\boost_1_73_0 31 | 32 | matrix: 33 | exclude: 34 | - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 35 | platform: Win32 36 | 37 | - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022 38 | platform: Win32 39 | 40 | platform: 41 | - Win32 42 | - x64 43 | 44 | before_build: "scripts\\appveyor.bat" 45 | 46 | build: 47 | parallel: true 48 | project: build/cereal.sln 49 | verbosity: minimal 50 | 51 | test_script: "scripts\\appveyor.bat test" 52 | 53 | artifacts: 54 | - path: build\Testing 55 | - path: out 56 | -------------------------------------------------------------------------------- /third/cereal/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013-2022, Randolph Voorhies, Shane Grant 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | * Redistributions of source code must retain the above copyright 7 | notice, this list of conditions and the following disclaimer. 8 | * Redistributions in binary form must reproduce the above copyright 9 | notice, this list of conditions and the following disclaimer in the 10 | documentation and/or other materials provided with the distribution. 11 | * Neither the name of the copyright holder nor the 12 | names of its contributors may be used to endorse or promote products 13 | derived from this software without specific prior written permission. 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 16 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY 19 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | -------------------------------------------------------------------------------- /third/cereal/include/cereal/external/rapidjson/internal/swap.h: -------------------------------------------------------------------------------- 1 | // Tencent is pleased to support the open source community by making RapidJSON available. 2 | // 3 | // Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip. All rights reserved. 4 | // 5 | // Licensed under the MIT License (the "License"); you may not use this file except 6 | // in compliance with the License. You may obtain a copy of the License at 7 | // 8 | // http://opensource.org/licenses/MIT 9 | // 10 | // Unless required by applicable law or agreed to in writing, software distributed 11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the 13 | // specific language governing permissions and limitations under the License. 14 | 15 | #ifndef CEREAL_RAPIDJSON_INTERNAL_SWAP_H_ 16 | #define CEREAL_RAPIDJSON_INTERNAL_SWAP_H_ 17 | 18 | #include "../rapidjson.h" 19 | 20 | #if defined(__clang__) 21 | CEREAL_RAPIDJSON_DIAG_PUSH 22 | CEREAL_RAPIDJSON_DIAG_OFF(c++98-compat) 23 | #endif 24 | 25 | CEREAL_RAPIDJSON_NAMESPACE_BEGIN 26 | namespace internal { 27 | 28 | //! Custom swap() to avoid dependency on C++ header 29 | /*! \tparam T Type of the arguments to swap, should be instantiated with primitive C++ types only. 30 | \note This has the same semantics as std::swap(). 31 | */ 32 | template 33 | inline void Swap(T& a, T& b) CEREAL_RAPIDJSON_NOEXCEPT { 34 | T tmp = a; 35 | a = b; 36 | b = tmp; 37 | } 38 | 39 | } // namespace internal 40 | CEREAL_RAPIDJSON_NAMESPACE_END 41 | 42 | #if defined(__clang__) 43 | CEREAL_RAPIDJSON_DIAG_POP 44 | #endif 45 | 46 | #endif // CEREAL_RAPIDJSON_INTERNAL_SWAP_H_ 47 | -------------------------------------------------------------------------------- /third/cereal/include/cereal/external/rapidjson/msinttypes/LICENSE: -------------------------------------------------------------------------------- 1 | ISO C9x compliant stdint.h for Microsoft Visual Studio 2 | Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124 3 | 4 | Copyright (c) 2006-2013 Alexander Chemeris 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | 9 | 1. Redistributions of source code must retain the above copyright notice, 10 | this list of conditions and the following disclaimer. 11 | 12 | 2. Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in the 14 | documentation and/or other materials provided with the distribution. 15 | 16 | 3. Neither the name of the product nor the names of its contributors may 17 | be used to endorse or promote products derived from this software 18 | without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 21 | WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 22 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO 23 | EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 25 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 26 | OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 27 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 28 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 29 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | -------------------------------------------------------------------------------- /third/cereal/unittests/cpp17/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB TESTS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp) 2 | 3 | # Build all of the non-special tests 4 | foreach(TEST_SOURCE ${TESTS}) 5 | message(STATUS ${TEST_SOURCE}) 6 | 7 | string(REPLACE ".cpp" "" TEST_TARGET "${TEST_SOURCE}") 8 | set(TEST_TARGET "test_cpp17_${TEST_TARGET}") 9 | 10 | add_executable(${TEST_TARGET} ${TEST_SOURCE}) 11 | target_link_libraries(${TEST_TARGET} ${CEREAL_THREAD_LIBS}) 12 | add_test(NAME "${TEST_TARGET}" COMMAND "${TEST_TARGET}") 13 | 14 | # If we are on a 64-bit machine, create an extra 32-bit version of the test if portability testing is enabled 15 | if((NOT MSVC) AND (${CMAKE_SIZEOF_VOID_P} EQUAL 8) AND (NOT SKIP_PORTABILITY_TEST)) 16 | add_executable(${TEST_TARGET}_32 ${TEST_SOURCE}) 17 | target_link_libraries(${TEST_TARGET}_32 ${CEREAL_THREAD_LIBS}) 18 | set_target_properties(${TEST_TARGET}_32 PROPERTIES 19 | COMPILE_FLAGS "-m32" LINK_FLAGS "-m32") 20 | add_test(NAME "${TEST_TARGET}_32" COMMAND "${TEST_TARGET}_32") 21 | endif() 22 | 23 | endforeach() 24 | 25 | if(NOT MSVC) 26 | # add tests to coverage 27 | foreach(TEST_SOURCE ${TESTS}) 28 | string(REPLACE ".cpp" "" COVERAGE_TARGET "${TEST_SOURCE}") 29 | set(COVERAGE_TARGET "coverage_cpp17_${COVERAGE_TARGET}") 30 | 31 | add_dependencies(coverage ${COVERAGE_TARGET}) 32 | 33 | add_executable(${COVERAGE_TARGET} EXCLUDE_FROM_ALL ${TEST_SOURCE}) 34 | set_target_properties(${COVERAGE_TARGET} PROPERTIES COMPILE_FLAGS "-coverage") 35 | set_target_properties(${COVERAGE_TARGET} PROPERTIES LINK_FLAGS "-coverage") 36 | set_target_properties(${COVERAGE_TARGET} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/coverage") 37 | target_link_libraries(${COVERAGE_TARGET} ${CEREAL_THREAD_LIBS}) 38 | endforeach() 39 | endif() 40 | -------------------------------------------------------------------------------- /tests/conftest.py: -------------------------------------------------------------------------------- 1 | """Shared pytest fixtures and configuration for all tests.""" 2 | import numpy as np 3 | import pytest 4 | 5 | 6 | @pytest.fixture(params=[(2, "PRTree2D"), (3, "PRTree3D"), (4, "PRTree4D")]) 7 | def dimension_and_class(request): 8 | """Parametrize tests across all dimensions and tree classes.""" 9 | from python_prtree import PRTree2D, PRTree3D, PRTree4D 10 | 11 | dim, class_name = request.param 12 | tree_classes = { 13 | "PRTree2D": PRTree2D, 14 | "PRTree3D": PRTree3D, 15 | "PRTree4D": PRTree4D, 16 | } 17 | return dim, tree_classes[class_name] 18 | 19 | 20 | @pytest.fixture 21 | def sample_boxes_2d(): 22 | """Generate sample 2D bounding boxes for testing.""" 23 | np.random.seed(42) 24 | n = 100 25 | idx = np.arange(n) 26 | boxes = np.random.rand(n, 4) * 100 27 | boxes[:, 2] += boxes[:, 0] + 1 # xmax > xmin 28 | boxes[:, 3] += boxes[:, 1] + 1 # ymax > ymin 29 | return idx, boxes 30 | 31 | 32 | @pytest.fixture 33 | def sample_boxes_3d(): 34 | """Generate sample 3D bounding boxes for testing.""" 35 | np.random.seed(42) 36 | n = 100 37 | idx = np.arange(n) 38 | boxes = np.random.rand(n, 6) * 100 39 | for i in range(3): 40 | boxes[:, i + 3] += boxes[:, i] + 1 41 | return idx, boxes 42 | 43 | 44 | @pytest.fixture 45 | def sample_boxes_4d(): 46 | """Generate sample 4D bounding boxes for testing.""" 47 | np.random.seed(42) 48 | n = 100 49 | idx = np.arange(n) 50 | boxes = np.random.rand(n, 8) * 100 51 | for i in range(4): 52 | boxes[:, i + 4] += boxes[:, i] + 1 53 | return idx, boxes 54 | 55 | 56 | def has_intersect(x, y, dim): 57 | """Helper function to check if two boxes intersect.""" 58 | return all([max(x[i], y[i]) <= min(x[i + dim], y[i + dim]) for i in range(dim)]) 59 | -------------------------------------------------------------------------------- /third/cereal/unittests/boost/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB TESTS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp) 2 | 3 | include_directories(SYSTEM ${Boost_INCLUDE_DIRS}) 4 | 5 | # Build all of the non-special tests 6 | foreach(TEST_SOURCE ${TESTS}) 7 | message(STATUS ${TEST_SOURCE}) 8 | 9 | string(REPLACE ".cpp" "" TEST_TARGET "${TEST_SOURCE}") 10 | set(TEST_TARGET "test_${TEST_TARGET}") 11 | 12 | add_executable(${TEST_TARGET} ${TEST_SOURCE}) 13 | target_link_libraries(${TEST_TARGET} ${CEREAL_THREAD_LIBS}) 14 | add_test(NAME "${TEST_TARGET}" COMMAND "${TEST_TARGET}") 15 | 16 | # If we are on a 64-bit machine, create an extra 32-bit version of the test if portability testing is enabled 17 | if((NOT MSVC) AND (${CMAKE_SIZEOF_VOID_P} EQUAL 8) AND (NOT SKIP_PORTABILITY_TEST)) 18 | add_executable(${TEST_TARGET}_32 ${TEST_SOURCE}) 19 | target_link_libraries(${TEST_TARGET}_32 ${CEREAL_THREAD_LIBS}) 20 | set_target_properties(${TEST_TARGET}_32 PROPERTIES 21 | COMPILE_FLAGS "-m32" LINK_FLAGS "-m32") 22 | add_test(NAME "${TEST_TARGET}_32" COMMAND "${TEST_TARGET}_32") 23 | endif() 24 | 25 | endforeach() 26 | 27 | if(NOT MSVC) 28 | # add tests to coverage 29 | foreach(TEST_SOURCE ${TESTS}) 30 | string(REPLACE ".cpp" "" COVERAGE_TARGET "${TEST_SOURCE}") 31 | set(COVERAGE_TARGET "coverage_${COVERAGE_TARGET}") 32 | 33 | add_dependencies(coverage ${COVERAGE_TARGET}) 34 | 35 | add_executable(${COVERAGE_TARGET} EXCLUDE_FROM_ALL ${TEST_SOURCE}) 36 | set_target_properties(${COVERAGE_TARGET} PROPERTIES COMPILE_FLAGS "-coverage") 37 | set_target_properties(${COVERAGE_TARGET} PROPERTIES LINK_FLAGS "-coverage") 38 | set_target_properties(${COVERAGE_TARGET} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/coverage") 39 | target_link_libraries(${COVERAGE_TARGET} ${CEREAL_THREAD_LIBS}) 40 | endforeach() 41 | endif() 42 | -------------------------------------------------------------------------------- /third/cereal/include/cereal/types/map.hpp: -------------------------------------------------------------------------------- 1 | /*! \file map.hpp 2 | \brief Support for types found in \ 3 | \ingroup STLSupport */ 4 | /* 5 | Copyright (c) 2014, Randolph Voorhies, Shane Grant 6 | All rights reserved. 7 | 8 | Redistribution and use in source and binary forms, with or without 9 | modification, are permitted provided that the following conditions are met: 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in the 14 | documentation and/or other materials provided with the distribution. 15 | * Neither the name of the copyright holder nor the 16 | names of its contributors may be used to endorse or promote products 17 | derived from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 20 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 21 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY 23 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 26 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | #ifndef CEREAL_TYPES_MAP_HPP_ 31 | #define CEREAL_TYPES_MAP_HPP_ 32 | 33 | #include "cereal/types/concepts/pair_associative_container.hpp" 34 | #include 35 | 36 | #endif // CEREAL_TYPES_MAP_HPP_ 37 | -------------------------------------------------------------------------------- /third/cereal/include/cereal/types/unordered_map.hpp: -------------------------------------------------------------------------------- 1 | /*! \file unordered_map.hpp 2 | \brief Support for types found in \ 3 | \ingroup STLSupport */ 4 | /* 5 | Copyright (c) 2014, Randolph Voorhies, Shane Grant 6 | All rights reserved. 7 | 8 | Redistribution and use in source and binary forms, with or without 9 | modification, are permitted provided that the following conditions are met: 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in the 14 | documentation and/or other materials provided with the distribution. 15 | * Neither the name of the copyright holder nor the 16 | names of its contributors may be used to endorse or promote products 17 | derived from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 20 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 21 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY 23 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 26 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | #ifndef CEREAL_TYPES_UNORDERED_MAP_HPP_ 31 | #define CEREAL_TYPES_UNORDERED_MAP_HPP_ 32 | 33 | #include "cereal/types/concepts/pair_associative_container.hpp" 34 | #include 35 | 36 | #endif // CEREAL_TYPES_UNORDERED_MAP_HPP_ 37 | -------------------------------------------------------------------------------- /third/cereal/unittests/unordered_loads.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014, Randolph Voorhies, Shane Grant 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in the 11 | documentation and/or other materials provided with the distribution. 12 | * Neither the name of the copyright holder nor the 13 | names of its contributors may be used to endorse or promote products 14 | derived from this software without specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY 20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | #define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN 28 | #include "unordered_loads.hpp" 29 | 30 | TEST_SUITE_BEGIN("unordered_loads"); 31 | 32 | TEST_CASE("xml_unordered_loads") 33 | { 34 | test_unordered_loads(); 35 | } 36 | 37 | TEST_CASE("json_unordered_loads") 38 | { 39 | test_unordered_loads(); 40 | } 41 | 42 | TEST_SUITE_END(); 43 | -------------------------------------------------------------------------------- /third/cereal/include/cereal/types/functional.hpp: -------------------------------------------------------------------------------- 1 | /*! \file functional.hpp 2 | \brief Support for types found in \ 3 | \ingroup STLSupport */ 4 | /* 5 | Copyright (c) 2016, Randolph Voorhies, Shane Grant 6 | All rights reserved. 7 | 8 | Redistribution and use in source and binary forms, with or without 9 | modification, are permitted provided that the following conditions are met: 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in the 14 | documentation and/or other materials provided with the distribution. 15 | * Neither the name of the copyright holder nor the 16 | names of its contributors may be used to endorse or promote products 17 | derived from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 20 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 21 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY 23 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 26 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | #ifndef CEREAL_TYPES_FUNCTIONAL_HPP_ 31 | #define CEREAL_TYPES_FUNCTIONAL_HPP_ 32 | 33 | #include 34 | 35 | namespace cereal 36 | { 37 | //! Saving for std::less 38 | template inline 39 | void serialize( Archive &, std::less & ) 40 | { } 41 | } // namespace cereal 42 | 43 | #endif // CEREAL_TYPES_FUNCTIONAL_HPP_ 44 | -------------------------------------------------------------------------------- /third/cereal/doc/mainpage.dox: -------------------------------------------------------------------------------- 1 | /** 2 | \mainpage cereal code documentation 3 | 4 | \tableofcontents 5 | 6 | Aside from the documentation presented on the main cereal site, this doxygen 7 | page offers code level documentation. 8 | 9 | \section modules Browse modules 10 | 11 | cereal's code is organized into modules of similar functionality. Take a look at the modules 12 | section to learn more. Average users will not need to understand the workings of any code that falls under the 13 | internal module. 14 | 15 | \section files Browse files 16 | 17 | If you need reference on a specific file, the files page lists all files in cereal. 18 | */ 19 | 20 | //! \defgroup Archives Input and Output Archive Types 21 | 22 | /*! \defgroup Access Access Control and Disambiguation 23 | Provides ways to give cereal access to protected member functions, disambiguate 24 | which serialization function cereal should use, and provide ways of using smart 25 | pointers with types that have no default constructor. */ 26 | 27 | /*! \defgroup Utility Utility Functionality 28 | Name-value pairs, binary data wrappers, exceptions, and other utility functions */ 29 | 30 | /*! \defgroup TypeSupport Support for Serializing Various Types 31 | Serialization of many types is shipped with cereal, including most of the standard library as well as a few others. */ 32 | 33 | /*! \defgroup STLSupport Standard Library Support 34 | Serialization methods for nearly all types found in the C++ standard library. 35 | \ingroup TypeSupport */ 36 | 37 | /*! \defgroup TypeConcepts Abstract Type Concept Support 38 | Serialization methods for more abstract type concepts that can generalize over many types. 39 | \ingroup TypeSupport */ 40 | 41 | /*! \defgroup OtherTypes Miscellaneous Types Support 42 | Support for various other types such as smart pointers to polymorphic base classes, boost::variant, etc. 43 | \ingroup TypeSupport */ 44 | 45 | /*! \defgroup Internal Internal Functionality 46 | Various classes and functions that are critical for the operation of cereal but of no 47 | interest to users */ 48 | -------------------------------------------------------------------------------- /third/cereal/unittests/valarray.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014, Randolph Voorhies, Shane Grant 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in the 11 | documentation and/or other materials provided with the distribution. 12 | * Neither the name of cereal nor the 13 | names of its contributors may be used to endorse or promote products 14 | derived from this software without specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL RANDOLPH VOORHIES AND SHANE GRANT BE LIABLE FOR ANY 20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | #define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN 28 | #include "valarray.hpp" 29 | 30 | TEST_SUITE_BEGIN("valarray"); 31 | 32 | TEST_CASE("binary_valarray") 33 | { 34 | test_valarray(); 35 | } 36 | 37 | TEST_CASE("portable_binary_valarray") 38 | { 39 | test_valarray(); 40 | } 41 | 42 | TEST_CASE("xml_valarray") 43 | { 44 | test_valarray(); 45 | } 46 | 47 | TEST_CASE("json_valarray") 48 | { 49 | test_valarray(); 50 | } 51 | 52 | TEST_SUITE_END(); 53 | -------------------------------------------------------------------------------- /third/cereal/unittests/set.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014, Randolph Voorhies, Shane Grant 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in the 11 | documentation and/or other materials provided with the distribution. 12 | * Neither the name of the copyright holder nor the 13 | names of its contributors may be used to endorse or promote products 14 | derived from this software without specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY 20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | #define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN 28 | #include "set.hpp" 29 | 30 | TEST_SUITE_BEGIN("set"); 31 | 32 | TEST_CASE("binary_set") 33 | { 34 | test_set(); 35 | } 36 | 37 | TEST_CASE("portable_binary_set") 38 | { 39 | test_set(); 40 | } 41 | 42 | TEST_CASE("xml_set") 43 | { 44 | test_set(); 45 | } 46 | 47 | TEST_CASE("json_set") 48 | { 49 | test_set(); 50 | } 51 | 52 | TEST_SUITE_END(); 53 | -------------------------------------------------------------------------------- /tests/_ci_test_runner.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | """ 3 | CI test runner that adapts test execution based on platform. 4 | 5 | For emulated platforms (aarch64, musllinux), skip heavy concurrency/stress tests 6 | that can hang or take excessive time under QEMU emulation. 7 | 8 | For native platforms (x86_64, win_amd64, macosx), run full test suite. 9 | """ 10 | import os 11 | import sys 12 | import subprocess 13 | import platform 14 | 15 | def get_platform_info(): 16 | """Determine if we're running on an emulated platform.""" 17 | platform_id = os.environ.get('CIBW_PLATFORM_ID', '') 18 | 19 | is_emulated = ( 20 | 'aarch64' in platform_id or 21 | 'musllinux' in platform_id or 22 | platform.machine() == 'aarch64' 23 | ) 24 | 25 | return platform_id, is_emulated 26 | 27 | def main(): 28 | """Run tests appropriate for the current platform.""" 29 | platform_id, is_emulated = get_platform_info() 30 | 31 | print(f"Platform ID: {platform_id}") 32 | print(f"Machine: {platform.machine()}") 33 | print(f"Is emulated/slow platform: {is_emulated}") 34 | 35 | import_test = os.path.join(os.path.dirname(__file__), '_ci_debug_import.py') 36 | print(f"\n=== Running import test: {import_test} ===") 37 | result = subprocess.run([sys.executable, import_test]) 38 | if result.returncode != 0: 39 | print("Import test failed!") 40 | return result.returncode 41 | 42 | test_dir = os.path.dirname(__file__) 43 | 44 | if is_emulated: 45 | print("\n=== Running lightweight test suite (emulated platform) ===") 46 | ignore_args = [ 47 | '--ignore=tests/unit/test_concurrency.py', 48 | '--ignore=tests/unit/test_memory_safety.py', 49 | '--ignore=tests/unit/test_comprehensive_safety.py', 50 | '--ignore=tests/unit/test_segfault_safety.py', 51 | ] 52 | cmd = [sys.executable, '-m', 'pytest', test_dir, '-vv'] + ignore_args 53 | else: 54 | print("\n=== Running full test suite (native platform) ===") 55 | cmd = [sys.executable, '-m', 'pytest', test_dir, '-vv'] 56 | 57 | print(f"Command: {' '.join(cmd)}") 58 | result = subprocess.run(cmd) 59 | 60 | return result.returncode 61 | 62 | if __name__ == '__main__': 63 | sys.exit(main()) 64 | -------------------------------------------------------------------------------- /third/cereal/unittests/pair.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014, Randolph Voorhies, Shane Grant 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in the 11 | documentation and/or other materials provided with the distribution. 12 | * Neither the name of the copyright holder nor the 13 | names of its contributors may be used to endorse or promote products 14 | derived from this software without specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY 20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | #define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN 28 | #include "pair.hpp" 29 | 30 | TEST_SUITE_BEGIN("pair"); 31 | 32 | TEST_CASE("binary_pair") 33 | { 34 | test_pair(); 35 | } 36 | 37 | TEST_CASE("portable_binary_pair") 38 | { 39 | test_pair(); 40 | } 41 | 42 | TEST_CASE("xml_pair") 43 | { 44 | test_pair(); 45 | } 46 | TEST_CASE("json_pair") 47 | { 48 | test_pair(); 49 | } 50 | 51 | TEST_SUITE_END(); 52 | -------------------------------------------------------------------------------- /third/cereal/unittests/list.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014, Randolph Voorhies, Shane Grant 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in the 11 | documentation and/or other materials provided with the distribution. 12 | * Neither the name of the copyright holder nor the 13 | names of its contributors may be used to endorse or promote products 14 | derived from this software without specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY 20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | #define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN 28 | #include "list.hpp" 29 | 30 | TEST_SUITE_BEGIN("list"); 31 | 32 | TEST_CASE("binary_list") 33 | { 34 | test_list(); 35 | } 36 | 37 | TEST_CASE("portable_binary_list") 38 | { 39 | test_list(); 40 | } 41 | 42 | TEST_CASE("xml_list") 43 | { 44 | test_list(); 45 | } 46 | 47 | TEST_CASE("json_list") 48 | { 49 | test_list(); 50 | } 51 | 52 | TEST_SUITE_END(); 53 | -------------------------------------------------------------------------------- /third/cereal/unittests/defer.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014, Randolph Voorhies, Shane Grant 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in the 11 | documentation and/or other materials provided with the distribution. 12 | * Neither the name of the copyright holder nor the 13 | names of its contributors may be used to endorse or promote products 14 | derived from this software without specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY 20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | #define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN 28 | #include "defer.hpp" 29 | 30 | TEST_SUITE_BEGIN("defer"); 31 | 32 | TEST_CASE("binary_defer") 33 | { 34 | test_defer(); 35 | } 36 | 37 | TEST_CASE("portable_binary_defer") 38 | { 39 | test_defer(); 40 | } 41 | 42 | TEST_CASE("xml_defer") 43 | { 44 | test_defer(); 45 | } 46 | 47 | TEST_CASE("json_defer") 48 | { 49 | test_defer(); 50 | } 51 | 52 | TEST_SUITE_END(); 53 | -------------------------------------------------------------------------------- /third/cereal/unittests/queue.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014, Randolph Voorhies, Shane Grant 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in the 11 | documentation and/or other materials provided with the distribution. 12 | * Neither the name of the copyright holder nor the 13 | names of its contributors may be used to endorse or promote products 14 | derived from this software without specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY 20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | #define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN 28 | #include "queue.hpp" 29 | 30 | TEST_SUITE_BEGIN("queue"); 31 | 32 | TEST_CASE("binary_queue") 33 | { 34 | test_queue(); 35 | } 36 | 37 | TEST_CASE("portable_binary_queue") 38 | { 39 | test_queue(); 40 | } 41 | 42 | TEST_CASE("xml_queue") 43 | { 44 | test_queue(); 45 | } 46 | 47 | TEST_CASE("json_queue") 48 | { 49 | test_queue(); 50 | } 51 | 52 | TEST_SUITE_END(); 53 | -------------------------------------------------------------------------------- /third/cereal/unittests/stack.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014, Randolph Voorhies, Shane Grant 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in the 11 | documentation and/or other materials provided with the distribution. 12 | * Neither the name of the copyright holder nor the 13 | names of its contributors may be used to endorse or promote products 14 | derived from this software without specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY 20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | #define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN 28 | #include "stack.hpp" 29 | 30 | TEST_SUITE_BEGIN("stack"); 31 | 32 | TEST_CASE("binary_stack") 33 | { 34 | test_stack(); 35 | } 36 | 37 | TEST_CASE("portable_binary_stack") 38 | { 39 | test_stack(); 40 | } 41 | 42 | TEST_CASE("xml_stack") 43 | { 44 | test_stack(); 45 | } 46 | 47 | TEST_CASE("json_stack") 48 | { 49 | test_stack(); 50 | } 51 | 52 | TEST_SUITE_END(); 53 | -------------------------------------------------------------------------------- /third/cereal/unittests/tuple.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014, Randolph Voorhies, Shane Grant 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in the 11 | documentation and/or other materials provided with the distribution. 12 | * Neither the name of the copyright holder nor the 13 | names of its contributors may be used to endorse or promote products 14 | derived from this software without specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY 20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | #define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN 28 | #include "tuple.hpp" 29 | 30 | TEST_SUITE_BEGIN("tuple"); 31 | 32 | TEST_CASE("binary_tuple") 33 | { 34 | test_tuple(); 35 | } 36 | 37 | TEST_CASE("portable_binary_tuple") 38 | { 39 | test_tuple(); 40 | } 41 | 42 | TEST_CASE("xml_tuple") 43 | { 44 | test_tuple(); 45 | } 46 | 47 | TEST_CASE("json_tuple") 48 | { 49 | test_tuple(); 50 | } 51 | 52 | TEST_SUITE_END(); 53 | -------------------------------------------------------------------------------- /third/cereal/include/cereal/types/utility.hpp: -------------------------------------------------------------------------------- 1 | /*! \file utility.hpp 2 | \brief Support for types found in \ 3 | \ingroup STLSupport */ 4 | /* 5 | Copyright (c) 2014, Randolph Voorhies, Shane Grant 6 | All rights reserved. 7 | 8 | Redistribution and use in source and binary forms, with or without 9 | modification, are permitted provided that the following conditions are met: 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in the 14 | documentation and/or other materials provided with the distribution. 15 | * Neither the name of the copyright holder nor the 16 | names of its contributors may be used to endorse or promote products 17 | derived from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 20 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 21 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY 23 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 26 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | #ifndef CEREAL_TYPES_UTILITY_HPP_ 31 | #define CEREAL_TYPES_UTILITY_HPP_ 32 | 33 | #include "cereal/cereal.hpp" 34 | #include 35 | 36 | namespace cereal 37 | { 38 | //! Serializing for std::pair 39 | template inline 40 | void CEREAL_SERIALIZE_FUNCTION_NAME( Archive & ar, std::pair & pair ) 41 | { 42 | ar( CEREAL_NVP_("first", pair.first), 43 | CEREAL_NVP_("second", pair.second) ); 44 | } 45 | } // namespace cereal 46 | 47 | #endif // CEREAL_TYPES_UTILITY_HPP_ 48 | -------------------------------------------------------------------------------- /third/cereal/unittests/atomic.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014, Randolph Voorhies, Shane Grant 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in the 11 | documentation and/or other materials provided with the distribution. 12 | * Neither the name of the copyright holder nor the 13 | names of its contributors may be used to endorse or promote products 14 | derived from this software without specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY 20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | #define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN 28 | #include "atomic.hpp" 29 | 30 | TEST_SUITE_BEGIN("atomic"); 31 | 32 | TEST_CASE("binary_atomic") 33 | { 34 | test_atomic(); 35 | } 36 | 37 | TEST_CASE("portable_binary_atomic") 38 | { 39 | test_atomic(); 40 | } 41 | 42 | TEST_CASE("xml_atomic") 43 | { 44 | test_atomic(); 45 | } 46 | 47 | TEST_CASE("json_atomic") 48 | { 49 | test_atomic(); 50 | } 51 | 52 | TEST_SUITE_END(); 53 | -------------------------------------------------------------------------------- /third/cereal/unittests/bitset.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014, Randolph Voorhies, Shane Grant 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in the 11 | documentation and/or other materials provided with the distribution. 12 | * Neither the name of the copyright holder nor the 13 | names of its contributors may be used to endorse or promote products 14 | derived from this software without specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY 20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | #define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN 28 | #include "bitset.hpp" 29 | 30 | TEST_SUITE_BEGIN("bitset"); 31 | 32 | TEST_CASE("binary_bitset") 33 | { 34 | test_bitset(); 35 | } 36 | 37 | TEST_CASE("portable_binary_bitset") 38 | { 39 | test_bitset(); 40 | } 41 | 42 | TEST_CASE("xml_bitset") 43 | { 44 | test_bitset(); 45 | } 46 | 47 | TEST_CASE("json_bitset") 48 | { 49 | test_bitset(); 50 | } 51 | 52 | TEST_SUITE_END(); 53 | -------------------------------------------------------------------------------- /third/cereal/unittests/chrono.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014, Randolph Voorhies, Shane Grant 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in the 11 | documentation and/or other materials provided with the distribution. 12 | * Neither the name of the copyright holder nor the 13 | names of its contributors may be used to endorse or promote products 14 | derived from this software without specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY 20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | #define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN 28 | #include "chrono.hpp" 29 | 30 | TEST_SUITE_BEGIN("chrono"); 31 | 32 | TEST_CASE("binary_chrono") 33 | { 34 | test_chrono(); 35 | } 36 | 37 | TEST_CASE("portable_binary_chrono") 38 | { 39 | test_chrono(); 40 | } 41 | 42 | TEST_CASE("xml_chrono") 43 | { 44 | test_chrono(); 45 | } 46 | 47 | TEST_CASE("json_chrono") 48 | { 49 | test_chrono(); 50 | } 51 | 52 | TEST_SUITE_END(); 53 | -------------------------------------------------------------------------------- /third/cereal/unittests/deque.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014, Randolph Voorhies, Shane Grant 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in the 11 | documentation and/or other materials provided with the distribution. 12 | * Neither the name of the copyright holder nor the 13 | names of its contributors may be used to endorse or promote products 14 | derived from this software without specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY 20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | #define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN 28 | #include "deque.hpp" 29 | 30 | TEST_SUITE_BEGIN("deque"); 31 | 32 | TEST_CASE("binary_dequeue") 33 | { 34 | test_deque(); 35 | } 36 | 37 | TEST_CASE("portable_binary_dequeue") 38 | { 39 | test_deque(); 40 | } 41 | 42 | TEST_CASE("xml_dequeue") 43 | { 44 | test_deque(); 45 | } 46 | 47 | TEST_CASE("json_dequeue") 48 | { 49 | test_deque(); 50 | } 51 | 52 | TEST_SUITE_END(); 53 | -------------------------------------------------------------------------------- /third/cereal/unittests/vector.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014, Randolph Voorhies, Shane Grant 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in the 11 | documentation and/or other materials provided with the distribution. 12 | * Neither the name of the copyright holder nor the 13 | names of its contributors may be used to endorse or promote products 14 | derived from this software without specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY 20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | #define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN 28 | #include "vector.hpp" 29 | 30 | TEST_SUITE_BEGIN("vector"); 31 | 32 | TEST_CASE("binary_vector") 33 | { 34 | test_vector(); 35 | } 36 | 37 | TEST_CASE("portable_binary_vector") 38 | { 39 | test_vector(); 40 | } 41 | 42 | TEST_CASE("xml_vector") 43 | { 44 | test_vector(); 45 | } 46 | 47 | TEST_CASE("json_vector") 48 | { 49 | test_vector(); 50 | } 51 | 52 | TEST_SUITE_END(); 53 | -------------------------------------------------------------------------------- /third/cereal/unittests/complex.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014, Randolph Voorhies, Shane Grant 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in the 11 | documentation and/or other materials provided with the distribution. 12 | * Neither the name of the copyright holder nor the 13 | names of its contributors may be used to endorse or promote products 14 | derived from this software without specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY 20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | #define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN 28 | #include "complex.hpp" 29 | 30 | TEST_SUITE_BEGIN("complex"); 31 | 32 | TEST_CASE("binary_complex") 33 | { 34 | test_complex(); 35 | } 36 | 37 | TEST_CASE("portable_binary_complex") 38 | { 39 | test_complex(); 40 | } 41 | 42 | TEST_CASE("xml_complex") 43 | { 44 | test_complex(); 45 | } 46 | 47 | TEST_CASE("json_complex") 48 | { 49 | test_complex(); 50 | } 51 | 52 | TEST_SUITE_END(); 53 | -------------------------------------------------------------------------------- /third/cereal/unittests/structs.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014, Randolph Voorhies, Shane Grant 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in the 11 | documentation and/or other materials provided with the distribution. 12 | * Neither the name of the copyright holder nor the 13 | names of its contributors may be used to endorse or promote products 14 | derived from this software without specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY 20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | #define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN 28 | #include "structs.hpp" 29 | 30 | TEST_SUITE_BEGIN("structs"); 31 | 32 | TEST_CASE("binary_structs") 33 | { 34 | test_structs(); 35 | } 36 | 37 | TEST_CASE("portable_binary_structs") 38 | { 39 | test_structs(); 40 | } 41 | 42 | TEST_CASE("xml_structs") 43 | { 44 | test_structs(); 45 | } 46 | 47 | TEST_CASE("json_structs") 48 | { 49 | test_structs(); 50 | } 51 | 52 | TEST_SUITE_END(); 53 | -------------------------------------------------------------------------------- /third/cereal/unittests/multimap.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014, Randolph Voorhies, Shane Grant 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in the 11 | documentation and/or other materials provided with the distribution. 12 | * Neither the name of the copyright holder nor the 13 | names of its contributors may be used to endorse or promote products 14 | derived from this software without specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY 20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | #define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN 28 | #include "multimap.hpp" 29 | 30 | TEST_SUITE_BEGIN("multimap"); 31 | 32 | TEST_CASE("binary_multimap") 33 | { 34 | test_multimap(); 35 | } 36 | 37 | TEST_CASE("portable_binary_multimap") 38 | { 39 | test_multimap(); 40 | } 41 | 42 | TEST_CASE("xml_multimap") 43 | { 44 | test_multimap(); 45 | } 46 | 47 | TEST_CASE("json_multimap") 48 | { 49 | test_multimap(); 50 | } 51 | 52 | TEST_SUITE_END(); 53 | -------------------------------------------------------------------------------- /third/cereal/unittests/multiset.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014, Randolph Voorhies, Shane Grant 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in the 11 | documentation and/or other materials provided with the distribution. 12 | * Neither the name of the copyright holder nor the 13 | names of its contributors may be used to endorse or promote products 14 | derived from this software without specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY 20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | #define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN 28 | #include "multiset.hpp" 29 | 30 | TEST_SUITE_BEGIN("multiset"); 31 | 32 | TEST_CASE("binary_multiset") 33 | { 34 | test_multiset(); 35 | } 36 | 37 | TEST_CASE("portable_binary_multiset") 38 | { 39 | test_multiset(); 40 | } 41 | 42 | TEST_CASE("xml_multiset") 43 | { 44 | test_multiset(); 45 | } 46 | 47 | TEST_CASE("json_multiset") 48 | { 49 | test_multiset(); 50 | } 51 | 52 | TEST_SUITE_END(); 53 | -------------------------------------------------------------------------------- /tests/integration/test_rebuild_query_workflow.py: -------------------------------------------------------------------------------- 1 | """Integration tests for rebuild → query workflow.""" 2 | import numpy as np 3 | import pytest 4 | 5 | from python_prtree import PRTree2D, PRTree3D, PRTree4D 6 | 7 | 8 | @pytest.mark.parametrize("PRTree, dim", [(PRTree2D, 2), (PRTree3D, 3), (PRTree4D, 4)]) 9 | def test_rebuild_after_many_operations(PRTree, dim): 10 | """Test rebuild and query after many operations.""" 11 | np.random.seed(42) 12 | n = 100 13 | idx = np.arange(n) 14 | boxes = np.random.rand(n, 2 * dim) * 100 15 | for i in range(dim): 16 | boxes[:, i + dim] += boxes[:, i] + 1 17 | 18 | tree = PRTree(idx, boxes) 19 | 20 | # Many insert operations 21 | for i in range(n, n + 100): 22 | box = np.random.rand(2 * dim) * 100 23 | for d in range(dim): 24 | box[d + dim] += box[d] + 1 25 | tree.insert(idx=i, bb=box) 26 | 27 | # Many erase operations 28 | for i in range(n // 2): 29 | tree.erase(i) 30 | 31 | # Rebuild 32 | tree.rebuild() 33 | 34 | # Query should still work 35 | query_box = np.random.rand(2 * dim) * 100 36 | for i in range(dim): 37 | query_box[i + dim] += query_box[i] + 1 38 | 39 | result = tree.query(query_box) 40 | assert isinstance(result, list) 41 | 42 | 43 | @pytest.mark.parametrize("PRTree, dim", [(PRTree2D, 2), (PRTree3D, 3), (PRTree4D, 4)]) 44 | def test_rebuild_consistency_across_operations(PRTree, dim): 45 | """Test consistency before and after rebuild.""" 46 | np.random.seed(42) 47 | n = 100 48 | idx = np.arange(n) 49 | boxes = np.random.rand(n, 2 * dim) * 100 50 | for i in range(dim): 51 | boxes[:, i + dim] += boxes[:, i] + 1 52 | 53 | tree1 = PRTree(idx, boxes) 54 | tree2 = PRTree(idx, boxes) 55 | 56 | # Tree1: many operations + rebuild 57 | for i in range(20): 58 | tree1.erase(i) 59 | for i in range(20): 60 | box = boxes[i] 61 | tree1.insert(idx=i, bb=box) 62 | tree1.rebuild() 63 | 64 | # Query both trees 65 | queries = np.random.rand(20, 2 * dim) * 100 66 | for i in range(dim): 67 | queries[:, i + dim] += queries[:, i] + 1 68 | 69 | results1 = tree1.batch_query(queries) 70 | results2 = tree2.batch_query(queries) 71 | 72 | # Results should be identical 73 | for r1, r2 in zip(results1, results2): 74 | assert set(r1) == set(r2) 75 | -------------------------------------------------------------------------------- /third/cereal/unittests/boost/boost_variant.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2015, Kyle Fleming 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in the 11 | documentation and/or other materials provided with the distribution. 12 | * Neither the name of the copyright holder nor the 13 | names of its contributors may be used to endorse or promote products 14 | derived from this software without specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY 20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | #define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN 28 | #include "boost_variant.hpp" 29 | 30 | TEST_SUITE_BEGIN("boost_variant"); 31 | 32 | TEST_CASE("binary_boost_variant") 33 | { 34 | test_boost_variant(); 35 | } 36 | 37 | TEST_CASE("portable_binary_boost_variant") 38 | { 39 | test_boost_variant(); 40 | } 41 | 42 | TEST_CASE("xml_boost_variant") 43 | { 44 | test_boost_variant(); 45 | } 46 | 47 | TEST_CASE("json_boost_variant") 48 | { 49 | test_boost_variant(); 50 | } 51 | 52 | TEST_SUITE_END(); 53 | -------------------------------------------------------------------------------- /third/cereal/unittests/forward_list.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014, Randolph Voorhies, Shane Grant 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in the 11 | documentation and/or other materials provided with the distribution. 12 | * Neither the name of the copyright holder nor the 13 | names of its contributors may be used to endorse or promote products 14 | derived from this software without specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY 20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | #define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN 28 | #include "forward_list.hpp" 29 | 30 | TEST_SUITE_BEGIN("forward_list"); 31 | 32 | TEST_CASE("binary_forward_list") 33 | { 34 | test_forward_list(); 35 | } 36 | 37 | TEST_CASE("portable_binary_forward_list") 38 | { 39 | test_forward_list(); 40 | } 41 | 42 | TEST_CASE("xml_forward_list") 43 | { 44 | test_forward_list(); 45 | } 46 | 47 | TEST_CASE("json_forward_list") 48 | { 49 | test_forward_list(); 50 | } 51 | 52 | TEST_SUITE_END(); 53 | -------------------------------------------------------------------------------- /third/cereal/unittests/memory_cycles.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014, Randolph Voorhies, Shane Grant 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in the 11 | documentation and/or other materials provided with the distribution. 12 | * Neither the name of the copyright holder nor the 13 | names of its contributors may be used to endorse or promote products 14 | derived from this software without specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY 20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | #define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN 28 | #include "memory_cycles.hpp" 29 | 30 | TEST_SUITE_BEGIN("memory_cycles"); 31 | 32 | TEST_CASE("binary_memory_cycles") 33 | { 34 | test_memory_cycles(); 35 | } 36 | 37 | TEST_CASE("portable_binary_memory_cycles") 38 | { 39 | test_memory_cycles(); 40 | } 41 | 42 | TEST_CASE("xml_memory_cycles") 43 | { 44 | test_memory_cycles(); 45 | } 46 | 47 | TEST_CASE("json_memory_cycles") 48 | { 49 | test_memory_cycles(); 50 | } 51 | 52 | TEST_SUITE_END(); 53 | -------------------------------------------------------------------------------- /third/cereal/unittests/unordered_map.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014, Randolph Voorhies, Shane Grant 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in the 11 | documentation and/or other materials provided with the distribution. 12 | * Neither the name of the copyright holder nor the 13 | names of its contributors may be used to endorse or promote products 14 | derived from this software without specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY 20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | #define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN 28 | #include "unordered_map.hpp" 29 | 30 | TEST_SUITE_BEGIN("unordered_map"); 31 | 32 | TEST_CASE("binary_unordered_map") 33 | { 34 | test_unordered_map(); 35 | } 36 | 37 | TEST_CASE("portable_binary_unordered_map") 38 | { 39 | test_unordered_map(); 40 | } 41 | 42 | TEST_CASE("xml_unordered_map") 43 | { 44 | test_unordered_map(); 45 | } 46 | 47 | TEST_CASE("json_unordered_map") 48 | { 49 | test_unordered_map(); 50 | } 51 | 52 | TEST_SUITE_END(); 53 | -------------------------------------------------------------------------------- /third/cereal/unittests/unordered_set.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014, Randolph Voorhies, Shane Grant 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in the 11 | documentation and/or other materials provided with the distribution. 12 | * Neither the name of the copyright holder nor the 13 | names of its contributors may be used to endorse or promote products 14 | derived from this software without specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY 20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | #define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN 28 | #include "unordered_set.hpp" 29 | 30 | TEST_SUITE_BEGIN("unordered_set"); 31 | 32 | TEST_CASE("binary_unordered_set") 33 | { 34 | test_unordered_set(); 35 | } 36 | 37 | TEST_CASE("portable_binary_unordered_set") 38 | { 39 | test_unordered_set(); 40 | } 41 | 42 | TEST_CASE("xml_unordered_set") 43 | { 44 | test_unordered_set(); 45 | } 46 | 47 | TEST_CASE("json_unordered_set") 48 | { 49 | test_unordered_set(); 50 | } 51 | 52 | TEST_SUITE_END(); 53 | -------------------------------------------------------------------------------- /docs/README.md: -------------------------------------------------------------------------------- 1 | # Documentation Directory 2 | 3 | This directory contains comprehensive documentation for python_prtree developers and contributors. 4 | 5 | ## Contents 6 | 7 | ### Core Documentation 8 | 9 | - **[ARCHITECTURE.md](ARCHITECTURE.md)** - Project architecture and design decisions 10 | - Directory structure and separation of concerns 11 | - Data flow diagrams 12 | - Build system overview 13 | - Native precision support architecture 14 | 15 | - **[DEVELOPMENT.md](DEVELOPMENT.md)** - Development environment setup 16 | - Prerequisites and installation 17 | - Build instructions 18 | - Testing and code quality tools 19 | - Troubleshooting guide 20 | 21 | - **[MIGRATION.md](MIGRATION.md)** - Migration guides between versions 22 | - v0.7.0 project restructuring guide 23 | - Breaking changes and migration steps 24 | - Planned future migrations 25 | 26 | ### Supplementary Resources 27 | 28 | - **baseline/** - Performance baseline measurements 29 | - System information 30 | - Benchmark results and analysis 31 | - Used for regression testing and performance comparison 32 | 33 | - **examples/** - Example notebooks and scripts 34 | - Experimental notebooks for exploring the API 35 | - Usage demonstrations 36 | - Prototyping and development examples 37 | 38 | - **images/** - Documentation images 39 | - Benchmark graphs used in README 40 | - Performance comparison charts 41 | - Referenced by main documentation 42 | 43 | ## For Users 44 | 45 | If you're a user looking for usage documentation, see: 46 | - [README.md](../README.md) - Main user documentation with examples 47 | - [CONTRIBUTING.md](../CONTRIBUTING.md) - How to contribute to the project 48 | - [CHANGES.md](../CHANGES.md) - Version history and changelog 49 | 50 | ## For Developers 51 | 52 | Start with these files in order: 53 | 1. [README.md](../README.md) - Understand what the library does 54 | 2. [DEVELOPMENT.md](DEVELOPMENT.md) - Set up your development environment 55 | 3. [ARCHITECTURE.md](ARCHITECTURE.md) - Understand the codebase structure 56 | 4. [CONTRIBUTING.md](../CONTRIBUTING.md) - Learn the contribution workflow 57 | 58 | ## Keeping Documentation Updated 59 | 60 | When making changes: 61 | - Update ARCHITECTURE.md if you change the project structure 62 | - Update DEVELOPMENT.md if you change build/test processes 63 | - Update MIGRATION.md when introducing breaking changes 64 | - Regenerate benchmarks if performance characteristics change 65 | -------------------------------------------------------------------------------- /third/cereal/unittests/priority_queue.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014, Randolph Voorhies, Shane Grant 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in the 11 | documentation and/or other materials provided with the distribution. 12 | * Neither the name of the copyright holder nor the 13 | names of its contributors may be used to endorse or promote products 14 | derived from this software without specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY 20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | #define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN 28 | #include "priority_queue.hpp" 29 | 30 | TEST_SUITE_BEGIN("priority_queue"); 31 | 32 | TEST_CASE("binary_priority_queue") 33 | { 34 | test_priority_queue(); 35 | } 36 | 37 | TEST_CASE("portable_binary_priority_queue") 38 | { 39 | test_priority_queue(); 40 | } 41 | 42 | TEST_CASE("xml_priority_queue") 43 | { 44 | test_priority_queue(); 45 | } 46 | 47 | TEST_CASE("json_priority_queue") 48 | { 49 | test_priority_queue(); 50 | } 51 | 52 | TEST_SUITE_END(); 53 | -------------------------------------------------------------------------------- /third/cereal/unittests/structs_minimal.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014, Randolph Voorhies, Shane Grant 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in the 11 | documentation and/or other materials provided with the distribution. 12 | * Neither the name of the copyright holder nor the 13 | names of its contributors may be used to endorse or promote products 14 | derived from this software without specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY 20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | #define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN 28 | #include "structs_minimal.hpp" 29 | 30 | TEST_SUITE_BEGIN("structs_minimal"); 31 | 32 | TEST_CASE("binary_structs_minimal") 33 | { 34 | test_structs_minimal(); 35 | } 36 | 37 | TEST_CASE("portable_binary_structs_minimal") 38 | { 39 | test_structs_minimal(); 40 | } 41 | 42 | TEST_CASE("xml_structs_minimal") 43 | { 44 | test_structs_minimal(); 45 | } 46 | 47 | TEST_CASE("json_structs_minimal") 48 | { 49 | test_structs_minimal(); 50 | } 51 | 52 | TEST_SUITE_END(); 53 | -------------------------------------------------------------------------------- /third/cereal/unittests/unordered_multimap.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014, Randolph Voorhies, Shane Grant 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in the 11 | documentation and/or other materials provided with the distribution. 12 | * Neither the name of the copyright holder nor the 13 | names of its contributors may be used to endorse or promote products 14 | derived from this software without specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY 20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | #define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN 28 | #include "unordered_multimap.hpp" 29 | 30 | TEST_SUITE_BEGIN("unordered_multimap"); 31 | 32 | TEST_CASE("binary_unordered_multimap") 33 | { 34 | test_unordered_multimap(); 35 | } 36 | 37 | TEST_CASE("portable_binary_unordered_multimap") 38 | { 39 | test_unordered_multimap(); 40 | } 41 | 42 | TEST_CASE("xml_unordered_multimap") 43 | { 44 | test_unordered_multimap(); 45 | } 46 | 47 | TEST_CASE("json_unordered_multimap") 48 | { 49 | test_unordered_multimap(); 50 | } 51 | 52 | TEST_SUITE_END(); 53 | -------------------------------------------------------------------------------- /third/cereal/unittests/unordered_multiset.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014, Randolph Voorhies, Shane Grant 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in the 11 | documentation and/or other materials provided with the distribution. 12 | * Neither the name of the copyright holder nor the 13 | names of its contributors may be used to endorse or promote products 14 | derived from this software without specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY 20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | #define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN 28 | #include "unordered_multiset.hpp" 29 | 30 | TEST_SUITE_BEGIN("unordered_multiset"); 31 | 32 | TEST_CASE("binary_unordered_multiset") 33 | { 34 | test_unordered_multiset(); 35 | } 36 | 37 | TEST_CASE("portable_binary_unordered_multiset") 38 | { 39 | test_unordered_multiset(); 40 | } 41 | 42 | TEST_CASE("xml_unordered_multiset") 43 | { 44 | test_unordered_multiset(); 45 | } 46 | 47 | TEST_CASE("json_unordered_multiset") 48 | { 49 | test_unordered_multiset(); 50 | } 51 | 52 | TEST_SUITE_END(); 53 | -------------------------------------------------------------------------------- /third/cereal/unittests/user_data_adapters.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014, Randolph Voorhies, Shane Grant 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in the 11 | documentation and/or other materials provided with the distribution. 12 | * Neither the name of the copyright holder nor the 13 | names of its contributors may be used to endorse or promote products 14 | derived from this software without specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY 20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | #define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN 28 | #include "user_data_adapters.hpp" 29 | 30 | TEST_SUITE_BEGIN("user_data_adapters"); 31 | 32 | TEST_CASE("binary_user_data_adapters") 33 | { 34 | test_user_data_adapters(); 35 | } 36 | 37 | TEST_CASE("portable_binary_user_data_adapters") 38 | { 39 | test_user_data_adapters(); 40 | } 41 | 42 | TEST_CASE("xml_user_data_adapters") 43 | { 44 | test_user_data_adapters(); 45 | } 46 | 47 | TEST_CASE("json_user_data_adapters") 48 | { 49 | test_user_data_adapters(); 50 | } 51 | 52 | TEST_SUITE_END(); 53 | -------------------------------------------------------------------------------- /third/cereal/unittests/cpp17/optional.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2017, Juan Pedro Bolivar Puente 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in the 11 | documentation and/or other materials provided with the distribution. 12 | * Neither the name of the copyright holder nor the 13 | names of its contributors may be used to endorse or promote products 14 | derived from this software without specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY 20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN 29 | #include "optional.hpp" 30 | 31 | #ifdef CEREAL_HAS_CPP17 32 | 33 | TEST_SUITE_BEGIN("std_optional"); 34 | 35 | TEST_CASE("binary_std_optional") 36 | { 37 | test_std_optional(); 38 | } 39 | 40 | TEST_CASE("portable_binary_std_optional") 41 | { 42 | test_std_optional(); 43 | } 44 | 45 | TEST_CASE("xml_std_optional") 46 | { 47 | test_std_optional(); 48 | } 49 | 50 | TEST_CASE("json_std_optional") 51 | { 52 | test_std_optional(); 53 | } 54 | 55 | TEST_SUITE_END(); 56 | 57 | #endif // CEREAL_HAS_CPP17 58 | -------------------------------------------------------------------------------- /third/cereal/unittests/cpp17/variant.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2015, Kyle Fleming, Juan Pedro Bolivar Puente 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in the 11 | documentation and/or other materials provided with the distribution. 12 | * Neither the name of the copyright holder nor the 13 | names of its contributors may be used to endorse or promote products 14 | derived from this software without specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY 20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN 29 | #include "variant.hpp" 30 | 31 | #ifdef CEREAL_HAS_CPP17 32 | 33 | TEST_SUITE_BEGIN("std_variant"); 34 | 35 | TEST_CASE("binary_std_variant") 36 | { 37 | test_std_variant(); 38 | } 39 | 40 | TEST_CASE("portable_binary_std_variant") 41 | { 42 | test_std_variant(); 43 | } 44 | 45 | TEST_CASE("xml_std_variant") 46 | { 47 | test_std_variant(); 48 | } 49 | 50 | TEST_CASE("json_std_variant") 51 | { 52 | test_std_variant(); 53 | } 54 | 55 | TEST_SUITE_END(); 56 | 57 | #endif // CEREAL_HAS_CPP17 58 | -------------------------------------------------------------------------------- /third/cereal/unittests/load_construct.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014, Randolph Voorhies, Shane Grant 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in the 11 | documentation and/or other materials provided with the distribution. 12 | * Neither the name of the copyright holder nor the 13 | names of its contributors may be used to endorse or promote products 14 | derived from this software without specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY 20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | #define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN 28 | #include "load_construct.hpp" 29 | 30 | TEST_SUITE_BEGIN("load_construct"); 31 | 32 | TEST_CASE("binary_memory_load_construct") 33 | { 34 | test_memory_load_construct(); 35 | } 36 | 37 | TEST_CASE("portable_binary_memory_load_construct") 38 | { 39 | test_memory_load_construct(); 40 | } 41 | 42 | TEST_CASE("xml_memory_load_construct") 43 | { 44 | test_memory_load_construct(); 45 | } 46 | 47 | TEST_CASE("json_memory_load_construct") 48 | { 49 | test_memory_load_construct(); 50 | } 51 | 52 | TEST_SUITE_END(); 53 | -------------------------------------------------------------------------------- /third/cereal/unittests/structs_specialized.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014, Randolph Voorhies, Shane Grant 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in the 11 | documentation and/or other materials provided with the distribution. 12 | * Neither the name of the copyright holder nor the 13 | names of its contributors may be used to endorse or promote products 14 | derived from this software without specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY 20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | #define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN 28 | #include "structs_specialized.hpp" 29 | 30 | TEST_SUITE_BEGIN("structs_specialized"); 31 | 32 | TEST_CASE("binary_structs_specialized") 33 | { 34 | test_structs_specialized(); 35 | } 36 | 37 | TEST_CASE("portable_binary_structs_specialized") 38 | { 39 | test_structs_specialized(); 40 | } 41 | 42 | TEST_CASE("xml_structs_specialized") 43 | { 44 | test_structs_specialized(); 45 | } 46 | 47 | TEST_CASE("json_structs_specialized") 48 | { 49 | test_structs_specialized(); 50 | } 51 | 52 | TEST_SUITE_END(); 53 | -------------------------------------------------------------------------------- /tests/integration/test_erase_query_workflow.py: -------------------------------------------------------------------------------- 1 | """Integration tests for erase → query workflow.""" 2 | import numpy as np 3 | import pytest 4 | 5 | from python_prtree import PRTree2D, PRTree3D, PRTree4D 6 | 7 | 8 | @pytest.mark.parametrize("PRTree, dim", [(PRTree2D, 2), (PRTree3D, 3), (PRTree4D, 4)]) 9 | def test_erase_and_query_incrementally(PRTree, dim): 10 | """Integration test: incremental erase with queries.""" 11 | np.random.seed(42) 12 | n = 100 13 | idx = np.arange(n) 14 | boxes = np.random.rand(n, 2 * dim) * 100 15 | for i in range(dim): 16 | boxes[:, i + dim] += boxes[:, i] + 1 17 | 18 | tree = PRTree(idx, boxes) 19 | 20 | # Erase half and query after each erase 21 | for i in range(n // 2): 22 | tree.erase(i) 23 | assert tree.size() == n - i - 1 24 | 25 | # Query for erased element should return empty or not include it 26 | result = tree.query(boxes[i]) 27 | assert i not in result 28 | 29 | 30 | @pytest.mark.parametrize("PRTree, dim", [(PRTree2D, 2), (PRTree3D, 3), (PRTree4D, 4)]) 31 | def test_insert_erase_insert_workflow(PRTree, dim): 32 | """Test insert → erase → insert workflow.""" 33 | tree = PRTree() 34 | 35 | # Insert 36 | box1 = np.zeros(2 * dim) 37 | for d in range(dim): 38 | box1[d] = 0.0 39 | box1[d + dim] = 1.0 40 | tree.insert(idx=1, bb=box1) 41 | 42 | # Erase (can now erase the last element!) 43 | tree.erase(1) 44 | assert tree.size() == 0 45 | 46 | # Insert again 47 | box2 = np.zeros(2 * dim) 48 | for d in range(dim): 49 | box2[d] = 2.0 50 | box2[d + dim] = 3.0 51 | tree.insert(idx=2, bb=box2) 52 | 53 | assert tree.size() == 1 54 | result = tree.query(box2) 55 | assert 2 in result 56 | 57 | 58 | @pytest.mark.parametrize("PRTree, dim", [(PRTree2D, 2), (PRTree3D, 3), (PRTree4D, 4)]) 59 | def test_bulk_erase_and_verify(PRTree, dim): 60 | """Test verification after bulk erase.""" 61 | np.random.seed(42) 62 | n = 200 63 | idx = np.arange(n) 64 | boxes = np.random.rand(n, 2 * dim) * 100 65 | for i in range(dim): 66 | boxes[:, i + dim] += boxes[:, i] + 1 67 | 68 | tree = PRTree(idx, boxes) 69 | 70 | # Erase even indices 71 | for i in range(0, n, 2): 72 | tree.erase(i) 73 | 74 | assert tree.size() == n // 2 75 | 76 | # Verify remaining elements 77 | for i in range(1, n, 2): 78 | result = tree.query(boxes[i]) 79 | assert i in result 80 | -------------------------------------------------------------------------------- /third/cereal/include/cereal/types/atomic.hpp: -------------------------------------------------------------------------------- 1 | /*! \file atomic.hpp 2 | \brief Support for types found in \ 3 | \ingroup STLSupport */ 4 | /* 5 | Copyright (c) 2014, Randolph Voorhies, Shane Grant 6 | All rights reserved. 7 | 8 | Redistribution and use in source and binary forms, with or without 9 | modification, are permitted provided that the following conditions are met: 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in the 14 | documentation and/or other materials provided with the distribution. 15 | * Neither the name of the copyright holder nor the 16 | names of its contributors may be used to endorse or promote products 17 | derived from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 20 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 21 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY 23 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 26 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | #ifndef CEREAL_TYPES_ATOMIC_HPP_ 31 | #define CEREAL_TYPES_ATOMIC_HPP_ 32 | 33 | #include 34 | #include 35 | 36 | namespace cereal 37 | { 38 | //! Serializing (save) for std::atomic 39 | template inline 40 | void CEREAL_SAVE_FUNCTION_NAME( Archive & ar, std::atomic const & a ) 41 | { 42 | ar( CEREAL_NVP_("atomic_data", a.load()) ); 43 | } 44 | 45 | //! Serializing (load) for std::atomic 46 | template inline 47 | void CEREAL_LOAD_FUNCTION_NAME( Archive & ar, std::atomic & a ) 48 | { 49 | T tmp; 50 | ar( CEREAL_NVP_("atomic_data", tmp) ); 51 | a.store( tmp ); 52 | } 53 | } // namespace cereal 54 | 55 | #endif // CEREAL_TYPES_ATOMIC_HPP_ 56 | -------------------------------------------------------------------------------- /third/cereal/include/cereal/version.hpp: -------------------------------------------------------------------------------- 1 | /*! \file version.hpp 2 | \brief Macros to detect cereal version 3 | 4 | These macros can assist in determining the version of cereal. Be 5 | warned that cereal is not guaranteed to be compatible across 6 | different versions. For more information on releases of cereal, 7 | see https://github.com/USCiLab/cereal/releases. 8 | 9 | \ingroup utility */ 10 | /* 11 | Copyright (c) 2018, Shane Grant 12 | All rights reserved. 13 | 14 | Redistribution and use in source and binary forms, with or without 15 | modification, are permitted provided that the following conditions are met: 16 | * Redistributions of source code must retain the above copyright 17 | notice, this list of conditions and the following disclaimer. 18 | * Redistributions in binary form must reproduce the above copyright 19 | notice, this list of conditions and the following disclaimer in the 20 | documentation and/or other materials provided with the distribution. 21 | * Neither the name of the copyright holder nor the 22 | names of its contributors may be used to endorse or promote products 23 | derived from this software without specific prior written permission. 24 | 25 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 26 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 27 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 28 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY 29 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 30 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 31 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 32 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 33 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 34 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 35 | */ 36 | 37 | #ifndef CEREAL_VERSION_HPP_ 38 | #define CEREAL_VERSION_HPP_ 39 | 40 | //! The major version 41 | #define CEREAL_VERSION_MAJOR 1 42 | //! The minor version 43 | #define CEREAL_VERSION_MINOR 3 44 | //! The patch version 45 | #define CEREAL_VERSION_PATCH 2 46 | 47 | //! The full version as a single number 48 | #define CEREAL_VERSION (CEREAL_VERSION_MAJOR * 10000 \ 49 | + CEREAL_VERSION_MINOR * 100 \ 50 | + CEREAL_VERSION_PATCH) 51 | 52 | #endif // CEREAL_VERSION_HPP_ 53 | -------------------------------------------------------------------------------- /third/cereal/include/cereal/external/rapidjson/internal/strfunc.h: -------------------------------------------------------------------------------- 1 | // Tencent is pleased to support the open source community by making RapidJSON available. 2 | // 3 | // Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip. All rights reserved. 4 | // 5 | // Licensed under the MIT License (the "License"); you may not use this file except 6 | // in compliance with the License. You may obtain a copy of the License at 7 | // 8 | // http://opensource.org/licenses/MIT 9 | // 10 | // Unless required by applicable law or agreed to in writing, software distributed 11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the 13 | // specific language governing permissions and limitations under the License. 14 | 15 | #ifndef CEREAL_RAPIDJSON_INTERNAL_STRFUNC_H_ 16 | #define CEREAL_RAPIDJSON_INTERNAL_STRFUNC_H_ 17 | 18 | #include "../stream.h" 19 | #include 20 | 21 | CEREAL_RAPIDJSON_NAMESPACE_BEGIN 22 | namespace internal { 23 | 24 | //! Custom strlen() which works on different character types. 25 | /*! \tparam Ch Character type (e.g. char, wchar_t, short) 26 | \param s Null-terminated input string. 27 | \return Number of characters in the string. 28 | \note This has the same semantics as strlen(), the return value is not number of Unicode codepoints. 29 | */ 30 | template 31 | inline SizeType StrLen(const Ch* s) { 32 | CEREAL_RAPIDJSON_ASSERT(s != 0); 33 | const Ch* p = s; 34 | while (*p) ++p; 35 | return SizeType(p - s); 36 | } 37 | 38 | template <> 39 | inline SizeType StrLen(const char* s) { 40 | return SizeType(std::strlen(s)); 41 | } 42 | 43 | template <> 44 | inline SizeType StrLen(const wchar_t* s) { 45 | return SizeType(std::wcslen(s)); 46 | } 47 | 48 | //! Returns number of code points in a encoded string. 49 | template 50 | bool CountStringCodePoint(const typename Encoding::Ch* s, SizeType length, SizeType* outCount) { 51 | CEREAL_RAPIDJSON_ASSERT(s != 0); 52 | CEREAL_RAPIDJSON_ASSERT(outCount != 0); 53 | GenericStringStream is(s); 54 | const typename Encoding::Ch* end = s + length; 55 | SizeType count = 0; 56 | while (is.src_ < end) { 57 | unsigned codepoint; 58 | if (!Encoding::Decode(is, &codepoint)) 59 | return false; 60 | count++; 61 | } 62 | *outCount = count; 63 | return true; 64 | } 65 | 66 | } // namespace internal 67 | CEREAL_RAPIDJSON_NAMESPACE_END 68 | 69 | #endif // CEREAL_RAPIDJSON_INTERNAL_STRFUNC_H_ 70 | -------------------------------------------------------------------------------- /third/cereal/unittests/pod.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014, Randolph Voorhies, Shane Grant 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in the 11 | documentation and/or other materials provided with the distribution. 12 | * Neither the name of the copyright holder nor the 13 | names of its contributors may be used to endorse or promote products 14 | derived from this software without specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY 20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | #define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN 28 | #include "pod.hpp" 29 | 30 | TEST_SUITE_BEGIN("pod"); 31 | 32 | TEST_CASE("binary_pod") 33 | { 34 | test_pod(); 35 | } 36 | 37 | TEST_CASE("portable_binary_pod") 38 | { 39 | test_pod(); 40 | } 41 | 42 | TEST_CASE("xml_pod") 43 | { 44 | test_pod(); 45 | } 46 | 47 | TEST_CASE("json_pod") 48 | { 49 | test_pod(); 50 | } 51 | 52 | TEST_CASE("xml_pod_serialization") 53 | { 54 | test_pod_serialization(); 55 | } 56 | 57 | TEST_CASE("json_pod_serialization") 58 | { 59 | test_pod_serialization(); 60 | } 61 | 62 | TEST_SUITE_END(); 63 | -------------------------------------------------------------------------------- /include/prtree/utils/parallel.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include 5 | 6 | template 7 | void parallel_for_each(const Iter first, const Iter last, T &result, 8 | const F &func) { 9 | auto f = std::ref(func); 10 | const size_t nthreads = 11 | (size_t)std::max(1, (int)std::thread::hardware_concurrency()); 12 | const size_t total = std::distance(first, last); 13 | std::vector rr(nthreads); 14 | { 15 | std::vector threads; 16 | std::vector iters; 17 | size_t step = total / nthreads; 18 | size_t remaining = total % nthreads; 19 | Iter n = first; 20 | iters.emplace_back(first); 21 | for (size_t i = 0; i < nthreads - 1; ++i) { 22 | std::advance(n, i < remaining ? step + 1 : step); 23 | iters.emplace_back(n); 24 | } 25 | iters.emplace_back(last); 26 | 27 | result.reserve(total); 28 | for (auto &r : rr) { 29 | r.reserve(total / nthreads + 1); 30 | } 31 | for (size_t t = 0; t < nthreads; t++) { 32 | threads.emplace_back(std::thread([&, t] { 33 | std::for_each(iters[t], iters[t + 1], [&](auto &x) { f(x, rr[t]); }); 34 | })); 35 | } 36 | std::for_each(threads.begin(), threads.end(), 37 | [&](std::thread &x) { x.join(); }); 38 | } 39 | for (size_t t = 0; t < nthreads; t++) { 40 | result.insert(result.end(), std::make_move_iterator(rr[t].begin()), 41 | std::make_move_iterator(rr[t].end())); 42 | } 43 | } 44 | 45 | template 46 | void parallel_for_each(const Iter first, const Iter last, const F &func) { 47 | auto f = std::ref(func); 48 | const size_t nthreads = 49 | (size_t)std::max(1, (int)std::thread::hardware_concurrency()); 50 | const size_t total = std::distance(first, last); 51 | { 52 | std::vector threads; 53 | std::vector iters; 54 | size_t step = total / nthreads; 55 | size_t remaining = total % nthreads; 56 | Iter n = first; 57 | iters.emplace_back(first); 58 | for (size_t i = 0; i < nthreads - 1; ++i) { 59 | std::advance(n, i < remaining ? step + 1 : step); 60 | iters.emplace_back(n); 61 | } 62 | iters.emplace_back(last); 63 | for (size_t t = 0; t < nthreads; t++) { 64 | threads.emplace_back(std::thread([&, t] { 65 | std::for_each(iters[t], iters[t + 1], [&](auto &x) { f(x); }); 66 | })); 67 | } 68 | std::for_each(threads.begin(), threads.end(), 69 | [&](std::thread &x) { x.join(); }); 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /third/cereal/include/cereal/types/complex.hpp: -------------------------------------------------------------------------------- 1 | /*! \file complex.hpp 2 | \brief Support for types found in \ 3 | \ingroup STLSupport */ 4 | /* 5 | Copyright (c) 2014, Randolph Voorhies, Shane Grant 6 | All rights reserved. 7 | 8 | Redistribution and use in source and binary forms, with or without 9 | modification, are permitted provided that the following conditions are met: 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in the 14 | documentation and/or other materials provided with the distribution. 15 | * Neither the name of the copyright holder nor the 16 | names of its contributors may be used to endorse or promote products 17 | derived from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 20 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 21 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY 23 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 26 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | #ifndef CEREAL_TYPES_COMPLEX_HPP_ 31 | #define CEREAL_TYPES_COMPLEX_HPP_ 32 | 33 | #include 34 | 35 | namespace cereal 36 | { 37 | //! Serializing (save) for std::complex 38 | template inline 39 | void CEREAL_SAVE_FUNCTION_NAME( Archive & ar, std::complex const & comp ) 40 | { 41 | ar( CEREAL_NVP_("real", comp.real()), 42 | CEREAL_NVP_("imag", comp.imag()) ); 43 | } 44 | 45 | //! Serializing (load) for std::complex 46 | template inline 47 | void CEREAL_LOAD_FUNCTION_NAME( Archive & ar, std::complex & bits ) 48 | { 49 | T real, imag; 50 | ar( CEREAL_NVP_("real", real), 51 | CEREAL_NVP_("imag", imag) ); 52 | bits = {real, imag}; 53 | } 54 | } // namespace cereal 55 | 56 | #endif // CEREAL_TYPES_COMPLEX_HPP_ 57 | -------------------------------------------------------------------------------- /third/cereal/unittests/array.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014, Randolph Voorhies, Shane Grant 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in the 11 | documentation and/or other materials provided with the distribution. 12 | * Neither the name of the copyright holder nor the 13 | names of its contributors may be used to endorse or promote products 14 | derived from this software without specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY 20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | #define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN 28 | #include "array.hpp" 29 | 30 | TEST_SUITE_BEGIN("array"); 31 | 32 | TEST_CASE("binary_array") 33 | { 34 | test_array(); 35 | test_array(); 36 | } 37 | 38 | TEST_CASE("portable_binary_array") 39 | { 40 | test_array(); 41 | test_array(); 42 | } 43 | 44 | TEST_CASE("xml_array") 45 | { 46 | test_array(); 47 | test_array(); 48 | } 49 | 50 | TEST_CASE("json_array") 51 | { 52 | test_array(); 53 | test_array(); 54 | } 55 | 56 | TEST_SUITE_END(); 57 | -------------------------------------------------------------------------------- /third/cereal/include/cereal/types/list.hpp: -------------------------------------------------------------------------------- 1 | /*! \file list.hpp 2 | \brief Support for types found in \ 3 | \ingroup STLSupport */ 4 | /* 5 | Copyright (c) 2014, Randolph Voorhies, Shane Grant 6 | All rights reserved. 7 | 8 | Redistribution and use in source and binary forms, with or without 9 | modification, are permitted provided that the following conditions are met: 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in the 14 | documentation and/or other materials provided with the distribution. 15 | * Neither the name of the copyright holder nor the 16 | names of its contributors may be used to endorse or promote products 17 | derived from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 20 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 21 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY 23 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 26 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | #ifndef CEREAL_TYPES_LIST_HPP_ 31 | #define CEREAL_TYPES_LIST_HPP_ 32 | 33 | #include "cereal/cereal.hpp" 34 | #include 35 | 36 | namespace cereal 37 | { 38 | //! Saving for std::list 39 | template inline 40 | void CEREAL_SAVE_FUNCTION_NAME( Archive & ar, std::list const & list ) 41 | { 42 | ar( make_size_tag( static_cast(list.size()) ) ); 43 | 44 | for( auto const & i : list ) 45 | ar( i ); 46 | } 47 | 48 | //! Loading for std::list 49 | template inline 50 | void CEREAL_LOAD_FUNCTION_NAME( Archive & ar, std::list & list ) 51 | { 52 | size_type size; 53 | ar( make_size_tag( size ) ); 54 | 55 | list.resize( static_cast( size ) ); 56 | 57 | for( auto & i : list ) 58 | ar( i ); 59 | } 60 | } // namespace cereal 61 | 62 | #endif // CEREAL_TYPES_LIST_HPP_ 63 | -------------------------------------------------------------------------------- /third/cereal/include/cereal/types/deque.hpp: -------------------------------------------------------------------------------- 1 | /*! \file deque.hpp 2 | \brief Support for types found in \ 3 | \ingroup STLSupport */ 4 | /* 5 | Copyright (c) 2014, Randolph Voorhies, Shane Grant 6 | All rights reserved. 7 | 8 | Redistribution and use in source and binary forms, with or without 9 | modification, are permitted provided that the following conditions are met: 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in the 14 | documentation and/or other materials provided with the distribution. 15 | * Neither the name of the copyright holder nor the 16 | names of its contributors may be used to endorse or promote products 17 | derived from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 20 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 21 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY 23 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 26 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | #ifndef CEREAL_TYPES_DEQUE_HPP_ 31 | #define CEREAL_TYPES_DEQUE_HPP_ 32 | 33 | #include "cereal/cereal.hpp" 34 | #include 35 | 36 | namespace cereal 37 | { 38 | //! Saving for std::deque 39 | template inline 40 | void CEREAL_SAVE_FUNCTION_NAME( Archive & ar, std::deque const & deque ) 41 | { 42 | ar( make_size_tag( static_cast(deque.size()) ) ); 43 | 44 | for( auto const & i : deque ) 45 | ar( i ); 46 | } 47 | 48 | //! Loading for std::deque 49 | template inline 50 | void CEREAL_LOAD_FUNCTION_NAME( Archive & ar, std::deque & deque ) 51 | { 52 | size_type size; 53 | ar( make_size_tag( size ) ); 54 | 55 | deque.resize( static_cast( size ) ); 56 | 57 | for( auto & i : deque ) 58 | ar( i ); 59 | } 60 | } // namespace cereal 61 | 62 | #endif // CEREAL_TYPES_DEQUE_HPP_ 63 | -------------------------------------------------------------------------------- /third/cereal/include/cereal/external/rapidjson/cursorstreamwrapper.h: -------------------------------------------------------------------------------- 1 | // Tencent is pleased to support the open source community by making RapidJSON available. 2 | // 3 | // Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip. All rights reserved. 4 | // 5 | // Licensed under the MIT License (the "License"); you may not use this file except 6 | // in compliance with the License. You may obtain a copy of the License at 7 | // 8 | // http://opensource.org/licenses/MIT 9 | // 10 | // Unless required by applicable law or agreed to in writing, software distributed 11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the 13 | // specific language governing permissions and limitations under the License. 14 | 15 | #ifndef CEREAL_RAPIDJSON_CURSORSTREAMWRAPPER_H_ 16 | #define CEREAL_RAPIDJSON_CURSORSTREAMWRAPPER_H_ 17 | 18 | #include "stream.h" 19 | 20 | #if defined(__GNUC__) 21 | CEREAL_RAPIDJSON_DIAG_PUSH 22 | CEREAL_RAPIDJSON_DIAG_OFF(effc++) 23 | #endif 24 | 25 | #if defined(_MSC_VER) && _MSC_VER <= 1800 26 | CEREAL_RAPIDJSON_DIAG_PUSH 27 | CEREAL_RAPIDJSON_DIAG_OFF(4702) // unreachable code 28 | CEREAL_RAPIDJSON_DIAG_OFF(4512) // assignment operator could not be generated 29 | #endif 30 | 31 | CEREAL_RAPIDJSON_NAMESPACE_BEGIN 32 | 33 | 34 | //! Cursor stream wrapper for counting line and column number if error exists. 35 | /*! 36 | \tparam InputStream Any stream that implements Stream Concept 37 | */ 38 | template > 39 | class CursorStreamWrapper : public GenericStreamWrapper { 40 | public: 41 | typedef typename Encoding::Ch Ch; 42 | 43 | CursorStreamWrapper(InputStream& is): 44 | GenericStreamWrapper(is), line_(1), col_(0) {} 45 | 46 | // counting line and column number 47 | Ch Take() { 48 | Ch ch = this->is_.Take(); 49 | if(ch == '\n') { 50 | line_ ++; 51 | col_ = 0; 52 | } else { 53 | col_ ++; 54 | } 55 | return ch; 56 | } 57 | 58 | //! Get the error line number, if error exists. 59 | size_t GetLine() const { return line_; } 60 | //! Get the error column number, if error exists. 61 | size_t GetColumn() const { return col_; } 62 | 63 | private: 64 | size_t line_; //!< Current Line 65 | size_t col_; //!< Current Column 66 | }; 67 | 68 | #if defined(_MSC_VER) && _MSC_VER <= 1800 69 | CEREAL_RAPIDJSON_DIAG_POP 70 | #endif 71 | 72 | #if defined(__GNUC__) 73 | CEREAL_RAPIDJSON_DIAG_POP 74 | #endif 75 | 76 | CEREAL_RAPIDJSON_NAMESPACE_END 77 | 78 | #endif // CEREAL_RAPIDJSON_CURSORSTREAMWRAPPER_H_ 79 | -------------------------------------------------------------------------------- /third/cereal/include/cereal/external/rapidjson/ostreamwrapper.h: -------------------------------------------------------------------------------- 1 | // Tencent is pleased to support the open source community by making RapidJSON available. 2 | // 3 | // Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip. All rights reserved. 4 | // 5 | // Licensed under the MIT License (the "License"); you may not use this file except 6 | // in compliance with the License. You may obtain a copy of the License at 7 | // 8 | // http://opensource.org/licenses/MIT 9 | // 10 | // Unless required by applicable law or agreed to in writing, software distributed 11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the 13 | // specific language governing permissions and limitations under the License. 14 | 15 | #ifndef CEREAL_RAPIDJSON_OSTREAMWRAPPER_H_ 16 | #define CEREAL_RAPIDJSON_OSTREAMWRAPPER_H_ 17 | 18 | #include "stream.h" 19 | #include 20 | 21 | #ifdef __clang__ 22 | CEREAL_RAPIDJSON_DIAG_PUSH 23 | CEREAL_RAPIDJSON_DIAG_OFF(padded) 24 | #endif 25 | 26 | CEREAL_RAPIDJSON_NAMESPACE_BEGIN 27 | 28 | //! Wrapper of \c std::basic_ostream into RapidJSON's Stream concept. 29 | /*! 30 | The classes can be wrapped including but not limited to: 31 | 32 | - \c std::ostringstream 33 | - \c std::stringstream 34 | - \c std::wpstringstream 35 | - \c std::wstringstream 36 | - \c std::ifstream 37 | - \c std::fstream 38 | - \c std::wofstream 39 | - \c std::wfstream 40 | 41 | \tparam StreamType Class derived from \c std::basic_ostream. 42 | */ 43 | 44 | template 45 | class BasicOStreamWrapper { 46 | public: 47 | typedef typename StreamType::char_type Ch; 48 | BasicOStreamWrapper(StreamType& stream) : stream_(stream) {} 49 | 50 | void Put(Ch c) { 51 | stream_.put(c); 52 | } 53 | 54 | void Flush() { 55 | stream_.flush(); 56 | } 57 | 58 | // Not implemented 59 | char Peek() const { CEREAL_RAPIDJSON_ASSERT(false); return 0; } 60 | char Take() { CEREAL_RAPIDJSON_ASSERT(false); return 0; } 61 | size_t Tell() const { CEREAL_RAPIDJSON_ASSERT(false); return 0; } 62 | char* PutBegin() { CEREAL_RAPIDJSON_ASSERT(false); return 0; } 63 | size_t PutEnd(char*) { CEREAL_RAPIDJSON_ASSERT(false); return 0; } 64 | 65 | private: 66 | BasicOStreamWrapper(const BasicOStreamWrapper&); 67 | BasicOStreamWrapper& operator=(const BasicOStreamWrapper&); 68 | 69 | StreamType& stream_; 70 | }; 71 | 72 | typedef BasicOStreamWrapper OStreamWrapper; 73 | typedef BasicOStreamWrapper WOStreamWrapper; 74 | 75 | #ifdef __clang__ 76 | CEREAL_RAPIDJSON_DIAG_POP 77 | #endif 78 | 79 | CEREAL_RAPIDJSON_NAMESPACE_END 80 | 81 | #endif // CEREAL_RAPIDJSON_OSTREAMWRAPPER_H_ 82 | -------------------------------------------------------------------------------- /third/cereal/include/cereal/types/optional.hpp: -------------------------------------------------------------------------------- 1 | /*! \file optional.hpp 2 | \brief Support for std::optional 3 | \ingroup STLSupport */ 4 | /* 5 | Copyright (c) 2017, Juan Pedro Bolivar Puente 6 | All rights reserved. 7 | 8 | Redistribution and use in source and binary forms, with or without 9 | modification, are permitted provided that the following conditions are met: 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in the 14 | documentation and/or other materials provided with the distribution. 15 | * Neither the name of the copyright holder nor the 16 | names of its contributors may be used to endorse or promote products 17 | derived from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 20 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 21 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY 23 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 26 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | #ifndef CEREAL_TYPES_STD_OPTIONAL_ 31 | #define CEREAL_TYPES_STD_OPTIONAL_ 32 | 33 | #include "cereal/cereal.hpp" 34 | #include 35 | 36 | namespace cereal { 37 | //! Saving for std::optional 38 | template inline 39 | void CEREAL_SAVE_FUNCTION_NAME(Archive& ar, const std::optional& optional) 40 | { 41 | if(!optional) { 42 | ar(CEREAL_NVP_("nullopt", true)); 43 | } else { 44 | ar(CEREAL_NVP_("nullopt", false), 45 | CEREAL_NVP_("data", *optional)); 46 | } 47 | } 48 | 49 | //! Loading for std::optional 50 | template inline 51 | void CEREAL_LOAD_FUNCTION_NAME(Archive& ar, std::optional& optional) 52 | { 53 | bool nullopt; 54 | ar(CEREAL_NVP_("nullopt", nullopt)); 55 | 56 | if (nullopt) { 57 | optional = std::nullopt; 58 | } else { 59 | optional.emplace(); 60 | ar(CEREAL_NVP_("data", *optional)); 61 | } 62 | } 63 | } // namespace cereal 64 | 65 | #endif // CEREAL_TYPES_STD_OPTIONAL_ 66 | -------------------------------------------------------------------------------- /third/cereal/unittests/map.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014, Randolph Voorhies, Shane Grant 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in the 11 | documentation and/or other materials provided with the distribution. 12 | * Neither the name of the copyright holder nor the 13 | names of its contributors may be used to endorse or promote products 14 | derived from this software without specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY 20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | #define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN 28 | #include "map.hpp" 29 | 30 | TEST_SUITE_BEGIN("map"); 31 | 32 | TEST_CASE("binary_map") 33 | { 34 | test_map(); 35 | } 36 | 37 | TEST_CASE("portable_binary_map") 38 | { 39 | test_map(); 40 | } 41 | 42 | TEST_CASE("xml_map") 43 | { 44 | test_map(); 45 | } 46 | 47 | TEST_CASE("json_map") 48 | { 49 | test_map(); 50 | } 51 | 52 | TEST_CASE("binary_map_memory") 53 | { 54 | test_map_memory(); 55 | } 56 | 57 | TEST_CASE("portable_binary_map_memory") 58 | { 59 | test_map_memory(); 60 | } 61 | 62 | TEST_CASE("xml_map_memory") 63 | { 64 | test_map_memory(); 65 | } 66 | 67 | TEST_CASE("json_map_memory") 68 | { 69 | test_map_memory(); 70 | } 71 | 72 | TEST_SUITE_END(); 73 | -------------------------------------------------------------------------------- /third/cereal/include/cereal/external/rapidjson/memorybuffer.h: -------------------------------------------------------------------------------- 1 | // Tencent is pleased to support the open source community by making RapidJSON available. 2 | // 3 | // Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip. All rights reserved. 4 | // 5 | // Licensed under the MIT License (the "License"); you may not use this file except 6 | // in compliance with the License. You may obtain a copy of the License at 7 | // 8 | // http://opensource.org/licenses/MIT 9 | // 10 | // Unless required by applicable law or agreed to in writing, software distributed 11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the 13 | // specific language governing permissions and limitations under the License. 14 | 15 | #ifndef CEREAL_RAPIDJSON_MEMORYBUFFER_H_ 16 | #define CEREAL_RAPIDJSON_MEMORYBUFFER_H_ 17 | 18 | #include "stream.h" 19 | #include "internal/stack.h" 20 | 21 | CEREAL_RAPIDJSON_NAMESPACE_BEGIN 22 | 23 | //! Represents an in-memory output byte stream. 24 | /*! 25 | This class is mainly for being wrapped by EncodedOutputStream or AutoUTFOutputStream. 26 | 27 | It is similar to FileWriteBuffer but the destination is an in-memory buffer instead of a file. 28 | 29 | Differences between MemoryBuffer and StringBuffer: 30 | 1. StringBuffer has Encoding but MemoryBuffer is only a byte buffer. 31 | 2. StringBuffer::GetString() returns a null-terminated string. MemoryBuffer::GetBuffer() returns a buffer without terminator. 32 | 33 | \tparam Allocator type for allocating memory buffer. 34 | \note implements Stream concept 35 | */ 36 | template 37 | struct GenericMemoryBuffer { 38 | typedef char Ch; // byte 39 | 40 | GenericMemoryBuffer(Allocator* allocator = 0, size_t capacity = kDefaultCapacity) : stack_(allocator, capacity) {} 41 | 42 | void Put(Ch c) { *stack_.template Push() = c; } 43 | void Flush() {} 44 | 45 | void Clear() { stack_.Clear(); } 46 | void ShrinkToFit() { stack_.ShrinkToFit(); } 47 | Ch* Push(size_t count) { return stack_.template Push(count); } 48 | void Pop(size_t count) { stack_.template Pop(count); } 49 | 50 | const Ch* GetBuffer() const { 51 | return stack_.template Bottom(); 52 | } 53 | 54 | size_t GetSize() const { return stack_.GetSize(); } 55 | 56 | static const size_t kDefaultCapacity = 256; 57 | mutable internal::Stack stack_; 58 | }; 59 | 60 | typedef GenericMemoryBuffer<> MemoryBuffer; 61 | 62 | //! Implement specialized version of PutN() with memset() for better performance. 63 | template<> 64 | inline void PutN(MemoryBuffer& memoryBuffer, char c, size_t n) { 65 | std::memset(memoryBuffer.stack_.Push(n), c, n * sizeof(c)); 66 | } 67 | 68 | CEREAL_RAPIDJSON_NAMESPACE_END 69 | 70 | #endif // CEREAL_RAPIDJSON_MEMORYBUFFER_H_ 71 | -------------------------------------------------------------------------------- /third/cereal/scripts/appveyor.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | setlocal enabledelayedexpansion 3 | 4 | if not defined APPVEYOR ( 5 | @echo This script is meant to be used with AppVeyor CI. This can be used as reference. 6 | @echo I sincerely recommend not using it for building/testing cereal locally. 7 | exit /b 0 8 | ) 9 | 10 | if not defined BOOST_ROOT ( 11 | set BOOST_ROOT=C:\Libraries\boost 12 | ) 13 | 14 | if not defined VS_VERSION_MAJOR ( 15 | set VS_VERSION_MAJOR=14 16 | ) 17 | if not defined VS_VERSION_YEAR ( 18 | if "%VS_VERSION_MAJOR%" == "12" ( 19 | set VS_VERSION_YEAR=2013 20 | ) else if "%VS_VERSION_MAJOR%" == "14" ( 21 | set VS_VERSION_YEAR=2015 22 | ) else if "%VS_VERSION_MAJOR%" == "15" ( 23 | set VS_VERSION_YEAR=2017 24 | ) else if "%VS_VERSION_MAJOR%" == "16" ( 25 | set VS_VERSION_YEAR=2019 26 | ) else if "%VS_VERSION_MAJOR%" == "17" ( 27 | set VS_VERSION_YEAR=2022 28 | ) else ( 29 | @echo Cannot use Visual Studio version %VS_VERSION_MAJOR% 30 | exit /b 1 31 | ) 32 | ) 33 | if not defined CMAKE_GENERATOR_PREFIX ( 34 | set CMAKE_GENERATOR_PREFIX=Visual Studio %VS_VERSION_MAJOR% %VS_VERSION_YEAR% 35 | ) 36 | 37 | @rem CONFIGURATION is (one of the entries) defined in appveyor.yml 38 | if not defined CONFIGURATION ( 39 | set CONFIGURATION=Release 40 | ) 41 | @rem PLATFORM is (one of the entries) defined in appveyor.yml 42 | if "%PLATFORM%"=="x64" ( 43 | set BIT_COUNT=64 44 | ) else ( 45 | set BIT_COUNT=32 46 | ) 47 | 48 | set BOOST_LIBRARYDIR=%BOOST_ROOT%\lib%BIT_COUNT%-msvc-%VS_VERSION_MAJOR%.0 49 | 50 | set START_DIR=%CD% 51 | 52 | if not exist build\NUL mkdir build 53 | cd build 54 | 55 | if "%~1" == "test" ( 56 | @rem overloading the batch script; Run tests if the first argument is `test` (without quotes). 57 | @rem Cereal uses Boost Unit test framework. Rather than modifying the code to load boost test 58 | @rem dll from its location OR copying the boost dlls to the directory of every test being run, 59 | @rem we use another option Windows leaves us - modify the PATH. 60 | for %%i in (ctest.exe) do set CTEST_EXE=%%~$PATH:i 61 | PATH %BOOST_LIBRARYDIR% 62 | "!CTEST_EXE!" -C %CONFIGURATION% 63 | if %errorlevel% neq 0 exit /b %errorlevel% 64 | goto done 65 | ) 66 | 67 | if "%PLATFORM%" == "x64" ( 68 | @rem please excuse the hack - CMake is unable to produce multiarch MSVC projects 69 | cmake -G "%CMAKE_GENERATOR_PREFIX%" -DBOOST_ROOT=%BOOST_ROOT% -DBOOST_LIBRARYDIR=%BOOST_LIBRARYDIR% .. 70 | cmake --build . --config %CONFIGURATION% --target portability_test32 71 | del CMakeCache.txt 72 | rmdir /s /q CMakeFiles 73 | ) 74 | 75 | cmake -G "%CMAKE_GENERATOR_PREFIX%" -A %PLATFORM% -DBOOST_ROOT=%BOOST_ROOT% -DBOOST_LIBRARYDIR=%BOOST_LIBRARYDIR% .. 76 | @rem left the actual build for later - AppVeyor enables parallel jobs in a much cleaner way than msbuild 77 | 78 | :done 79 | @REM go back home 80 | cd %START_DIR% 81 | -------------------------------------------------------------------------------- /third/cereal/include/cereal/external/rapidxml/license.txt: -------------------------------------------------------------------------------- 1 | Use of this software is granted under one of the following two licenses, 2 | to be chosen freely by the user. 3 | 4 | 1. Boost Software License - Version 1.0 - August 17th, 2003 5 | =============================================================================== 6 | 7 | Copyright (c) 2006, 2007 Marcin Kalicinski 8 | 9 | Permission is hereby granted, free of charge, to any person or organization 10 | obtaining a copy of the software and accompanying documentation covered by 11 | this license (the "Software") to use, reproduce, display, distribute, 12 | execute, and transmit the Software, and to prepare derivative works of the 13 | Software, and to permit third-parties to whom the Software is furnished to 14 | do so, all subject to the following: 15 | 16 | The copyright notices in the Software and this entire statement, including 17 | the above license grant, this restriction and the following disclaimer, 18 | must be included in all copies of the Software, in whole or in part, and 19 | all derivative works of the Software, unless such copies or derivative 20 | works are solely in the form of machine-executable object code generated by 21 | a source language processor. 22 | 23 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 24 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 25 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 26 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 27 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 28 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 29 | DEALINGS IN THE SOFTWARE. 30 | 31 | 2. The MIT License 32 | =============================================================================== 33 | 34 | Copyright (c) 2006, 2007 Marcin Kalicinski 35 | 36 | Permission is hereby granted, free of charge, to any person obtaining a copy 37 | of this software and associated documentation files (the "Software"), to deal 38 | in the Software without restriction, including without limitation the rights 39 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 40 | of the Software, and to permit persons to whom the Software is furnished to do so, 41 | subject to the following conditions: 42 | 43 | The above copyright notice and this permission notice shall be included in all 44 | copies or substantial portions of the Software. 45 | 46 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 47 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 48 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 49 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 50 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 51 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 52 | IN THE SOFTWARE. 53 | -------------------------------------------------------------------------------- /third/cereal/unittests/memory.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014, Randolph Voorhies, Shane Grant 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in the 11 | documentation and/or other materials provided with the distribution. 12 | * Neither the name of the copyright holder nor the 13 | names of its contributors may be used to endorse or promote products 14 | derived from this software without specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY 20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | #define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN 28 | #include "memory.hpp" 29 | 30 | TEST_SUITE_BEGIN("memory"); 31 | 32 | TEST_CASE("binary_memory") 33 | { 34 | test_memory(); 35 | } 36 | 37 | TEST_CASE("portable_binary_memory") 38 | { 39 | test_memory(); 40 | } 41 | 42 | TEST_CASE("xml_memory") 43 | { 44 | test_memory(); 45 | } 46 | 47 | TEST_CASE("json_memory") 48 | { 49 | test_memory(); 50 | } 51 | 52 | TEST_CASE("binary_default_construction") 53 | { 54 | test_default_construction(); 55 | } 56 | 57 | TEST_CASE("portable_binary_default_construction") 58 | { 59 | test_default_construction(); 60 | } 61 | 62 | TEST_CASE("xml_default_construction") 63 | { 64 | test_default_construction(); 65 | } 66 | 67 | TEST_CASE("json_default_construction") 68 | { 69 | test_default_construction(); 70 | } 71 | 72 | TEST_SUITE_END(); 73 | -------------------------------------------------------------------------------- /third/cereal/unittests/structs.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014, Randolph Voorhies, Shane Grant 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in the 11 | documentation and/or other materials provided with the distribution. 12 | * Neither the name of the copyright holder nor the 13 | names of its contributors may be used to endorse or promote products 14 | derived from this software without specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY 20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | #ifndef CEREAL_TEST_STRUCTS_H_ 28 | #define CEREAL_TEST_STRUCTS_H_ 29 | #include "common.hpp" 30 | 31 | template inline 32 | void test_structs() 33 | { 34 | std::random_device rd; 35 | std::mt19937 gen(rd()); 36 | 37 | for(int ii=0; ii<100; ++ii) 38 | { 39 | StructInternalSerialize o_iser = { random_value(gen), random_value(gen) }; 40 | StructInternalSplit o_ispl = { random_value(gen), random_value(gen) }; 41 | StructExternalSerialize o_eser = { random_value(gen), random_value(gen) }; 42 | StructExternalSplit o_espl = { random_value(gen), random_value(gen) }; 43 | 44 | std::ostringstream os; 45 | { 46 | OArchive oar(os); 47 | oar( o_iser, o_ispl, o_eser, o_espl); 48 | } 49 | 50 | StructInternalSerialize i_iser; 51 | StructInternalSplit i_ispl; 52 | StructExternalSerialize i_eser; 53 | StructExternalSplit i_espl; 54 | 55 | std::istringstream is(os.str()); 56 | { 57 | IArchive iar(is); 58 | iar( i_iser, i_ispl, i_eser, i_espl); 59 | } 60 | 61 | CHECK_EQ(i_iser, o_iser); 62 | CHECK_EQ(i_ispl, o_ispl); 63 | CHECK_EQ(i_eser, o_eser); 64 | CHECK_EQ(i_espl, o_espl); 65 | } 66 | } 67 | 68 | #endif // CEREAL_TEST_STRUCTS_H_ 69 | -------------------------------------------------------------------------------- /third/cereal/unittests/cpp17/variant.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2015, Kyle Fleming, Juan Pedro Bolivar Puente 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in the 11 | documentation and/or other materials provided with the distribution. 12 | * Neither the name of the copyright holder nor the 13 | names of its contributors may be used to endorse or promote products 14 | derived from this software without specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY 20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #ifndef CEREAL_TEST_CPP17_VARIANT_H_ 29 | #define CEREAL_TEST_CPP17_VARIANT_H_ 30 | #include "../common.hpp" 31 | 32 | #ifdef CEREAL_HAS_CPP17 33 | 34 | #include 35 | 36 | template inline 37 | void test_std_variant() 38 | { 39 | std::random_device rd; 40 | std::mt19937 gen(rd()); 41 | 42 | std::variant o_bv1 = random_value(gen); 43 | std::variant o_bv2 = random_value(gen); 44 | std::variant o_bv3 = random_basic_string(gen); 45 | 46 | std::ostringstream os; 47 | { 48 | OArchive oar(os); 49 | 50 | oar(o_bv1); 51 | oar(o_bv2); 52 | oar(o_bv3); 53 | } 54 | 55 | decltype(o_bv1) i_bv1; 56 | decltype(o_bv2) i_bv2; 57 | decltype(o_bv3) i_bv3; 58 | 59 | std::istringstream is(os.str()); 60 | { 61 | IArchive iar(is); 62 | 63 | iar(i_bv1); 64 | iar(i_bv2); 65 | iar(i_bv3); 66 | } 67 | 68 | CHECK_EQ( std::get(i_bv1), std::get(o_bv1) ); 69 | CHECK_EQ( std::get(i_bv2), doctest::Approx(std::get(o_bv2)).epsilon(1e-5) ); 70 | CHECK_EQ( std::get(i_bv3), std::get(o_bv3) ); 71 | } 72 | 73 | #endif // CEREAL_HAS_CPP17 74 | #endif // CEREAL_TEST_CPP17_VARIANT_H_ 75 | -------------------------------------------------------------------------------- /third/cereal/unittests/versioning.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014, Randolph Voorhies, Shane Grant 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in the 11 | documentation and/or other materials provided with the distribution. 12 | * Neither the name of the copyright holder nor the 13 | names of its contributors may be used to endorse or promote products 14 | derived from this software without specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY 20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | #define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN 28 | #include "versioning.hpp" 29 | 30 | TEST_SUITE_BEGIN("versioning"); 31 | 32 | TEST_CASE("binary_versioning") 33 | { 34 | test_versioning(); 35 | } 36 | 37 | TEST_CASE("portable_binary_versioning") 38 | { 39 | test_versioning(); 40 | } 41 | 42 | TEST_CASE("xml_versioning") 43 | { 44 | test_versioning(); 45 | } 46 | 47 | TEST_CASE("json_versioning") 48 | { 49 | test_versioning(); 50 | } 51 | 52 | #if CEREAL_THREAD_SAFE 53 | TEST_CASE("binary_versioning_threading") 54 | { 55 | test_versioning_threading(); 56 | } 57 | 58 | TEST_CASE("portable_binary_versioning_threading") 59 | { 60 | test_versioning_threading(); 61 | } 62 | 63 | TEST_CASE("xml_versioning_threading") 64 | { 65 | test_versioning_threading(); 66 | } 67 | 68 | TEST_CASE("json_versioning_threading") 69 | { 70 | test_versioning_threading(); 71 | } 72 | #endif // CEREAL_THREAD_SAFE 73 | 74 | TEST_SUITE_END(); 75 | -------------------------------------------------------------------------------- /third/cereal/include/cereal/external/rapidjson/memorystream.h: -------------------------------------------------------------------------------- 1 | // Tencent is pleased to support the open source community by making RapidJSON available. 2 | // 3 | // Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip. All rights reserved. 4 | // 5 | // Licensed under the MIT License (the "License"); you may not use this file except 6 | // in compliance with the License. You may obtain a copy of the License at 7 | // 8 | // http://opensource.org/licenses/MIT 9 | // 10 | // Unless required by applicable law or agreed to in writing, software distributed 11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the 13 | // specific language governing permissions and limitations under the License. 14 | 15 | #ifndef CEREAL_RAPIDJSON_MEMORYSTREAM_H_ 16 | #define CEREAL_RAPIDJSON_MEMORYSTREAM_H_ 17 | 18 | #include "stream.h" 19 | 20 | #ifdef __clang__ 21 | CEREAL_RAPIDJSON_DIAG_PUSH 22 | CEREAL_RAPIDJSON_DIAG_OFF(unreachable-code) 23 | CEREAL_RAPIDJSON_DIAG_OFF(missing-noreturn) 24 | #endif 25 | 26 | CEREAL_RAPIDJSON_NAMESPACE_BEGIN 27 | 28 | //! Represents an in-memory input byte stream. 29 | /*! 30 | This class is mainly for being wrapped by EncodedInputStream or AutoUTFInputStream. 31 | 32 | It is similar to FileReadBuffer but the source is an in-memory buffer instead of a file. 33 | 34 | Differences between MemoryStream and StringStream: 35 | 1. StringStream has encoding but MemoryStream is a byte stream. 36 | 2. MemoryStream needs size of the source buffer and the buffer don't need to be null terminated. StringStream assume null-terminated string as source. 37 | 3. MemoryStream supports Peek4() for encoding detection. StringStream is specified with an encoding so it should not have Peek4(). 38 | \note implements Stream concept 39 | */ 40 | struct MemoryStream { 41 | typedef char Ch; // byte 42 | 43 | MemoryStream(const Ch *src, size_t size) : src_(src), begin_(src), end_(src + size), size_(size) {} 44 | 45 | Ch Peek() const { return CEREAL_RAPIDJSON_UNLIKELY(src_ == end_) ? '\0' : *src_; } 46 | Ch Take() { return CEREAL_RAPIDJSON_UNLIKELY(src_ == end_) ? '\0' : *src_++; } 47 | size_t Tell() const { return static_cast(src_ - begin_); } 48 | 49 | Ch* PutBegin() { CEREAL_RAPIDJSON_ASSERT(false); return 0; } 50 | void Put(Ch) { CEREAL_RAPIDJSON_ASSERT(false); } 51 | void Flush() { CEREAL_RAPIDJSON_ASSERT(false); } 52 | size_t PutEnd(Ch*) { CEREAL_RAPIDJSON_ASSERT(false); return 0; } 53 | 54 | // For encoding detection only. 55 | const Ch* Peek4() const { 56 | return Tell() + 4 <= size_ ? src_ : 0; 57 | } 58 | 59 | const Ch* src_; //!< Current read position. 60 | const Ch* begin_; //!< Original head of the string. 61 | const Ch* end_; //!< End of stream. 62 | size_t size_; //!< Size of the stream. 63 | }; 64 | 65 | CEREAL_RAPIDJSON_NAMESPACE_END 66 | 67 | #ifdef __clang__ 68 | CEREAL_RAPIDJSON_DIAG_POP 69 | #endif 70 | 71 | #endif // CEREAL_RAPIDJSON_MEMORYBUFFER_H_ 72 | -------------------------------------------------------------------------------- /third/cereal/unittests/polymorphic.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014, Randolph Voorhies, Shane Grant 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in the 11 | documentation and/or other materials provided with the distribution. 12 | * Neither the name of the copyright holder nor the 13 | names of its contributors may be used to endorse or promote products 14 | derived from this software without specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY 20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | #define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN 28 | #include "polymorphic.hpp" 29 | 30 | TEST_SUITE_BEGIN("polymorphic"); 31 | 32 | TEST_CASE("binary_polymorphic") 33 | { 34 | test_polymorphic(); 35 | } 36 | 37 | TEST_CASE("portable_binary_polymorphic") 38 | { 39 | test_polymorphic(); 40 | } 41 | 42 | TEST_CASE("xml_polymorphic") 43 | { 44 | test_polymorphic(); 45 | } 46 | 47 | TEST_CASE("json_polymorphic") 48 | { 49 | test_polymorphic(); 50 | } 51 | 52 | #if CEREAL_THREAD_SAFE 53 | TEST_CASE("binary_polymorphic_threading") 54 | { 55 | test_polymorphic_threading(); 56 | } 57 | 58 | TEST_CASE("portable_binary_polymorphic_threading") 59 | { 60 | test_polymorphic_threading(); 61 | } 62 | 63 | TEST_CASE("xml_polymorphic_threading") 64 | { 65 | test_polymorphic_threading(); 66 | } 67 | 68 | TEST_CASE("json_polymorphic_threading") 69 | { 70 | test_polymorphic_threading(); 71 | } 72 | #endif // CEREAL_THREAD_SAFE 73 | 74 | TEST_SUITE_END(); 75 | -------------------------------------------------------------------------------- /third/cereal/include/cereal/types/forward_list.hpp: -------------------------------------------------------------------------------- 1 | /*! \file forward_list.hpp 2 | \brief Support for types found in \ 3 | \ingroup STLSupport */ 4 | /* 5 | Copyright (c) 2014, Randolph Voorhies, Shane Grant 6 | All rights reserved. 7 | 8 | Redistribution and use in source and binary forms, with or without 9 | modification, are permitted provided that the following conditions are met: 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in the 14 | documentation and/or other materials provided with the distribution. 15 | * Neither the name of the copyright holder nor the 16 | names of its contributors may be used to endorse or promote products 17 | derived from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 20 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 21 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY 23 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 26 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | #ifndef CEREAL_TYPES_FORWARD_LIST_HPP_ 31 | #define CEREAL_TYPES_FORWARD_LIST_HPP_ 32 | 33 | #include "cereal/cereal.hpp" 34 | #include 35 | 36 | namespace cereal 37 | { 38 | //! Saving for std::forward_list all other types 39 | template inline 40 | void CEREAL_SAVE_FUNCTION_NAME( Archive & ar, std::forward_list const & forward_list ) 41 | { 42 | // write the size - note that this is slow because we need to traverse 43 | // the entire list. there are ways we could avoid this but this was chosen 44 | // since it works in the most general fashion with any archive type 45 | size_type const size = std::distance( forward_list.begin(), forward_list.end() ); 46 | 47 | ar( make_size_tag( size ) ); 48 | 49 | // write the list 50 | for( const auto & i : forward_list ) 51 | ar( i ); 52 | } 53 | 54 | //! Loading for std::forward_list all other types from 55 | template 56 | void CEREAL_LOAD_FUNCTION_NAME( Archive & ar, std::forward_list & forward_list ) 57 | { 58 | size_type size; 59 | ar( make_size_tag( size ) ); 60 | 61 | forward_list.resize( static_cast( size ) ); 62 | 63 | for( auto & i : forward_list ) 64 | ar( i ); 65 | } 66 | } // namespace cereal 67 | 68 | #endif // CEREAL_TYPES_FORWARD_LIST_HPP_ 69 | -------------------------------------------------------------------------------- /third/cereal/include/cereal/types/string.hpp: -------------------------------------------------------------------------------- 1 | /*! \file string.hpp 2 | \brief Support for types found in \ 3 | \ingroup STLSupport */ 4 | /* 5 | Copyright (c) 2014, Randolph Voorhies, Shane Grant 6 | All rights reserved. 7 | 8 | Redistribution and use in source and binary forms, with or without 9 | modification, are permitted provided that the following conditions are met: 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in the 14 | documentation and/or other materials provided with the distribution. 15 | * Neither the name of the copyright holder nor the 16 | names of its contributors may be used to endorse or promote products 17 | derived from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 20 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 21 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY 23 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 26 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | #ifndef CEREAL_TYPES_STRING_HPP_ 31 | #define CEREAL_TYPES_STRING_HPP_ 32 | 33 | #include "cereal/cereal.hpp" 34 | #include 35 | 36 | namespace cereal 37 | { 38 | //! Serialization for basic_string types, if binary data is supported 39 | template inline 40 | typename std::enable_if, Archive>::value, void>::type 41 | CEREAL_SAVE_FUNCTION_NAME(Archive & ar, std::basic_string const & str) 42 | { 43 | // Save number of chars + the data 44 | ar( make_size_tag( static_cast(str.size()) ) ); 45 | ar( binary_data( str.data(), str.size() * sizeof(CharT) ) ); 46 | } 47 | 48 | //! Serialization for basic_string types, if binary data is supported 49 | template inline 50 | typename std::enable_if, Archive>::value, void>::type 51 | CEREAL_LOAD_FUNCTION_NAME(Archive & ar, std::basic_string & str) 52 | { 53 | size_type size; 54 | ar( make_size_tag( size ) ); 55 | str.resize(static_cast(size)); 56 | ar( binary_data( const_cast( str.data() ), static_cast(size) * sizeof(CharT) ) ); 57 | } 58 | } // namespace cereal 59 | 60 | #endif // CEREAL_TYPES_STRING_HPP_ 61 | 62 | -------------------------------------------------------------------------------- /third/cereal/include/cereal/details/polymorphic_impl_fwd.hpp: -------------------------------------------------------------------------------- 1 | /*! \file polymorphic_impl_fwd.hpp 2 | \brief Internal polymorphism support forward declarations 3 | \ingroup Internal */ 4 | /* 5 | Copyright (c) 2014, Randolph Voorhies, Shane Grant 6 | All rights reserved. 7 | 8 | Redistribution and use in source and binary forms, with or without 9 | modification, are permitted provided that the following conditions are met: 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in the 14 | documentation and/or other materials provided with the distribution. 15 | * Neither the name of the copyright holder nor the 16 | names of its contributors may be used to endorse or promote products 17 | derived from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 20 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 21 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY 23 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 26 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | /* This code is heavily inspired by the boost serialization implementation by the following authors 32 | 33 | (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . 34 | Use, modification and distribution is subject to the Boost Software 35 | License, Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt) 36 | 37 | See http://www.boost.org for updates, documentation, and revision history. 38 | 39 | (C) Copyright 2006 David Abrahams - http://www.boost.org. 40 | 41 | See /boost/serialization/export.hpp and /boost/archive/detail/register_archive.hpp for their 42 | implementation. 43 | */ 44 | 45 | #ifndef CEREAL_DETAILS_POLYMORPHIC_IMPL_FWD_HPP_ 46 | #define CEREAL_DETAILS_POLYMORPHIC_IMPL_FWD_HPP_ 47 | 48 | namespace cereal 49 | { 50 | namespace detail 51 | { 52 | //! Forward declaration, see polymorphic_impl.hpp for more information 53 | template 54 | struct RegisterPolymorphicCaster; 55 | 56 | //! Forward declaration, see polymorphic_impl.hpp for more information 57 | struct PolymorphicCasters; 58 | 59 | //! Forward declaration, see polymorphic_impl.hpp for more information 60 | template 61 | struct PolymorphicRelation; 62 | } // namespace detail 63 | } // namespace cereal 64 | 65 | #endif // CEREAL_DETAILS_POLYMORPHIC_IMPL_FWD_HPP_ 66 | -------------------------------------------------------------------------------- /third/cereal/include/cereal/types/chrono.hpp: -------------------------------------------------------------------------------- 1 | /*! \file chrono.hpp 2 | \brief Support for types found in \ 3 | \ingroup STLSupport */ 4 | /* 5 | Copyright (c) 2014, Randolph Voorhies, Shane Grant 6 | All rights reserved. 7 | 8 | Redistribution and use in source and binary forms, with or without 9 | modification, are permitted provided that the following conditions are met: 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in the 14 | documentation and/or other materials provided with the distribution. 15 | * Neither the name of the copyright holder nor the 16 | names of its contributors may be used to endorse or promote products 17 | derived from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 20 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 21 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY 23 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 26 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | #ifndef CEREAL_TYPES_CHRONO_HPP_ 31 | #define CEREAL_TYPES_CHRONO_HPP_ 32 | 33 | #include 34 | 35 | namespace cereal 36 | { 37 | //! Saving std::chrono::duration 38 | template inline 39 | void CEREAL_SAVE_FUNCTION_NAME( Archive & ar, std::chrono::duration const & dur ) 40 | { 41 | ar( CEREAL_NVP_("count", dur.count()) ); 42 | } 43 | 44 | //! Loading std::chrono::duration 45 | template inline 46 | void CEREAL_LOAD_FUNCTION_NAME( Archive & ar, std::chrono::duration & dur ) 47 | { 48 | R count; 49 | ar( CEREAL_NVP_("count", count) ); 50 | 51 | dur = std::chrono::duration{count}; 52 | } 53 | 54 | //! Saving std::chrono::time_point 55 | template inline 56 | void CEREAL_SAVE_FUNCTION_NAME( Archive & ar, std::chrono::time_point const & dur ) 57 | { 58 | ar( CEREAL_NVP_("time_since_epoch", dur.time_since_epoch()) ); 59 | } 60 | 61 | //! Loading std::chrono::time_point 62 | template inline 63 | void CEREAL_LOAD_FUNCTION_NAME( Archive & ar, std::chrono::time_point & dur ) 64 | { 65 | D elapsed; 66 | ar( CEREAL_NVP_("time_since_epoch", elapsed) ); 67 | 68 | dur = std::chrono::time_point{elapsed}; 69 | } 70 | } // namespace cereal 71 | 72 | #endif // CEREAL_TYPES_CHRONO_HPP_ 73 | -------------------------------------------------------------------------------- /third/cereal/include/cereal/types/stack.hpp: -------------------------------------------------------------------------------- 1 | /*! \file stack.hpp 2 | \brief Support for types found in \ 3 | \ingroup STLSupport */ 4 | /* 5 | Copyright (c) 2014, Randolph Voorhies, Shane Grant 6 | All rights reserved. 7 | 8 | Redistribution and use in source and binary forms, with or without 9 | modification, are permitted provided that the following conditions are met: 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in the 14 | documentation and/or other materials provided with the distribution. 15 | * Neither the name of the copyright holder nor the 16 | names of its contributors may be used to endorse or promote products 17 | derived from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 20 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 21 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY 23 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 26 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | #ifndef CEREAL_TYPES_STACK_HPP_ 31 | #define CEREAL_TYPES_STACK_HPP_ 32 | 33 | #include "cereal/cereal.hpp" 34 | #include 35 | 36 | // The default container for stack is deque, so let's include that too 37 | #include "cereal/types/deque.hpp" 38 | 39 | namespace cereal 40 | { 41 | namespace stack_detail 42 | { 43 | //! Allows access to the protected container in stack 44 | template inline 45 | C const & container( std::stack const & stack ) 46 | { 47 | struct H : public std::stack 48 | { 49 | static C const & get( std::stack const & s ) 50 | { 51 | return s.*(&H::c); 52 | } 53 | }; 54 | 55 | return H::get( stack ); 56 | } 57 | } 58 | 59 | //! Saving for std::stack 60 | template inline 61 | void CEREAL_SAVE_FUNCTION_NAME( Archive & ar, std::stack const & stack ) 62 | { 63 | ar( CEREAL_NVP_("container", stack_detail::container( stack )) ); 64 | } 65 | 66 | //! Loading for std::stack 67 | template inline 68 | void CEREAL_LOAD_FUNCTION_NAME( Archive & ar, std::stack & stack ) 69 | { 70 | C container; 71 | ar( CEREAL_NVP_("container", container) ); 72 | stack = std::stack( std::move( container ) ); 73 | } 74 | } // namespace cereal 75 | 76 | #endif // CEREAL_TYPES_STACK_HPP_ 77 | -------------------------------------------------------------------------------- /third/cereal/README.md: -------------------------------------------------------------------------------- 1 | cereal - A C++11 library for serialization 2 | ========================================== 3 | 4 |

cereal is a header-only C++11 serialization library. cereal takes arbitrary data types and reversibly turns them into different representations, such as compact binary encodings, XML, or JSON. cereal was designed to be fast, light-weight, and easy to extend - it has no external dependencies and can be easily bundled with other code or used standalone.

5 | 6 | ### cereal has great documentation 7 | 8 | Looking for more information on how cereal works and its documentation? Visit [cereal's web page](https://USCiLab.github.io/cereal) to get the latest information. 9 | 10 | ### cereal is easy to use 11 | 12 | Installation and use of of cereal is fully documented on the [main web page](https://USCiLab.github.io/cereal), but this is a quick and dirty version: 13 | 14 | * Download cereal and place the headers somewhere your code can see them 15 | * Write serialization functions for your custom types or use the built in support for the standard library cereal provides 16 | * Use the serialization archives to load and save data 17 | 18 | ```cpp 19 | #include 20 | #include 21 | #include 22 | #include 23 | 24 | struct MyRecord 25 | { 26 | uint8_t x, y; 27 | float z; 28 | 29 | template 30 | void serialize( Archive & ar ) 31 | { 32 | ar( x, y, z ); 33 | } 34 | }; 35 | 36 | struct SomeData 37 | { 38 | int32_t id; 39 | std::shared_ptr> data; 40 | 41 | template 42 | void save( Archive & ar ) const 43 | { 44 | ar( data ); 45 | } 46 | 47 | template 48 | void load( Archive & ar ) 49 | { 50 | static int32_t idGen = 0; 51 | id = idGen++; 52 | ar( data ); 53 | } 54 | }; 55 | 56 | int main() 57 | { 58 | std::ofstream os("out.cereal", std::ios::binary); 59 | cereal::BinaryOutputArchive archive( os ); 60 | 61 | SomeData myData; 62 | archive( myData ); 63 | 64 | return 0; 65 | } 66 | ``` 67 | 68 | ### cereal has a mailing list 69 | 70 | Either get in touch over email or [on the web](https://groups.google.com/forum/#!forum/cerealcpp). 71 | 72 | 73 | 74 | ## cereal has a permissive license 75 | 76 | cereal is licensed under the [BSD license](http://opensource.org/licenses/BSD-3-Clause). 77 | 78 | ## cereal build status 79 | 80 | * [![Linux build status](https://github.com/USCiLab/cereal/actions/workflows/ci.yml/badge.svg)](https://github.com/USCiLab/cereal/actions/workflows/ci.yml) 81 | * [![Mac build status](https://github.com/USCiLab/cereal/actions/workflows/ci-macos.yml/badge.svg)](https://github.com/USCiLab/cereal/actions/workflows/ci-macos.yml) 82 | * [![Windows build status](https://ci.appveyor.com/api/projects/status/91aou6smj36or0vb/branch/master?svg=true)](https://ci.appveyor.com/project/AzothAmmo/cereal/branch/master) 83 | 84 | --- 85 | 86 | Were you looking for the Haskell cereal? Go here. 87 | -------------------------------------------------------------------------------- /third/cereal/unittests/complex.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014, Randolph Voorhies, Shane Grant 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in the 11 | documentation and/or other materials provided with the distribution. 12 | * Neither the name of the copyright holder nor the 13 | names of its contributors may be used to endorse or promote products 14 | derived from this software without specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY 20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | #ifndef CEREAL_TEST_COMPLEX_H_ 28 | #define CEREAL_TEST_COMPLEX_H_ 29 | #include "common.hpp" 30 | 31 | template inline 32 | void test_complex() 33 | { 34 | std::random_device rd; 35 | std::mt19937 gen(rd()); 36 | 37 | auto rngF = [&](){ return random_value(gen); }; 38 | auto rngD = [&](){ return random_value(gen); }; 39 | auto rngLD = [&](){ return random_value(gen); }; 40 | 41 | for(int ii=0; ii<100; ++ii) 42 | { 43 | std::complex o_float( rngF(), rngF() ); 44 | std::complex o_double( rngD(), rngD() ); 45 | std::complex o_ldouble( rngLD(), rngLD() ); 46 | 47 | std::ostringstream os; 48 | { 49 | OArchive oar(os); 50 | 51 | oar(o_float); 52 | oar(o_double); 53 | oar(o_ldouble); 54 | } 55 | 56 | std::complex i_float; 57 | std::complex i_double; 58 | std::complex i_ldouble; 59 | 60 | std::istringstream is(os.str()); 61 | { 62 | IArchive iar(is); 63 | 64 | iar(i_float); 65 | iar(i_double); 66 | iar(i_ldouble); 67 | } 68 | 69 | CHECK_EQ( o_float, i_float ); 70 | CHECK_EQ( o_double.real(), doctest::Approx(i_double.real()).epsilon(1e-5) ); 71 | CHECK_EQ( o_double.imag(), doctest::Approx(i_double.imag()).epsilon(1e-5) ); 72 | CHECK_EQ( o_ldouble.real(), doctest::Approx(i_ldouble.real()).epsilon(1e-5L) ); 73 | CHECK_EQ( o_ldouble.imag(), doctest::Approx(i_ldouble.imag()).epsilon(1e-5L) ); 74 | } 75 | } 76 | 77 | #endif // CEREAL_TEST_COMPLEX_H_ 78 | -------------------------------------------------------------------------------- /third/cereal/include/cereal/details/util.hpp: -------------------------------------------------------------------------------- 1 | /*! \file util.hpp 2 | \brief Internal misc utilities 3 | \ingroup Internal */ 4 | /* 5 | Copyright (c) 2014, Randolph Voorhies, Shane Grant 6 | All rights reserved. 7 | 8 | Redistribution and use in source and binary forms, with or without 9 | modification, are permitted provided that the following conditions are met: 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in the 14 | documentation and/or other materials provided with the distribution. 15 | * Neither the name of the copyright holder nor the 16 | names of its contributors may be used to endorse or promote products 17 | derived from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 20 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 21 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY 23 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 26 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | #ifndef CEREAL_DETAILS_UTIL_HPP_ 31 | #define CEREAL_DETAILS_UTIL_HPP_ 32 | 33 | #include 34 | #include 35 | 36 | #ifdef _MSC_VER 37 | namespace cereal 38 | { 39 | namespace util 40 | { 41 | //! Demangles the type encoded in a string 42 | /*! @internal */ 43 | inline std::string demangle( std::string const & name ) 44 | { return name; } 45 | 46 | //! Gets the demangled name of a type 47 | /*! @internal */ 48 | template inline 49 | std::string demangledName() 50 | { return typeid( T ).name(); } 51 | } // namespace util 52 | } // namespace cereal 53 | #else // clang or gcc 54 | #include 55 | #include 56 | namespace cereal 57 | { 58 | namespace util 59 | { 60 | //! Demangles the type encoded in a string 61 | /*! @internal */ 62 | inline std::string demangle(std::string mangledName) 63 | { 64 | int status = 0; 65 | char *demangledName = nullptr; 66 | std::size_t len; 67 | 68 | demangledName = abi::__cxa_demangle(mangledName.c_str(), 0, &len, &status); 69 | 70 | std::string retName(demangledName); 71 | free(demangledName); 72 | 73 | return retName; 74 | } 75 | 76 | //! Gets the demangled name of a type 77 | /*! @internal */ 78 | template inline 79 | std::string demangledName() 80 | { return demangle(typeid(T).name()); } 81 | } 82 | } // namespace cereal 83 | #endif // clang or gcc branch of _MSC_VER 84 | #endif // CEREAL_DETAILS_UTIL_HPP_ 85 | -------------------------------------------------------------------------------- /tests/integration/test_insert_query_workflow.py: -------------------------------------------------------------------------------- 1 | """Integration tests for insert → query workflow.""" 2 | import numpy as np 3 | import pytest 4 | 5 | from python_prtree import PRTree2D, PRTree3D, PRTree4D 6 | 7 | 8 | @pytest.mark.parametrize("PRTree, dim", [(PRTree2D, 2), (PRTree3D, 3), (PRTree4D, 4)]) 9 | def test_incremental_insert_and_query(PRTree, dim): 10 | """Integration test: incremental insert with queries.""" 11 | tree = PRTree() 12 | 13 | n = 100 14 | boxes = [] 15 | 16 | for i in range(n): 17 | box = np.random.rand(2 * dim) * 100 18 | for d in range(dim): 19 | box[d + dim] += box[d] + 1 20 | 21 | tree.insert(idx=i, bb=box) 22 | boxes.append(box) 23 | 24 | # Query after each insert 25 | result = tree.query(box) 26 | assert i in result 27 | assert tree.size() == i + 1 28 | 29 | # Final comprehensive query 30 | for i, box in enumerate(boxes): 31 | result = tree.query(box) 32 | assert i in result 33 | 34 | 35 | @pytest.mark.parametrize("PRTree, dim", [(PRTree2D, 2), (PRTree3D, 3), (PRTree4D, 4)]) 36 | def test_insert_with_objects_and_query(PRTree, dim): 37 | """Integration test: insert with objects and query.""" 38 | tree = PRTree() 39 | 40 | n = 50 41 | objects = [] 42 | 43 | for i in range(n): 44 | box = np.random.rand(2 * dim) * 100 45 | for d in range(dim): 46 | box[d + dim] += box[d] + 1 47 | 48 | obj = {"id": i, "name": f"item_{i}", "data": [i, i * 2, i * 3]} 49 | tree.insert(bb=box, obj=obj) 50 | objects.append((box, obj)) 51 | 52 | # Query and verify objects (return_obj=True returns objects directly, not tuples) 53 | for i, (box, expected_obj) in enumerate(objects): 54 | result_obj = tree.query(box, return_obj=True) 55 | found = False 56 | for item in result_obj: 57 | if item == expected_obj: 58 | found = True 59 | break 60 | # Object retrieval should return the inserted object 61 | assert len(result_obj) > 0 62 | assert found, f"Expected object {expected_obj} not found in results" 63 | 64 | 65 | @pytest.mark.parametrize("PRTree, dim", [(PRTree2D, 2), (PRTree3D, 3), (PRTree4D, 4)]) 66 | def test_mixed_bulk_and_incremental_insert(PRTree, dim): 67 | """Test mixed bulk and incremental insert.""" 68 | np.random.seed(42) 69 | n_bulk = 50 70 | n_incremental = 50 71 | 72 | # Bulk insert 73 | idx_bulk = np.arange(n_bulk) 74 | boxes_bulk = np.random.rand(n_bulk, 2 * dim) * 100 75 | for i in range(dim): 76 | boxes_bulk[:, i + dim] += boxes_bulk[:, i] + 1 77 | 78 | tree = PRTree(idx_bulk, boxes_bulk) 79 | 80 | # Incremental insert 81 | for i in range(n_incremental): 82 | idx = n_bulk + i 83 | box = np.random.rand(2 * dim) * 100 84 | for d in range(dim): 85 | box[d + dim] += box[d] + 1 86 | 87 | tree.insert(idx=idx, bb=box) 88 | 89 | assert tree.size() == n_bulk + n_incremental 90 | 91 | # Query all 92 | query_box = np.zeros(2 * dim) 93 | for d in range(dim): 94 | query_box[d] = -10.0 95 | query_box[d + dim] = 110.0 96 | 97 | result = tree.query(query_box) 98 | assert len(result) == n_bulk + n_incremental 99 | --------------------------------------------------------------------------------