Last active
September 2, 2020 08:05
-
-
Save Yashwants19/5552e01c35ca12f795c647b5844fc0c6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.ci/linux-steps.yaml | 2 +- | |
.ci/macos-steps.yaml | 2 +- | |
.github/workflows/main.yml | 4 +- | |
CMake/Findcereal.cmake | 63 ++- | |
CMake/R/ConfigureRCPP.cmake | 8 +- | |
CMakeLists.txt | 3 +- | |
README.md | 1 + | |
src/mlpack/bindings/R/CMakeLists.txt | 44 +- | |
src/mlpack/bindings/R/mlpack/DESCRIPTION.in | 3 +- | |
.../bindings/R/mlpack/inst/include/mlpack.h.in | 23 +- | |
src/mlpack/bindings/R/mlpack/src/Makevars.win | 2 +- | |
.../src/boost/serialization/archive_exception.cpp | 154 ------ | |
.../src/boost/serialization/basic_archive.cpp | 93 ---- | |
.../src/boost/serialization/basic_iarchive.cpp | 601 --------------------- | |
.../src/boost/serialization/basic_iserializer.cpp | 34 -- | |
.../src/boost/serialization/basic_oarchive.cpp | 470 ---------------- | |
.../src/boost/serialization/basic_oserializer.cpp | 34 -- | |
.../serialization/basic_pointer_iserializer.cpp | 31 -- | |
.../serialization/basic_pointer_oserializer.cpp | 31 -- | |
.../boost/serialization/basic_serializer_map.cpp | 112 ---- | |
.../boost/serialization/basic_text_oprimitive.cpp | 29 - | |
.../src/boost/serialization/binary_iarchive.cpp | 40 -- | |
.../src/boost/serialization/binary_oarchive.cpp | 38 -- | |
.../src/boost/serialization/extended_type_info.cpp | 196 ------- | |
.../serialization/extended_type_info_typeid.cpp | 167 ------ | |
.../src/boost/serialization/utf8_codecvt_facet.cpp | 22 - | |
.../R/mlpack/src/boost/serialization/variant.hpp | 178 ------ | |
.../R/mlpack/src/boost/serialization/void_cast.cpp | 382 ------------- | |
src/mlpack/bindings/R/mlpack/src/rcpp_mlpack.h | 2 + | |
src/mlpack/core/cereal/is_loading.hpp | 8 +- | |
src/mlpack/core/cereal/is_saving.hpp | 6 +- | |
src/mlpack/core/data/load_model_impl.hpp | 3 +- | |
src/mlpack/core/data/save_impl.hpp | 2 + | |
33 files changed, 77 insertions(+), 2711 deletions(-) | |
diff --git a/.ci/linux-steps.yaml b/.ci/linux-steps.yaml | |
index 7a3720d1e..ad5bef434 100644 | |
--- a/.ci/linux-steps.yaml | |
+++ b/.ci/linux-steps.yaml | |
@@ -39,7 +39,7 @@ steps: | |
sudo apt-get -y update | |
sudo apt-get install -y r-base-core | |
fi | |
- sudo Rscript -e "install.packages(c('Rcpp', 'RcppArmadillo', 'RcppEnsmallen', 'BH', 'roxygen2', 'testthat'))" | |
+ sudo Rscript -e "install.packages(c('Rcpp', 'RcppArmadillo', 'RcppEnsmallen', 'BH', 'roxygen2', 'testthat', 'Rcereal'))" | |
fi | |
# Install armadillo. | |
diff --git a/.ci/macos-steps.yaml b/.ci/macos-steps.yaml | |
index f9503d62f..bdd2eaedb 100644 | |
--- a/.ci/macos-steps.yaml | |
+++ b/.ci/macos-steps.yaml | |
@@ -30,7 +30,7 @@ steps: | |
brew cask install r | |
fi | |
brew cask install gfortran | |
- Rscript -e "install.packages(c('Rcpp', 'RcppArmadillo', 'RcppEnsmallen', 'BH', 'roxygen2', 'testthat'), repos = 'http://cran.us.r-project.org')" | |
+ Rscript -e "install.packages(c('Rcpp', 'RcppArmadillo', 'RcppEnsmallen', 'BH', 'roxygen2', 'testthat', 'Rcereal'), repos = 'http://cran.us.r-project.org')" | |
fi | |
git clone --depth 1 https://github.com/mlpack/jenkins-conf.git conf | |
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml | |
index 8a4790897..5f8e7ba15 100644 | |
--- a/.github/workflows/main.yml | |
+++ b/.github/workflows/main.yml | |
@@ -36,7 +36,7 @@ jobs: | |
sudo add-apt-repository 'deb https://cloud.r-project.org/bin/linux/ubuntu xenial-cran40/' | |
sudo apt-get -y update | |
sudo apt-get install -y r-base-core | |
- sudo Rscript -e "install.packages(c('Rcpp', 'RcppArmadillo', 'RcppEnsmallen', 'BH', 'roxygen2', 'testthat'))" | |
+ sudo Rscript -e "install.packages(c('Rcpp', 'RcppArmadillo', 'RcppEnsmallen', 'BH', 'roxygen2', 'testthat', 'Rcereal'))" | |
- name: CMake | |
run: | | |
@@ -89,7 +89,7 @@ jobs: | |
- name: Install dependencies | |
run: | | |
Rscript -e "install.packages('remotes')" -e "remotes::install_cran('rcmdcheck')" | |
- Rscript -e "install.packages(c('Rcpp', 'RcppArmadillo', 'RcppEnsmallen', 'BH', 'roxygen2', 'testthat'))" | |
+ Rscript -e "install.packages(c('Rcpp', 'RcppArmadillo', 'RcppEnsmallen', 'BH', 'roxygen2', 'testthat', 'Rcereal'))" | |
- name: Check | |
run: Rscript -e "rcmdcheck::rcmdcheck('${{ needs.jobR.outputs.r_bindings }}', args = c('--no-manual','--as-cran'), error_on = 'warning', check_dir = 'check')" | |
diff --git a/CMake/Findcereal.cmake b/CMake/Findcereal.cmake | |
index 313c1581c..faf1ff10d 100644 | |
--- a/CMake/Findcereal.cmake | |
+++ b/CMake/Findcereal.cmake | |
@@ -1,33 +1,40 @@ | |
-# This file is orignially written by: | |
-# https://github.com/facebookresearch/flashlight | |
- | |
-# Try to find Cereal | |
-# | |
-# Sets the following variables: | |
-# CEREAL_FOUND | |
-# CEREAL_INCLUDE_DIRS - directories with Cereal headers | |
-# CEREAL_DEFINITIONS - Cereal compiler flags | |
- | |
-find_path(cereal_header_paths_tmp | |
- NAMES | |
- cereal.hpp | |
- PATH_SUFFIXES | |
- include | |
- cereal/include | |
- PATHS | |
- ${CEREAL_ROOT_DIR} | |
- ${CEREAL_ROOT_DIR}/include | |
- ${CEREAL_ROOT_DIR}/cereal/include | |
- $ENV{CEREAL_ROOT_DIR} | |
- $ENV{CEREAL_ROOT_DIR}/include | |
- $ENV{CEREAL_ROOT_DIR}/cereal | |
- ) | |
- | |
-get_filename_component(cereal_INCLUDE_DIRS ${cereal_header_paths_tmp} PATH) | |
+#Findcereal.cmake | |
+find_path(CEREAL_INCLUDE_DIRS | |
+ NAMES cereal | |
+ PATHS "$ENV{ProgramFiles}/cereal/include" | |
+ ) | |
+ | |
+if(CEREAL_INCLUDE_DIRS) | |
+ # ------------------------------------------------------------------------ | |
+ # Extract version information from <CEREAL> | |
+ # ------------------------------------------------------------------------ | |
+ | |
+ set(CEREAL_VERSION_MAJOR 0) | |
+ set(CEREAL_VERSION_MINOR 0) | |
+ set(CEREAL_VERSION_PATCH 0) | |
+ | |
+ if(EXISTS "${CEREAL_INCLUDE_DIRS}/cereal/version.hpp") | |
+ | |
+ set(CEREAL_FOUND YES) | |
+ | |
+ # Read and parse cereal version header file for version number | |
+ file(READ "${CEREAL_INCLUDE_DIRS}/cereal/version.hpp" | |
+ _CEREAL_HEADER_CONTENTS) | |
+ string(REGEX REPLACE ".*#define CEREAL_VERSION_MAJOR ([0-9]+).*" "\\1" | |
+ CEREAL_VERSION_MAJOR "${_CEREAL_HEADER_CONTENTS}") | |
+ string(REGEX REPLACE ".*#define CEREAL_VERSION_MINOR ([0-9]+).*" "\\1" | |
+ CEREAL_VERSION_MINOR "${_CEREAL_HEADER_CONTENTS}") | |
+ string(REGEX REPLACE ".*#define CEREAL_VERSION_PATCH ([0-9]+).*" "\\1" | |
+ CEREAL_VERSION_PATCH "${_CEREAL_HEADER_CONTENTS}") | |
+ endif() | |
+ | |
+ set(CEREAL_VERSION_STRING "${CEREAL_VERSION_MAJOR}.${CEREAL_VERSION_MINOR}.${CEREAL_VERSION_PATCH}") | |
+endif () | |
include(FindPackageHandleStandardArgs) | |
find_package_handle_standard_args(cereal | |
- REQUIRED_VARS cereal_INCLUDE_DIRS | |
+ REQUIRED_VARS CEREAL_INCLUDE_DIRS | |
+ VERSION_VAR CEREAL_VERSION_STRING | |
) | |
-mark_as_advanced(cereal_FOUND) | |
+mark_as_advanced(CEREAL_INCLUDE_DIRS) | |
diff --git a/CMake/R/ConfigureRCPP.cmake b/CMake/R/ConfigureRCPP.cmake | |
index 8b3e8ef3b..2ab696402 100644 | |
--- a/CMake/R/ConfigureRCPP.cmake | |
+++ b/CMake/R/ConfigureRCPP.cmake | |
@@ -54,8 +54,8 @@ Rcpp::RawVector Serialize${MODEL_SAFE_TYPE}Ptr(SEXP ptr) | |
{ | |
std::ostringstream oss; | |
{ | |
- boost::archive::binary_oarchive oa(oss); | |
- oa << boost::serialization::make_nvp(\"${MODEL_SAFE_TYPE}\", | |
+ cereal::BinaryOutputArchive oa(oss); | |
+ oa << cereal::make_nvp(\"${MODEL_SAFE_TYPE}\", | |
*Rcpp::as<${MODEL_PTR_TYPEDEF}>(ptr)); | |
} | |
@@ -76,8 +76,8 @@ SEXP Deserialize${MODEL_SAFE_TYPE}Ptr(Rcpp::RawVector str) | |
std::istringstream iss(std::string((char *) &str[0], str.size())); | |
{ | |
- boost::archive::binary_iarchive ia(iss); | |
- ia >> boost::serialization::make_nvp(\"${MODEL_SAFE_TYPE}\", *ptr); | |
+ cereal::BinaryInputArchive ia(iss); | |
+ ia >> cereal::make_nvp(\"${MODEL_SAFE_TYPE}\", *ptr); | |
} | |
// R will be responsible for freeing this. | |
diff --git a/CMakeLists.txt b/CMakeLists.txt | |
index d2ddb3109..d6f369bdb 100644 | |
--- a/CMakeLists.txt | |
+++ b/CMakeLists.txt | |
@@ -22,6 +22,7 @@ option(BUILD_GO_SHLIB "Build Go shared library." OFF) | |
set(ARMADILLO_VERSION "8.400.0") | |
set(ENSMALLEN_VERSION "2.10.0") | |
set(BOOST_VERSION "1.58") | |
+set(CEREAL_VERSION "1.1.2") | |
if (WIN32) | |
option(BUILD_SHARED_LIBS | |
@@ -412,7 +413,7 @@ else () | |
set(MLPACK_INCLUDE_DIRS ${MLPACK_INCLUDE_DIRS} "${ENSMALLEN_INCLUDE_DIR}") | |
endif () | |
-find_package(cereal 1.3.0) | |
+find_package(cereal "${CEREAL_VERSION}" REQUIRED) | |
# Unfortunately this configuration variable is necessary and will need to be | |
# updated as time goes on and new versions are released. | |
diff --git a/README.md b/README.md | |
index 4e5cc4aaa..ace4310b9 100644 | |
--- a/README.md | |
+++ b/README.md | |
@@ -134,6 +134,7 @@ installed with these R packages. | |
RcppEnsmallen >= 0.2.10.0 | |
BH >= 1.58 | |
roxygen2 | |
+ Rcereal >= 1.1.2 | |
If the STB library headers are available, image loading support will be | |
compiled. | |
diff --git a/src/mlpack/bindings/R/CMakeLists.txt b/src/mlpack/bindings/R/CMakeLists.txt | |
index 18ac878ac..98325b48a 100644 | |
--- a/src/mlpack/bindings/R/CMakeLists.txt | |
+++ b/src/mlpack/bindings/R/CMakeLists.txt | |
@@ -23,6 +23,7 @@ if (BUILD_R_BINDINGS) | |
set(RcppArmadillo_Version "0.${ARMADILLO_VERSION}") | |
set(RcppEnsmallen_Version "0.${ENSMALLEN_VERSION}") | |
set(BH_Version "${BOOST_VERSION}") | |
+ set(Rcereal_Version "${CEREAL_VERSION}") | |
# Import find_r_module. | |
include(${CMAKE_SOURCE_DIR}/CMake/FindRModule.cmake) | |
@@ -54,18 +55,22 @@ if (BUILD_R_BINDINGS) | |
if (NOT R_TESTTHAT) | |
set(R_NOT_FOUND_MSG "${R_NOT_FOUND_MSG}\n - testthat") | |
endif () | |
+ find_r_module(Rcereal "${Rcereal_Version}") | |
+ if (NOT R_RCEREAL) | |
+ set(R_NOT_FOUND_MSG "${R_NOT_FOUND_MSG}\n - Rcereal") | |
+ endif () | |
## We need to check here if R and other dependencies is even available, as | |
## it is require to build R-bindings. | |
if (FORCE_BUILD_R_BINDINGS) | |
if (NOT R_FOUND OR NOT R_RCPP OR NOT R_RCPPARMADILLO OR NOT R_RCPPENSMALLEN | |
- OR NOT R_BH OR NOT R_ROXYGEN2 OR NOT R_TESTTHAT) | |
+ OR NOT R_BH OR NOT R_ROXYGEN2 OR NOT R_TESTTHAT OR NOT R_RCEREAL) | |
unset(BUILD_R_BINDINGS CACHE) | |
message(FATAL_ERROR "Could not Build R Bindings, Following modules are not available:${R_NOT_FOUND_MSG}") | |
endif() | |
else () | |
if (NOT R_FOUND OR NOT R_RCPP OR NOT R_RCPPARMADILLO OR NOT R_RCPPENSMALLEN | |
- OR NOT R_BH OR NOT R_ROXYGEN2 OR NOT R_TESTTHAT) | |
+ OR NOT R_BH OR NOT R_ROXYGEN2 OR NOT R_TESTTHAT OR NOT R_RCEREAL) | |
unset(BUILD_R_BINDINGS CACHE) | |
not_found_return("Not building R bindings, Following modules are not available:${R_NOT_FOUND_MSG}") | |
endif() | |
@@ -97,33 +102,6 @@ if (BUILD_R_BINDINGS) | |
"# Generated by roxygen2: do not edit by hand" | |
"\n\n") | |
- # These are all the files we need to compile R bindings for mlpack that are | |
- # not a part of mlpack itself. | |
- # Soon may be mlpack use cereal package for serialization. | |
- # Then we can remove these boost files. | |
- set(BOOST_SOURCES | |
- "${CMAKE_SOURCE_DIR}/src/mlpack/core/boost_backport/unordered_map.hpp" | |
- "${CMAKE_SOURCE_DIR}/src/mlpack/core/boost_backport/unordered_collections_load_imp.hpp" | |
- "${CMAKE_SOURCE_DIR}/src/mlpack/core/boost_backport/unordered_collections_save_imp.hpp" | |
- "${CMAKE_CURRENT_SOURCE_DIR}/mlpack/src/boost/serialization/archive_exception.cpp" | |
- "${CMAKE_CURRENT_SOURCE_DIR}/mlpack/src/boost/serialization/basic_archive.cpp" | |
- "${CMAKE_CURRENT_SOURCE_DIR}/mlpack/src/boost/serialization/basic_oarchive.cpp" | |
- "${CMAKE_CURRENT_SOURCE_DIR}/mlpack/src/boost/serialization/basic_oserializer.cpp" | |
- "${CMAKE_CURRENT_SOURCE_DIR}/mlpack/src/boost/serialization/basic_iarchive.cpp" | |
- "${CMAKE_CURRENT_SOURCE_DIR}/mlpack/src/boost/serialization/basic_iserializer.cpp" | |
- "${CMAKE_CURRENT_SOURCE_DIR}/mlpack/src/boost/serialization/basic_pointer_iserializer.cpp" | |
- "${CMAKE_CURRENT_SOURCE_DIR}/mlpack/src/boost/serialization/basic_pointer_oserializer.cpp" | |
- "${CMAKE_CURRENT_SOURCE_DIR}/mlpack/src/boost/serialization/basic_text_oprimitive.cpp" | |
- "${CMAKE_CURRENT_SOURCE_DIR}/mlpack/src/boost/serialization/basic_serializer_map.cpp" | |
- "${CMAKE_CURRENT_SOURCE_DIR}/mlpack/src/boost/serialization/binary_iarchive.cpp" | |
- "${CMAKE_CURRENT_SOURCE_DIR}/mlpack/src/boost/serialization/binary_oarchive.cpp" | |
- "${CMAKE_CURRENT_SOURCE_DIR}/mlpack/src/boost/serialization/extended_type_info_typeid.cpp" | |
- "${CMAKE_CURRENT_SOURCE_DIR}/mlpack/src/boost/serialization/extended_type_info.cpp" | |
- "${CMAKE_CURRENT_SOURCE_DIR}/mlpack/src/boost/serialization/utf8_codecvt_facet.cpp" | |
- "${CMAKE_CURRENT_SOURCE_DIR}/mlpack/src/boost/serialization/void_cast.cpp" | |
- "${CMAKE_CURRENT_SOURCE_DIR}/mlpack/src/boost/serialization/variant.hpp" | |
- ) | |
- | |
set(CPP_SOURCES | |
"${CMAKE_CURRENT_SOURCE_DIR}/mlpack/src/r_util.cpp" | |
"${CMAKE_CURRENT_SOURCE_DIR}/mlpack/src/rcpp_mlpack.h" | |
@@ -174,8 +152,6 @@ if (BUILD_R_BINDINGS) | |
${CMAKE_CURRENT_BINARY_DIR}/mlpack/R/ | |
COMMAND ${CMAKE_COMMAND} -E make_directory | |
${CMAKE_CURRENT_BINARY_DIR}/mlpack/tests/testthat | |
- COMMAND ${CMAKE_COMMAND} -E make_directory | |
- ${CMAKE_CURRENT_BINARY_DIR}/mlpack/src/boost/serialization/ | |
COMMAND ${CMAKE_COMMAND} -E make_directory | |
${CMAKE_CURRENT_BINARY_DIR}/mlpack/src/mlpack/bindings/R/tests | |
) | |
@@ -188,12 +164,6 @@ if (BUILD_R_BINDINGS) | |
endif() | |
# Copy all necessary files for building package. | |
- foreach(boost_file ${BOOST_SOURCES}) | |
- add_custom_command(TARGET r_copy PRE_BUILD | |
- COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different | |
- ${boost_file} | |
- ${CMAKE_CURRENT_BINARY_DIR}/mlpack/src/boost/serialization/) | |
- endforeach() | |
foreach(cpp_file ${CPP_SOURCES}) | |
add_custom_command(TARGET r_copy PRE_BUILD | |
COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different | |
diff --git a/src/mlpack/bindings/R/mlpack/DESCRIPTION.in b/src/mlpack/bindings/R/mlpack/DESCRIPTION.in | |
index 9183f6bb6..db9890f5d 100644 | |
--- a/src/mlpack/bindings/R/mlpack/DESCRIPTION.in | |
+++ b/src/mlpack/bindings/R/mlpack/DESCRIPTION.in | |
@@ -15,7 +15,8 @@ Imports: Rcpp (>= 0.12.12) | |
LinkingTo: Rcpp, | |
RcppArmadillo (>= @RcppArmadillo_Version@), | |
BH (>= @BH_Version@), | |
- RcppEnsmallen (>= @RcppEnsmallen_Version@) | |
+ RcppEnsmallen (>= @RcppEnsmallen_Version@), | |
+ Rcereal (>= @Rcereal_Version@) | |
Suggests: testthat (>= 2.1.0) | |
URL: https://www.mlpack.org/doc/mlpack-@PACKAGE_VERSION@/r_documentation.html, | |
https://github.com/mlpack/mlpack | |
diff --git a/src/mlpack/bindings/R/mlpack/inst/include/mlpack.h.in b/src/mlpack/bindings/R/mlpack/inst/include/mlpack.h.in | |
index a2c17842d..9f4b360a9 100644 | |
--- a/src/mlpack/bindings/R/mlpack/inst/include/mlpack.h.in | |
+++ b/src/mlpack/bindings/R/mlpack/inst/include/mlpack.h.in | |
@@ -14,6 +14,10 @@ | |
#include <Rcpp.h> | |
+#define BINDING_TYPE BINDING_TYPE_R | |
+ | |
+#define CEREAL_ARCHIVES_JSON_HPP_ | |
+ | |
// To suppress Found ‘__assert_fail’, possibly from ‘assert’ (C). | |
#define BOOST_DISABLE_ASSERTS | |
@@ -45,25 +49,6 @@ | |
#include <mlpack/core.hpp> | |
-// These are all the boost files, we need to compile R bindings for mlpack that | |
-// are not a part of mlpack itself. | |
-#include <boost/serialization/archive_exception.cpp> | |
-#include <boost/serialization/basic_archive.cpp> | |
-#include <boost/serialization/basic_oarchive.cpp> | |
-#include <boost/serialization/basic_oserializer.cpp> | |
-#include <boost/serialization/basic_iarchive.cpp> | |
-#include <boost/serialization/basic_iserializer.cpp> | |
-#include <boost/serialization/basic_pointer_iserializer.cpp> | |
-#include <boost/serialization/basic_pointer_oserializer.cpp> | |
-#include <boost/serialization/basic_text_oprimitive.cpp> | |
-#include <boost/serialization/binary_iarchive.cpp> | |
-#include <boost/serialization/binary_oarchive.cpp> | |
-#include <boost/serialization/extended_type_info_typeid.cpp> | |
-#include <boost/serialization/extended_type_info.cpp> | |
-#include <boost/serialization/basic_serializer_map.cpp> | |
-#include <boost/serialization/void_cast.cpp> | |
-#include <boost/serialization/utf8_codecvt_facet.cpp> | |
- | |
#undef ARMA_EXTRA_MAT_PROTO | |
#undef ARMA_EXTRA_MAT_MEAT | |
diff --git a/src/mlpack/bindings/R/mlpack/src/Makevars.win b/src/mlpack/bindings/R/mlpack/src/Makevars.win | |
index 4cca03b1a..bb6a88cc8 100644 | |
--- a/src/mlpack/bindings/R/mlpack/src/Makevars.win | |
+++ b/src/mlpack/bindings/R/mlpack/src/Makevars.win | |
@@ -1,3 +1,3 @@ | |
-PKG_CXXFLAGS = -DBOOST_MATH_PROMOTE_DOUBLE_POLICY=false -I. $(SHLIB_OPENMP_CXXFLAGS) -ftrack-macro-expansion=0 | |
+PKG_CXXFLAGS = -DBOOST_MATH_PROMOTE_DOUBLE_POLICY=false -I. $(SHLIB_OPENMP_CXXFLAGS) | |
PKG_LIBS = $(SHLIB_OPENMP_CXXFLAGS) $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) | |
CXX_STD = CXX11 | |
diff --git a/src/mlpack/bindings/R/mlpack/src/boost/serialization/archive_exception.cpp b/src/mlpack/bindings/R/mlpack/src/boost/serialization/archive_exception.cpp | |
deleted file mode 100644 | |
index 729a4edb2..000000000 | |
--- a/src/mlpack/bindings/R/mlpack/src/boost/serialization/archive_exception.cpp | |
+++ /dev/null | |
@@ -1,154 +0,0 @@ | |
-/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 | |
-// archive_exception.cpp: | |
- | |
-// (C) Copyright 2009 Robert Ramey - http://www.rrsd.com . | |
-// Use, modification and distribution is subject to the Boost Software | |
-// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at | |
-// http://www.boost.org/LICENSE_1_0.txt) | |
- | |
-// See http://www.boost.org for updates, documentation, and revision history. | |
- | |
-#if (defined _MSC_VER) && (_MSC_VER == 1200) | |
-# pragma warning (disable : 4786) // too long name, harmless warning | |
-#endif | |
- | |
-#include <exception> | |
-#include <string> | |
-#include <cstring> | |
- | |
-#define BOOST_ARCHIVE_SOURCE | |
-#include <boost/serialization/config.hpp> | |
-#include <boost/archive/archive_exception.hpp> | |
- | |
-namespace boost { | |
-namespace archive { | |
- | |
-BOOST_ARCHIVE_DECL | |
-unsigned int | |
-archive_exception::append(unsigned int l, const char * a){ | |
- while(l < (sizeof(m_buffer) - 1)){ | |
- char c = *a++; | |
- if('\0' == c) | |
- break; | |
- m_buffer[l++] = c; | |
- } | |
- m_buffer[l] = '\0'; | |
- return l; | |
-} | |
- | |
-BOOST_ARCHIVE_DECL | |
-archive_exception::archive_exception( | |
- exception_code c, | |
- const char * e1, | |
- const char * e2 | |
-) BOOST_NOEXCEPT : | |
- code(c) | |
-{ | |
- unsigned int length = 0; | |
- switch(code){ | |
- case no_exception: | |
- length = append(length, "uninitialized exception"); | |
- break; | |
- case unregistered_class: | |
- length = append(length, "unregistered class"); | |
- if(NULL != e1){ | |
- length = append(length, " - "); | |
- length = append(length, e1); | |
- } | |
- break; | |
- case invalid_signature: | |
- length = append(length, "invalid signature"); | |
- break; | |
- case unsupported_version: | |
- length = append(length, "unsupported version"); | |
- break; | |
- case pointer_conflict: | |
- length = append(length, "pointer conflict"); | |
- break; | |
- case incompatible_native_format: | |
- length = append(length, "incompatible native format"); | |
- if(NULL != e1){ | |
- length = append(length, " - "); | |
- length = append(length, e1); | |
- } | |
- break; | |
- case array_size_too_short: | |
- length = append(length, "array size too short"); | |
- break; | |
- case input_stream_error: | |
- length = append(length, "input stream error"); | |
- if(NULL != e1){ | |
- length = append(length, "-"); | |
- length = append(length, e1); | |
- } | |
- if(NULL != e2){ | |
- length = append(length, "-"); | |
- length = append(length, e2); | |
- } | |
- break; | |
- case invalid_class_name: | |
- length = append(length, "class name too long"); | |
- break; | |
- case unregistered_cast: | |
- length = append(length, "unregistered void cast "); | |
- length = append(length, (NULL != e1) ? e1 : "?"); | |
- length = append(length, "<-"); | |
- length = append(length, (NULL != e2) ? e2 : "?"); | |
- break; | |
- case unsupported_class_version: | |
- length = append(length, "class version "); | |
- length = append(length, (NULL != e1) ? e1 : "<unknown class>"); | |
- break; | |
- case other_exception: | |
- // if get here - it indicates a derived exception | |
- // was sliced by passing by value in catch | |
- length = append(length, "unknown derived exception"); | |
- break; | |
- case multiple_code_instantiation: | |
- length = append(length, "code instantiated in more than one module"); | |
- if(NULL != e1){ | |
- length = append(length, " - "); | |
- length = append(length, e1); | |
- } | |
- break; | |
- case output_stream_error: | |
- length = append(length, "output stream error"); | |
- if(NULL != e1){ | |
- length = append(length, "-"); | |
- length = append(length, e1); | |
- } | |
- if(NULL != e2){ | |
- length = append(length, "-"); | |
- length = append(length, e2); | |
- } | |
- break; | |
- default: | |
- BOOST_ASSERT(false); | |
- length = append(length, "programming error"); | |
- break; | |
- } | |
-} | |
- | |
-BOOST_ARCHIVE_DECL | |
-archive_exception::archive_exception(archive_exception const & oth) BOOST_NOEXCEPT : | |
- std::exception(oth), | |
- code(oth.code) | |
-{ | |
- std::memcpy(m_buffer,oth.m_buffer,sizeof m_buffer); | |
-} | |
- | |
-BOOST_ARCHIVE_DECL | |
-archive_exception::~archive_exception() BOOST_NOEXCEPT_OR_NOTHROW {} | |
- | |
-BOOST_ARCHIVE_DECL const char * | |
-archive_exception::what() const BOOST_NOEXCEPT_OR_NOTHROW { | |
- return m_buffer; | |
-} | |
- | |
-BOOST_ARCHIVE_DECL | |
-archive_exception::archive_exception() BOOST_NOEXCEPT : | |
- code(no_exception) | |
-{} | |
- | |
-} // archive | |
-} // boost | |
diff --git a/src/mlpack/bindings/R/mlpack/src/boost/serialization/basic_archive.cpp b/src/mlpack/bindings/R/mlpack/src/boost/serialization/basic_archive.cpp | |
deleted file mode 100644 | |
index 0649388bf..000000000 | |
--- a/src/mlpack/bindings/R/mlpack/src/boost/serialization/basic_archive.cpp | |
+++ /dev/null | |
@@ -1,93 +0,0 @@ | |
-/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 | |
-// basic_archive.cpp: | |
- | |
-// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . | |
-// Use, modification and distribution is subject to the Boost Software | |
-// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at | |
-// http://www.boost.org/LICENSE_1_0.txt) | |
- | |
-// See http://www.boost.org for updates, documentation, and revision history. | |
- | |
-////////////////////////////////////////////////////////////////////// | |
-// | |
-// objects are stored as | |
-// | |
-// class_id* // -1 for a null pointer | |
-// if a new class id | |
-// [ | |
-// exported key - class name* | |
-// tracking level - always/never | |
-// class version | |
-// ] | |
-// | |
-// if tracking | |
-// [ | |
-// object_id | |
-// ] | |
-// | |
-// [ // if a new object id | |
-// data... | |
-// ] | |
-// | |
-// * required only for pointers - optional for objects | |
- | |
-#define BOOST_ARCHIVE_SOURCE | |
-#include <boost/serialization/config.hpp> | |
-#include <boost/archive/basic_archive.hpp> | |
- | |
-namespace boost { | |
-namespace archive { | |
- | |
-/////////////////////////////////////////////////////////////////////// | |
-// constants used in archive signature | |
-//This should never ever change. note that is not an std::string | |
-// string. | |
-BOOST_SYMBOL_VISIBLE const char * | |
-BOOST_ARCHIVE_SIGNATURE(){ | |
- return "serialization::archive"; | |
-} | |
- | |
-// this should change if the capabilities are added to the library | |
-// such that archives can be created which can't be read by previous | |
-// versions of this library | |
-// 1 - initial version | |
-// 2 - made address tracking optional | |
-// 3 - numerous changes - can't guarentee compatibility with previous versions | |
-// 4 - Boost 1.34 | |
-// added item_version to properly support versioning for collections | |
-// 5 - Boost 1.36 | |
-// changed serialization of collections: adding version even for primitive | |
-// types caused backwards compatibility breaking change in 1.35 | |
-// 6 - Boost 1.41 17 Nov 2009 | |
-// serializing collection sizes as std::size_t | |
-// 7 Boost 1.42 2 Feb 2010 | |
-// error - changed binary version to 16 bits w/o changing library version # | |
-// That is - binary archives are recorded with #6 even though they are | |
-// different from the previous versions. This means that binary archives | |
-// created with versions 1.42 and 1.43 will have to be fixed with a special | |
-// program which fixes the library version # in the header | |
-// Boost 1.43 6 May 2010 | |
-// no change | |
-// 8 - Boost 1.44 | |
-// separated version_type into library_version_type and class_version_type | |
-// changed version_type to be stored as 8 bits. | |
-// 10- fixed base64 output/input. | |
-// 11- not changes | |
-// 12- improved serialization of collections | |
-// 13- simplified visibility, removed Borland, removed pfto | |
-// 14- improved visibility, refactor map/set | |
-// 15- corrections to optional and collection loading | |
-// 16- eliminated dependency on <codecvt> which is buggy in some libraries | |
-// and now officially deprecated in the standard | |
-// 17- Boost 1.68 August 2018 | |
-// 18- addressed undefined behavior in archive constuctors. | |
-// init() called from base wrote archive header before archive | |
-// was fully constructed. | |
- | |
-BOOST_SYMBOL_VISIBLE library_version_type | |
-BOOST_ARCHIVE_VERSION(){ | |
- return library_version_type(18); | |
-} | |
- | |
-} // namespace archive | |
-} // namespace boost | |
diff --git a/src/mlpack/bindings/R/mlpack/src/boost/serialization/basic_iarchive.cpp b/src/mlpack/bindings/R/mlpack/src/boost/serialization/basic_iarchive.cpp | |
deleted file mode 100644 | |
index 344e37a30..000000000 | |
--- a/src/mlpack/bindings/R/mlpack/src/boost/serialization/basic_iarchive.cpp | |
+++ /dev/null | |
@@ -1,601 +0,0 @@ | |
-/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 | |
-// basic_archive.cpp: | |
- | |
-// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . | |
-// Use, modification and distribution is subject to the Boost Software | |
-// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at | |
-// http://www.boost.org/LICENSE_1_0.txt) | |
- | |
-// See http://www.boost.org for updates, documentation, and revision history. | |
- | |
-#include <boost/config.hpp> // msvc 6.0 needs this to suppress warnings | |
- | |
-#include <boost/assert.hpp> | |
-#include <set> | |
-#include <list> | |
-#include <vector> | |
-#include <cstddef> // size_t, NULL | |
- | |
-#include <boost/config.hpp> | |
-#if defined(BOOST_NO_STDC_NAMESPACE) | |
-namespace std{ | |
- using ::size_t; | |
-} // namespace std | |
-#endif | |
- | |
-#include <boost/integer_traits.hpp> | |
- | |
-#define BOOST_ARCHIVE_SOURCE | |
-// include this to prevent linker errors when the | |
-// same modules are marked export and import. | |
-#define BOOST_SERIALIZATION_SOURCE | |
-#include <boost/serialization/config.hpp> | |
- | |
-#include <boost/serialization/state_saver.hpp> | |
-#include <boost/serialization/throw_exception.hpp> | |
-#include <boost/serialization/tracking.hpp> | |
- | |
-#include <boost/archive/archive_exception.hpp> | |
-#include <boost/archive/detail/decl.hpp> | |
-#include <boost/archive/basic_archive.hpp> | |
-#include <boost/archive/detail/basic_iserializer.hpp> | |
-#include <boost/archive/detail/basic_pointer_iserializer.hpp> | |
-#include <boost/archive/detail/basic_iarchive.hpp> | |
- | |
-#include <boost/archive/detail/auto_link_archive.hpp> | |
- | |
-using namespace boost::serialization; | |
- | |
-namespace boost { | |
-namespace archive { | |
-namespace detail { | |
- | |
-class basic_iarchive_impl { | |
- friend class basic_iarchive; | |
- library_version_type m_archive_library_version; | |
- unsigned int m_flags; | |
- | |
- ////////////////////////////////////////////////////////////////////// | |
- // information about each serialized object loaded | |
- // indexed on object_id | |
- struct aobject | |
- { | |
- void * address; | |
- bool loaded_as_pointer; | |
- class_id_type class_id; | |
- aobject( | |
- void *a, | |
- class_id_type class_id_ | |
- ) : | |
- address(a), | |
- loaded_as_pointer(false), | |
- class_id(class_id_) | |
- {} | |
- aobject() : | |
- address(NULL), | |
- loaded_as_pointer(false), | |
- class_id(-2) | |
- {} | |
- }; | |
- typedef std::vector<aobject> object_id_vector_type; | |
- object_id_vector_type object_id_vector; | |
- | |
- ////////////////////////////////////////////////////////////////////// | |
- // used to implement the reset_object_address operation. | |
- struct moveable_objects { | |
- object_id_type start; | |
- object_id_type end; | |
- object_id_type recent; | |
- bool is_pointer; | |
- moveable_objects() : | |
- start(0), | |
- end(0), | |
- recent(0), | |
- is_pointer(false) | |
- {} | |
- } m_moveable_objects; | |
- | |
- void reset_object_address( | |
- const void * new_address, | |
- const void *old_address | |
- ); | |
- | |
- ////////////////////////////////////////////////////////////////////// | |
- // used by load object to look up class id given basic_serializer | |
- struct cobject_type | |
- { | |
- const basic_iserializer * m_bis; | |
- const class_id_type m_class_id; | |
- cobject_type( | |
- std::size_t class_id, | |
- const basic_iserializer & bis | |
- ) : | |
- m_bis(& bis), | |
- m_class_id(class_id) | |
- {} | |
- cobject_type(const cobject_type & rhs) : | |
- m_bis(rhs.m_bis), | |
- m_class_id(rhs.m_class_id) | |
- {} | |
- // the following cannot be defined because of the const | |
- // member. This will generate a link error if an attempt | |
- // is made to assign. This should never be necessary | |
- cobject_type & operator=(const cobject_type & rhs); | |
- bool operator<(const cobject_type &rhs) const | |
- { | |
- return *m_bis < *(rhs.m_bis); | |
- } | |
- }; | |
- typedef std::set<cobject_type> cobject_info_set_type; | |
- cobject_info_set_type cobject_info_set; | |
- | |
- ////////////////////////////////////////////////////////////////////// | |
- // information about each serialized class indexed on class_id | |
- class cobject_id | |
- { | |
- public: | |
- cobject_id & operator=(const cobject_id & rhs){ | |
- bis_ptr = rhs.bis_ptr; | |
- bpis_ptr = rhs.bpis_ptr; | |
- file_version = rhs.file_version; | |
- tracking_level = rhs.tracking_level; | |
- initialized = rhs.initialized; | |
- return *this; | |
- } | |
- const basic_iserializer * bis_ptr; | |
- const basic_pointer_iserializer * bpis_ptr; | |
- version_type file_version; | |
- tracking_type tracking_level; | |
- bool initialized; | |
- | |
- cobject_id(const basic_iserializer & bis_) : | |
- bis_ptr(& bis_), | |
- bpis_ptr(NULL), | |
- file_version(0), | |
- tracking_level(track_never), | |
- initialized(false) | |
- {} | |
- cobject_id(const cobject_id &rhs): | |
- bis_ptr(rhs.bis_ptr), | |
- bpis_ptr(rhs.bpis_ptr), | |
- file_version(rhs.file_version), | |
- tracking_level(rhs.tracking_level), | |
- initialized(rhs.initialized) | |
- {} | |
- }; | |
- typedef std::vector<cobject_id> cobject_id_vector_type; | |
- cobject_id_vector_type cobject_id_vector; | |
- | |
- ////////////////////////////////////////////////////////////////////// | |
- // address of the most recent object serialized as a poiner | |
- // whose data itself is now pending serialization | |
- struct pending { | |
- void * object; | |
- const basic_iserializer * bis; | |
- version_type version; | |
- pending() : | |
- object(NULL), | |
- bis(NULL), | |
- version(0) | |
- {} | |
- } m_pending; | |
- | |
- basic_iarchive_impl(unsigned int flags) : | |
- m_archive_library_version(BOOST_ARCHIVE_VERSION()), | |
- m_flags(flags) | |
- {} | |
- void set_library_version(library_version_type archive_library_version){ | |
- m_archive_library_version = archive_library_version; | |
- } | |
- bool | |
- track( | |
- basic_iarchive & ar, | |
- void * & t | |
- ); | |
- void | |
- load_preamble( | |
- basic_iarchive & ar, | |
- cobject_id & co | |
- ); | |
- class_id_type register_type( | |
- const basic_iserializer & bis | |
- ); | |
- | |
- // redirect through virtual functions to load functions for this archive | |
- template<class T> | |
- void load(basic_iarchive & ar, T & t){ | |
- ar.vload(t); | |
- } | |
- | |
-//public: | |
- void | |
- next_object_pointer(void * t){ | |
- m_pending.object = t; | |
- } | |
- void delete_created_pointers(); | |
- class_id_type register_type( | |
- const basic_pointer_iserializer & bpis | |
- ); | |
- void load_object( | |
- basic_iarchive & ar, | |
- void * t, | |
- const basic_iserializer & bis | |
- ); | |
- const basic_pointer_iserializer * load_pointer( | |
- basic_iarchive & ar, | |
- void * & t, | |
- const basic_pointer_iserializer * bpis, | |
- const basic_pointer_iserializer * (*finder)( | |
- const boost::serialization::extended_type_info & type | |
- ) | |
- ); | |
-}; | |
- | |
-inline void | |
-basic_iarchive_impl::reset_object_address( | |
- void const * const new_address, | |
- void const * const old_address | |
-){ | |
- if(m_moveable_objects.is_pointer) | |
- return; | |
- | |
- // this code handles a couple of situations. | |
- // a) where reset_object_address is applied to an untracked object. | |
- // In such a case the call is really superfluous and its really an | |
- // an error. But we don't have access to the types here so we can't | |
- // know that. However, this code will effectively turn this situation | |
- // into a no-op and every thing will work fine - albeat with a small | |
- // execution time penalty. | |
- // b) where the call to reset_object_address doesn't immediatly follow | |
- // the << operator to which it corresponds. This would be a bad idea | |
- // but the code may work anyway. Naturally, a bad practice on the part | |
- // of the programmer but we can't detect it - as above. So maybe we | |
- // can save a few more people from themselves as above. | |
- object_id_type i = m_moveable_objects.recent; | |
- for(; i < m_moveable_objects.end; ++i){ | |
- if(old_address == object_id_vector[i].address) | |
- break; | |
- } | |
- for(; i < m_moveable_objects.end; ++i){ | |
- const aobject & ao = object_id_vector[i]; | |
- if(ao.loaded_as_pointer) | |
- continue; | |
- void const * const this_address = ao.address; | |
- // calculate displacement from this level | |
- // warning - pointer arithmetic on void * is in herently non-portable | |
- // but expected to work on all platforms in current usage | |
- if(this_address > old_address){ | |
- std::size_t member_displacement | |
- = reinterpret_cast<std::size_t>(this_address) | |
- - reinterpret_cast<std::size_t>(old_address); | |
- object_id_vector[i].address = reinterpret_cast<void *>( | |
- reinterpret_cast<std::size_t>(new_address) + member_displacement | |
- ); | |
- } | |
- else{ | |
- std::size_t member_displacement | |
- = reinterpret_cast<std::size_t>(old_address) | |
- - reinterpret_cast<std::size_t>(this_address); | |
- object_id_vector[i].address = reinterpret_cast<void *>( | |
- reinterpret_cast<std::size_t>(new_address) - member_displacement | |
- ); | |
- } | |
- } | |
-} | |
- | |
-inline void | |
-basic_iarchive_impl::delete_created_pointers() | |
-{ | |
- object_id_vector_type::iterator i; | |
- for( | |
- i = object_id_vector.begin(); | |
- i != object_id_vector.end(); | |
- ++i | |
- ){ | |
- if(i->loaded_as_pointer){ | |
- // borland complains without this minor hack | |
- const int j = i->class_id; | |
- const cobject_id & co = cobject_id_vector[j]; | |
- //const cobject_id & co = cobject_id_vector[i->class_id]; | |
- // with the appropriate input serializer, | |
- // delete the indicated object | |
- co.bis_ptr->destroy(i->address); | |
- } | |
- } | |
-} | |
- | |
-inline class_id_type | |
-basic_iarchive_impl::register_type( | |
- const basic_iserializer & bis | |
-){ | |
- class_id_type cid(cobject_info_set.size()); | |
- cobject_type co(cid, bis); | |
- std::pair<cobject_info_set_type::const_iterator, bool> | |
- result = cobject_info_set.insert(co); | |
- | |
- if(result.second){ | |
- cobject_id_vector.push_back(cobject_id(bis)); | |
- BOOST_ASSERT(cobject_info_set.size() == cobject_id_vector.size()); | |
- } | |
- cid = result.first->m_class_id; | |
- // borland complains without this minor hack | |
- const int tid = cid; | |
- cobject_id & coid = cobject_id_vector[tid]; | |
- coid.bpis_ptr = bis.get_bpis_ptr(); | |
- return cid; | |
-} | |
- | |
-void | |
-basic_iarchive_impl::load_preamble( | |
- basic_iarchive & ar, | |
- cobject_id & co | |
-){ | |
- if(! co.initialized){ | |
- if(co.bis_ptr->class_info()){ | |
- class_id_optional_type cid(class_id_type(0)); | |
- load(ar, cid); // to be thrown away | |
- load(ar, co.tracking_level); | |
- load(ar, co.file_version); | |
- } | |
- else{ | |
- // override tracking with indicator from class information | |
- co.tracking_level = co.bis_ptr->tracking(m_flags); | |
- co.file_version = version_type( | |
- co.bis_ptr->version() | |
- ); | |
- } | |
- co.initialized = true; | |
- } | |
-} | |
- | |
-bool | |
-basic_iarchive_impl::track( | |
- basic_iarchive & ar, | |
- void * & t | |
-){ | |
- object_id_type oid; | |
- load(ar, oid); | |
- | |
- // if its a reference to a old object | |
- if(object_id_type(object_id_vector.size()) > oid){ | |
- // we're done | |
- t = object_id_vector[oid].address; | |
- return false; | |
- } | |
- return true; | |
-} | |
- | |
-inline void | |
-basic_iarchive_impl::load_object( | |
- basic_iarchive & ar, | |
- void * t, | |
- const basic_iserializer & bis | |
-){ | |
- m_moveable_objects.is_pointer = false; | |
- serialization::state_saver<bool> ss_is_pointer(m_moveable_objects.is_pointer); | |
- // if its been serialized through a pointer and the preamble's been done | |
- if(t == m_pending.object && & bis == m_pending.bis){ | |
- // read data | |
- (bis.load_object_data)(ar, t, m_pending.version); | |
- return; | |
- } | |
- | |
- const class_id_type cid = register_type(bis); | |
- const int i = cid; | |
- cobject_id & co = cobject_id_vector[i]; | |
- | |
- load_preamble(ar, co); | |
- | |
- // save the current move stack position in case we want to truncate it | |
- boost::serialization::state_saver<object_id_type> ss_start(m_moveable_objects.start); | |
- | |
- // note: extra line used to evade borland issue | |
- const bool tracking = co.tracking_level; | |
- | |
- object_id_type this_id; | |
- m_moveable_objects.start = | |
- this_id = object_id_type(object_id_vector.size()); | |
- | |
- // if we tracked this object when the archive was saved | |
- if(tracking){ | |
- // if it was already read | |
- if(!track(ar, t)) | |
- // we're done | |
- return; | |
- // add a new enty into the tracking list | |
- object_id_vector.push_back(aobject(t, cid)); | |
- // and add an entry for this object | |
- m_moveable_objects.end = object_id_type(object_id_vector.size()); | |
- } | |
- // read data | |
- (bis.load_object_data)(ar, t, co.file_version); | |
- m_moveable_objects.recent = this_id; | |
-} | |
- | |
-inline const basic_pointer_iserializer * | |
-basic_iarchive_impl::load_pointer( | |
- basic_iarchive &ar, | |
- void * & t, | |
- const basic_pointer_iserializer * bpis_ptr, | |
- const basic_pointer_iserializer * (*finder)( | |
- const boost::serialization::extended_type_info & type_ | |
- ) | |
-){ | |
- m_moveable_objects.is_pointer = true; | |
- serialization::state_saver<bool> w(m_moveable_objects.is_pointer); | |
- | |
- class_id_type cid; | |
- load(ar, cid); | |
- | |
- if(NULL_POINTER_TAG == cid){ | |
- t = NULL; | |
- return bpis_ptr; | |
- } | |
- | |
- // if its a new class type - i.e. never been registered | |
- if(class_id_type(cobject_info_set.size()) <= cid){ | |
- // if its either abstract | |
- if(NULL == bpis_ptr | |
- // or polymorphic | |
- || bpis_ptr->get_basic_serializer().is_polymorphic()){ | |
- // is must have been exported | |
- char key[BOOST_SERIALIZATION_MAX_KEY_SIZE]; | |
- class_name_type class_name(key); | |
- load(ar, class_name); | |
- // if it has a class name | |
- const serialization::extended_type_info *eti = NULL; | |
- if(0 != key[0]) | |
- eti = serialization::extended_type_info::find(key); | |
- if(NULL == eti) | |
- boost::serialization::throw_exception( | |
- archive_exception(archive_exception::unregistered_class) | |
- ); | |
- bpis_ptr = (*finder)(*eti); | |
- } | |
- BOOST_ASSERT(NULL != bpis_ptr); | |
- // class_id_type new_cid = register_type(bpis_ptr->get_basic_serializer()); | |
- BOOST_VERIFY(register_type(bpis_ptr->get_basic_serializer()) == cid); | |
- int i = cid; | |
- cobject_id_vector[i].bpis_ptr = bpis_ptr; | |
- } | |
- int i = cid; | |
- cobject_id & co = cobject_id_vector[i]; | |
- bpis_ptr = co.bpis_ptr; | |
- | |
- if (bpis_ptr == NULL) { | |
- boost::serialization::throw_exception( | |
- archive_exception(archive_exception::unregistered_class) | |
- ); | |
- } | |
- | |
- load_preamble(ar, co); | |
- | |
- // extra line to evade borland issue | |
- const bool tracking = co.tracking_level; | |
- // if we're tracking and the pointer has already been read | |
- if(tracking && ! track(ar, t)) | |
- // we're done | |
- return bpis_ptr; | |
- | |
- // save state | |
- serialization::state_saver<object_id_type> w_start(m_moveable_objects.start); | |
- | |
- // allocate space on the heap for the object - to be constructed later | |
- t = bpis_ptr->heap_allocation(); | |
- BOOST_ASSERT(NULL != t); | |
- | |
- if(! tracking){ | |
- bpis_ptr->load_object_ptr(ar, t, co.file_version); | |
- } | |
- else{ | |
- serialization::state_saver<void *> x(m_pending.object); | |
- serialization::state_saver<const basic_iserializer *> y(m_pending.bis); | |
- serialization::state_saver<version_type> z(m_pending.version); | |
- | |
- m_pending.bis = & bpis_ptr->get_basic_serializer(); | |
- m_pending.version = co.file_version; | |
- | |
- // predict next object id to be created | |
- const size_t ui = object_id_vector.size(); | |
- | |
- serialization::state_saver<object_id_type> w_end(m_moveable_objects.end); | |
- | |
- // add to list of serialized objects so that we can properly handle | |
- // cyclic strucures | |
- object_id_vector.push_back(aobject(t, cid)); | |
- | |
- // remember that that the address of these elements could change | |
- // when we make another call so don't use the address | |
- bpis_ptr->load_object_ptr( | |
- ar, | |
- t, | |
- m_pending.version | |
- ); | |
- object_id_vector[ui].loaded_as_pointer = true; | |
- } | |
- | |
- return bpis_ptr; | |
-} | |
- | |
-} // namespace detail | |
-} // namespace archive | |
-} // namespace boost | |
- | |
-////////////////////////////////////////////////////////////////////// | |
-// implementation of basic_iarchive functions | |
-namespace boost { | |
-namespace archive { | |
-namespace detail { | |
- | |
-BOOST_ARCHIVE_DECL void | |
-basic_iarchive::next_object_pointer(void *t){ | |
- pimpl->next_object_pointer(t); | |
-} | |
- | |
-BOOST_ARCHIVE_DECL | |
-basic_iarchive::basic_iarchive(unsigned int flags) : | |
- pimpl(new basic_iarchive_impl(flags)) | |
-{} | |
- | |
-BOOST_ARCHIVE_DECL | |
-basic_iarchive::~basic_iarchive() | |
-{} | |
- | |
-BOOST_ARCHIVE_DECL void | |
-basic_iarchive::set_library_version(library_version_type archive_library_version){ | |
- pimpl->set_library_version(archive_library_version); | |
-} | |
- | |
-BOOST_ARCHIVE_DECL void | |
-basic_iarchive::reset_object_address( | |
- const void * new_address, | |
- const void * old_address | |
-){ | |
- pimpl->reset_object_address(new_address, old_address); | |
-} | |
- | |
-BOOST_ARCHIVE_DECL void | |
-basic_iarchive::load_object( | |
- void *t, | |
- const basic_iserializer & bis | |
-){ | |
- pimpl->load_object(*this, t, bis); | |
-} | |
- | |
-// load a pointer object | |
-BOOST_ARCHIVE_DECL const basic_pointer_iserializer * | |
-basic_iarchive::load_pointer( | |
- void * &t, | |
- const basic_pointer_iserializer * bpis_ptr, | |
- const basic_pointer_iserializer * (*finder)( | |
- const boost::serialization::extended_type_info & type_ | |
- ) | |
- | |
-){ | |
- return pimpl->load_pointer(*this, t, bpis_ptr, finder); | |
-} | |
- | |
-BOOST_ARCHIVE_DECL void | |
-basic_iarchive::register_basic_serializer(const basic_iserializer & bis){ | |
- pimpl->register_type(bis); | |
-} | |
- | |
-BOOST_ARCHIVE_DECL void | |
-basic_iarchive::delete_created_pointers() | |
-{ | |
- pimpl->delete_created_pointers(); | |
-} | |
- | |
-BOOST_ARCHIVE_DECL boost::archive::library_version_type | |
-basic_iarchive::get_library_version() const{ | |
- return pimpl->m_archive_library_version; | |
-} | |
- | |
-BOOST_ARCHIVE_DECL unsigned int | |
-basic_iarchive::get_flags() const{ | |
- return pimpl->m_flags; | |
-} | |
- | |
-} // namespace detail | |
-} // namespace archive | |
-} // namespace boost | |
diff --git a/src/mlpack/bindings/R/mlpack/src/boost/serialization/basic_iserializer.cpp b/src/mlpack/bindings/R/mlpack/src/boost/serialization/basic_iserializer.cpp | |
deleted file mode 100644 | |
index 3898a6a72..000000000 | |
--- a/src/mlpack/bindings/R/mlpack/src/boost/serialization/basic_iserializer.cpp | |
+++ /dev/null | |
@@ -1,34 +0,0 @@ | |
-/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 | |
-// basic_iserializer.cpp: | |
- | |
-// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . | |
-// Use, modification and distribution is subject to the Boost Software | |
-// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at | |
-// http://www.boost.org/LICENSE_1_0.txt) | |
- | |
-// See http://www.boost.org for updates, documentation, and revision history. | |
- | |
-#include <cstddef> // NULL | |
- | |
-#define BOOST_ARCHIVE_SOURCE | |
-#include <boost/serialization/config.hpp> | |
-#include <boost/archive/detail/basic_iserializer.hpp> | |
- | |
-namespace boost { | |
-namespace archive { | |
-namespace detail { | |
- | |
-BOOST_ARCHIVE_DECL | |
-basic_iserializer::basic_iserializer( | |
- const boost::serialization::extended_type_info & eti | |
-) : | |
- basic_serializer(eti), | |
- m_bpis(NULL) | |
-{} | |
- | |
-BOOST_ARCHIVE_DECL | |
-basic_iserializer::~basic_iserializer(){} | |
- | |
-} // namespace detail | |
-} // namespace archive | |
-} // namespace boost | |
diff --git a/src/mlpack/bindings/R/mlpack/src/boost/serialization/basic_oarchive.cpp b/src/mlpack/bindings/R/mlpack/src/boost/serialization/basic_oarchive.cpp | |
deleted file mode 100644 | |
index 4df648dc4..000000000 | |
--- a/src/mlpack/bindings/R/mlpack/src/boost/serialization/basic_oarchive.cpp | |
+++ /dev/null | |
@@ -1,470 +0,0 @@ | |
-/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 | |
-// basic_oarchive.cpp: | |
- | |
-// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . | |
-// Use, modification and distribution is subject to the Boost Software | |
-// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at | |
-// http://www.boost.org/LICENSE_1_0.txt) | |
- | |
-// See http://www.boost.org for updates, documentation, and revision history. | |
- | |
-#include <boost/config.hpp> // msvc 6.0 needs this for warning suppression | |
- | |
-#include <boost/assert.hpp> | |
-#include <set> | |
-#include <cstddef> // NULL | |
- | |
-#include <boost/limits.hpp> | |
- | |
-// including this here to work around an ICC in intel 7.0 | |
-// normally this would be part of basic_oarchive.hpp below. | |
-#define BOOST_ARCHIVE_SOURCE | |
-// include this to prevent linker errors when the | |
-// same modules are marked export and import. | |
-#define BOOST_SERIALIZATION_SOURCE | |
-#include <boost/serialization/config.hpp> | |
-#include <boost/serialization/state_saver.hpp> | |
-#include <boost/serialization/throw_exception.hpp> | |
-#include <boost/serialization/extended_type_info.hpp> | |
- | |
-#include <boost/archive/detail/decl.hpp> | |
-#include <boost/archive/basic_archive.hpp> | |
-#include <boost/archive/detail/basic_oserializer.hpp> | |
-#include <boost/archive/detail/basic_pointer_oserializer.hpp> | |
-#include <boost/archive/detail/basic_oarchive.hpp> | |
-#include <boost/archive/archive_exception.hpp> | |
- | |
-#ifdef BOOST_MSVC | |
-# pragma warning(push) | |
-# pragma warning(disable : 4251 4231 4660 4275) | |
-#endif | |
- | |
-using namespace boost::serialization; | |
- | |
-namespace boost { | |
-namespace archive { | |
-namespace detail { | |
- | |
-class basic_oarchive_impl { | |
- friend class basic_oarchive; | |
- unsigned int m_flags; | |
- | |
- ////////////////////////////////////////////////////////////////////// | |
- // information about each serialized object saved | |
- // keyed on address, class_id | |
- struct aobject | |
- { | |
- const void * address; | |
- class_id_type class_id; | |
- object_id_type object_id; | |
- | |
- bool operator<(const aobject &rhs) const | |
- { | |
- BOOST_ASSERT(NULL != address); | |
- BOOST_ASSERT(NULL != rhs.address); | |
- if( address < rhs.address ) | |
- return true; | |
- if( address > rhs.address ) | |
- return false; | |
- return class_id < rhs.class_id; | |
- } | |
- aobject & operator=(const aobject & rhs) | |
- { | |
- address = rhs.address; | |
- class_id = rhs.class_id; | |
- object_id = rhs.object_id; | |
- return *this; | |
- } | |
- aobject( | |
- const void *a, | |
- class_id_type class_id_, | |
- object_id_type object_id_ | |
- ) : | |
- address(a), | |
- class_id(class_id_), | |
- object_id(object_id_) | |
- {} | |
- aobject() : address(NULL){} | |
- }; | |
- // keyed on class_id, address | |
- typedef std::set<aobject> object_set_type; | |
- object_set_type object_set; | |
- | |
- ////////////////////////////////////////////////////////////////////// | |
- // information about each serialized class saved | |
- // keyed on type_info | |
- struct cobject_type | |
- { | |
- const basic_oserializer * m_bos_ptr; | |
- const class_id_type m_class_id; | |
- bool m_initialized; | |
- cobject_type( | |
- std::size_t class_id, | |
- const basic_oserializer & bos | |
- ) : | |
- m_bos_ptr(& bos), | |
- m_class_id(class_id), | |
- m_initialized(false) | |
- {} | |
- cobject_type(const basic_oserializer & bos) : | |
- m_bos_ptr(& bos), | |
- m_initialized(false) | |
- {} | |
- cobject_type( | |
- const cobject_type & rhs | |
- ) : | |
- m_bos_ptr(rhs.m_bos_ptr), | |
- m_class_id(rhs.m_class_id), | |
- m_initialized(rhs.m_initialized) | |
- {} | |
- // the following cannot be defined because of the const | |
- // member. This will generate a link error if an attempt | |
- // is made to assign. This should never be necessary | |
- // use this only for lookup argument | |
- cobject_type & operator=(const cobject_type &rhs); | |
- bool operator<(const cobject_type &rhs) const { | |
- return *m_bos_ptr < *(rhs.m_bos_ptr); | |
- } | |
- }; | |
- // keyed on type_info | |
- typedef std::set<cobject_type> cobject_info_set_type; | |
- cobject_info_set_type cobject_info_set; | |
- | |
- // list of objects initially stored as pointers - used to detect errors | |
- // keyed on object id | |
- std::set<object_id_type> stored_pointers; | |
- | |
- // address of the most recent object serialized as a poiner | |
- // whose data itself is now pending serialization | |
- const void * pending_object; | |
- const basic_oserializer * pending_bos; | |
- | |
- basic_oarchive_impl(unsigned int flags) : | |
- m_flags(flags), | |
- pending_object(NULL), | |
- pending_bos(NULL) | |
- {} | |
- | |
- const cobject_type & | |
- find(const basic_oserializer & bos); | |
- const basic_oserializer * | |
- find(const serialization::extended_type_info &ti) const; | |
- | |
-//public: | |
- const cobject_type & | |
- register_type(const basic_oserializer & bos); | |
- void save_object( | |
- basic_oarchive & ar, | |
- const void *t, | |
- const basic_oserializer & bos | |
- ); | |
- void save_pointer( | |
- basic_oarchive & ar, | |
- const void * t, | |
- const basic_pointer_oserializer * bpos | |
- ); | |
-}; | |
- | |
-////////////////////////////////////////////////////////////////////// | |
-// basic_oarchive implementation functions | |
- | |
-// given a type_info - find its bos | |
-// return NULL if not found | |
-inline const basic_oserializer * | |
-basic_oarchive_impl::find(const serialization::extended_type_info & ti) const { | |
- #ifdef BOOST_MSVC | |
- # pragma warning(push) | |
- # pragma warning(disable : 4511 4512) | |
- #endif | |
- class bosarg : | |
- public basic_oserializer | |
- { | |
- bool class_info() const { | |
- BOOST_ASSERT(false); | |
- return false; | |
- } | |
- // returns true if objects should be tracked | |
- bool tracking(const unsigned int) const { | |
- BOOST_ASSERT(false); | |
- return false; | |
- } | |
- // returns class version | |
- version_type version() const { | |
- BOOST_ASSERT(false); | |
- return version_type(0); | |
- } | |
- // returns true if this class is polymorphic | |
- bool is_polymorphic() const{ | |
- BOOST_ASSERT(false); | |
- return false; | |
- } | |
- void save_object_data( | |
- basic_oarchive & /*ar*/, const void * /*x*/ | |
- ) const { | |
- BOOST_ASSERT(false); | |
- } | |
- public: | |
- bosarg(const serialization::extended_type_info & eti) : | |
- boost::archive::detail::basic_oserializer(eti) | |
- {} | |
- }; | |
- #ifdef BOOST_MSVC | |
- #pragma warning(pop) | |
- #endif | |
- bosarg bos(ti); | |
- cobject_info_set_type::const_iterator cit | |
- = cobject_info_set.find(cobject_type(bos)); | |
- // it should already have been "registered" - see below | |
- if(cit == cobject_info_set.end()){ | |
- // if an entry is not found in the table it is because a pointer | |
- // of a derived class has been serialized through its base class | |
- // but the derived class hasn't been "registered" | |
- return NULL; | |
- } | |
- // return pointer to the real class | |
- return cit->m_bos_ptr; | |
-} | |
- | |
-inline const basic_oarchive_impl::cobject_type & | |
-basic_oarchive_impl::find(const basic_oserializer & bos) | |
-{ | |
- std::pair<cobject_info_set_type::iterator, bool> cresult = | |
- cobject_info_set.insert(cobject_type(cobject_info_set.size(), bos)); | |
- return *(cresult.first); | |
-} | |
- | |
-inline const basic_oarchive_impl::cobject_type & | |
-basic_oarchive_impl::register_type( | |
- const basic_oserializer & bos | |
-){ | |
- cobject_type co(cobject_info_set.size(), bos); | |
- std::pair<cobject_info_set_type::const_iterator, bool> | |
- result = cobject_info_set.insert(co); | |
- return *(result.first); | |
-} | |
- | |
-inline void | |
-basic_oarchive_impl::save_object( | |
- basic_oarchive & ar, | |
- const void *t, | |
- const basic_oserializer & bos | |
-){ | |
- // if its been serialized through a pointer and the preamble's been done | |
- if(t == pending_object && pending_bos == & bos){ | |
- // just save the object data | |
- ar.end_preamble(); | |
- (bos.save_object_data)(ar, t); | |
- return; | |
- } | |
- | |
- // get class information for this object | |
- const cobject_type & co = register_type(bos); | |
- if(bos.class_info()){ | |
- if( ! co.m_initialized){ | |
- ar.vsave(class_id_optional_type(co.m_class_id)); | |
- ar.vsave(tracking_type(bos.tracking(m_flags))); | |
- ar.vsave(version_type(bos.version())); | |
- (const_cast<cobject_type &>(co)).m_initialized = true; | |
- } | |
- } | |
- | |
- // we're not tracking this type of object | |
- if(! bos.tracking(m_flags)){ | |
- // just windup the preamble - no object id to write | |
- ar.end_preamble(); | |
- // and save the data | |
- (bos.save_object_data)(ar, t); | |
- return; | |
- } | |
- | |
- // look for an existing object id | |
- object_id_type oid(object_set.size()); | |
- // lookup to see if this object has already been written to the archive | |
- basic_oarchive_impl::aobject ao(t, co.m_class_id, oid); | |
- std::pair<basic_oarchive_impl::object_set_type::const_iterator, bool> | |
- aresult = object_set.insert(ao); | |
- oid = aresult.first->object_id; | |
- | |
- // if its a new object | |
- if(aresult.second){ | |
- // write out the object id | |
- ar.vsave(oid); | |
- ar.end_preamble(); | |
- // and data | |
- (bos.save_object_data)(ar, t); | |
- return; | |
- } | |
- | |
- // check that it wasn't originally stored through a pointer | |
- if(stored_pointers.end() != stored_pointers.find(oid)){ | |
- // this has to be a user error. loading such an archive | |
- // would create duplicate objects | |
- boost::serialization::throw_exception( | |
- archive_exception(archive_exception::pointer_conflict) | |
- ); | |
- } | |
- // just save the object id | |
- ar.vsave(object_reference_type(oid)); | |
- ar.end_preamble(); | |
- return; | |
-} | |
- | |
-// colle | |
-inline void | |
-basic_oarchive_impl::save_pointer( | |
- basic_oarchive & ar, | |
- const void * t, | |
- const basic_pointer_oserializer * bpos_ptr | |
-){ | |
- const basic_oserializer & bos = bpos_ptr->get_basic_serializer(); | |
- std::size_t original_count = cobject_info_set.size(); | |
- const cobject_type & co = register_type(bos); | |
- if(! co.m_initialized){ | |
- ar.vsave(co.m_class_id); | |
- // if its a previously unregistered class | |
- if((cobject_info_set.size() > original_count)){ | |
- if(bos.is_polymorphic()){ | |
- const serialization::extended_type_info *eti = & bos.get_eti(); | |
- const char * key = NULL; | |
- if(NULL != eti) | |
- key = eti->get_key(); | |
- if(NULL != key){ | |
- // the following is required by IBM C++ compiler which | |
- // makes a copy when passing a non-const to a const. This | |
- // is permitted by the standard but rarely seen in practice | |
- const class_name_type cn(key); | |
- if(cn.size() > (BOOST_SERIALIZATION_MAX_KEY_SIZE - 1)) | |
- boost::serialization::throw_exception( | |
- boost::archive::archive_exception( | |
- boost::archive::archive_exception:: | |
- invalid_class_name) | |
- ); | |
- // write out the external class identifier | |
- ar.vsave(cn); | |
- } | |
- else | |
- // without an external class name | |
- // we won't be able to de-serialize it so bail now | |
- boost::serialization::throw_exception( | |
- archive_exception(archive_exception::unregistered_class) | |
- ); | |
- } | |
- } | |
- if(bos.class_info()){ | |
- ar.vsave(tracking_type(bos.tracking(m_flags))); | |
- ar.vsave(version_type(bos.version())); | |
- } | |
- (const_cast<cobject_type &>(co)).m_initialized = true; | |
- } | |
- else{ | |
- ar.vsave(class_id_reference_type(co.m_class_id)); | |
- } | |
- | |
- // if we're not tracking | |
- if(! bos.tracking(m_flags)){ | |
- // just save the data itself | |
- ar.end_preamble(); | |
- serialization::state_saver<const void *> x(pending_object); | |
- serialization::state_saver<const basic_oserializer *> y(pending_bos); | |
- pending_object = t; | |
- pending_bos = & bpos_ptr->get_basic_serializer(); | |
- bpos_ptr->save_object_ptr(ar, t); | |
- return; | |
- } | |
- | |
- object_id_type oid(object_set.size()); | |
- // lookup to see if this object has already been written to the archive | |
- basic_oarchive_impl::aobject ao(t, co.m_class_id, oid); | |
- std::pair<basic_oarchive_impl::object_set_type::const_iterator, bool> | |
- aresult = object_set.insert(ao); | |
- oid = aresult.first->object_id; | |
- // if the saved object already exists | |
- if(! aresult.second){ | |
- // append the object id to he preamble | |
- ar.vsave(object_reference_type(oid)); | |
- // and windup. | |
- ar.end_preamble(); | |
- return; | |
- } | |
- | |
- // append id of this object to preamble | |
- ar.vsave(oid); | |
- ar.end_preamble(); | |
- | |
- // and save the object itself | |
- serialization::state_saver<const void *> x(pending_object); | |
- serialization::state_saver<const basic_oserializer *> y(pending_bos); | |
- pending_object = t; | |
- pending_bos = & bpos_ptr->get_basic_serializer(); | |
- bpos_ptr->save_object_ptr(ar, t); | |
- // add to the set of object initially stored through pointers | |
- stored_pointers.insert(oid); | |
-} | |
- | |
-} // namespace detail | |
-} // namespace archive | |
-} // namespace boost | |
- | |
-////////////////////////////////////////////////////////////////////// | |
-// implementation of basic_oarchive functions | |
- | |
-namespace boost { | |
-namespace archive { | |
-namespace detail { | |
- | |
-BOOST_ARCHIVE_DECL | |
-basic_oarchive::basic_oarchive(unsigned int flags) | |
- : pimpl(new basic_oarchive_impl(flags)) | |
-{} | |
- | |
-BOOST_ARCHIVE_DECL | |
-basic_oarchive::~basic_oarchive() | |
-{} | |
- | |
-BOOST_ARCHIVE_DECL void | |
-basic_oarchive::save_object( | |
- const void *x, | |
- const basic_oserializer & bos | |
-){ | |
- pimpl->save_object(*this, x, bos); | |
-} | |
- | |
-BOOST_ARCHIVE_DECL void | |
-basic_oarchive::save_pointer( | |
- const void * t, | |
- const basic_pointer_oserializer * bpos_ptr | |
-){ | |
- pimpl->save_pointer(*this, t, bpos_ptr); | |
-} | |
- | |
-BOOST_ARCHIVE_DECL void | |
-basic_oarchive::register_basic_serializer(const basic_oserializer & bos){ | |
- pimpl->register_type(bos); | |
-} | |
- | |
-BOOST_ARCHIVE_DECL library_version_type | |
-basic_oarchive::get_library_version() const{ | |
- return BOOST_ARCHIVE_VERSION(); | |
-} | |
- | |
-BOOST_ARCHIVE_DECL unsigned int | |
-basic_oarchive::get_flags() const{ | |
- return pimpl->m_flags; | |
-} | |
- | |
-BOOST_ARCHIVE_DECL void | |
-basic_oarchive::end_preamble(){ | |
-} | |
- | |
-BOOST_ARCHIVE_DECL helper_collection & | |
-basic_oarchive::get_helper_collection(){ | |
- return *this; | |
-} | |
- | |
-} // namespace detail | |
-} // namespace archive | |
-} // namespace boost | |
- | |
-#ifdef BOOST_MSVC | |
-#pragma warning(pop) | |
-#endif | |
diff --git a/src/mlpack/bindings/R/mlpack/src/boost/serialization/basic_oserializer.cpp b/src/mlpack/bindings/R/mlpack/src/boost/serialization/basic_oserializer.cpp | |
deleted file mode 100644 | |
index afe08c4bb..000000000 | |
--- a/src/mlpack/bindings/R/mlpack/src/boost/serialization/basic_oserializer.cpp | |
+++ /dev/null | |
@@ -1,34 +0,0 @@ | |
-/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 | |
-// basic_oserializer.cpp: | |
- | |
-// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . | |
-// Use, modification and distribution is subject to the Boost Software | |
-// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at | |
-// http://www.boost.org/LICENSE_1_0.txt) | |
- | |
-// See http://www.boost.org for updates, documentation, and revision history. | |
- | |
-#include <cstddef> // NULL | |
- | |
-#define BOOST_ARCHIVE_SOURCE | |
-#include <boost/serialization/config.hpp> | |
-#include <boost/archive/detail/basic_oserializer.hpp> | |
- | |
-namespace boost { | |
-namespace archive { | |
-namespace detail { | |
- | |
-BOOST_ARCHIVE_DECL | |
-basic_oserializer::basic_oserializer( | |
- const boost::serialization::extended_type_info & eti | |
-) : | |
- basic_serializer(eti), | |
- m_bpos(NULL) | |
-{} | |
- | |
-BOOST_ARCHIVE_DECL | |
-basic_oserializer::~basic_oserializer(){} | |
- | |
-} // namespace detail | |
-} // namespace archive | |
-} // namespace boost | |
diff --git a/src/mlpack/bindings/R/mlpack/src/boost/serialization/basic_pointer_iserializer.cpp b/src/mlpack/bindings/R/mlpack/src/boost/serialization/basic_pointer_iserializer.cpp | |
deleted file mode 100644 | |
index 7cf63f306..000000000 | |
--- a/src/mlpack/bindings/R/mlpack/src/boost/serialization/basic_pointer_iserializer.cpp | |
+++ /dev/null | |
@@ -1,31 +0,0 @@ | |
-/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 | |
-// basic_pointer_iserializer.cpp: | |
- | |
-// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . | |
-// Use, modification and distribution is subject to the Boost Software | |
-// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at | |
-// http://www.boost.org/LICENSE_1_0.txt) | |
- | |
-// See http://www.boost.org for updates, documentation, and revision history. | |
- | |
-#define BOOST_ARCHIVE_SOURCE | |
-#include <boost/serialization/config.hpp> | |
-#include <boost/archive/detail/basic_pointer_iserializer.hpp> | |
- | |
-namespace boost { | |
-namespace archive { | |
-namespace detail { | |
- | |
-BOOST_ARCHIVE_DECL | |
-basic_pointer_iserializer::basic_pointer_iserializer( | |
- const boost::serialization::extended_type_info & eti | |
-) : | |
- basic_serializer(eti) | |
-{} | |
- | |
-BOOST_ARCHIVE_DECL | |
-basic_pointer_iserializer::~basic_pointer_iserializer() {} | |
- | |
-} // namespace detail | |
-} // namespace archive | |
-} // namespace boost | |
diff --git a/src/mlpack/bindings/R/mlpack/src/boost/serialization/basic_pointer_oserializer.cpp b/src/mlpack/bindings/R/mlpack/src/boost/serialization/basic_pointer_oserializer.cpp | |
deleted file mode 100644 | |
index e86f7b78e..000000000 | |
--- a/src/mlpack/bindings/R/mlpack/src/boost/serialization/basic_pointer_oserializer.cpp | |
+++ /dev/null | |
@@ -1,31 +0,0 @@ | |
-/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 | |
-// basic_pointer_oserializer.cpp: | |
- | |
-// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . | |
-// Use, modification and distribution is subject to the Boost Software | |
-// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at | |
-// http://www.boost.org/LICENSE_1_0.txt) | |
- | |
-// See http://www.boost.org for updates, documentation, and revision history. | |
- | |
-#define BOOST_ARCHIVE_SOURCE | |
-#include <boost/serialization/config.hpp> | |
-#include <boost/archive/detail/basic_pointer_oserializer.hpp> | |
- | |
-namespace boost { | |
-namespace archive { | |
-namespace detail { | |
- | |
-BOOST_ARCHIVE_DECL | |
-basic_pointer_oserializer::basic_pointer_oserializer( | |
- const boost::serialization::extended_type_info & eti | |
-) : | |
- basic_serializer(eti) | |
-{} | |
- | |
-BOOST_ARCHIVE_DECL | |
-basic_pointer_oserializer::~basic_pointer_oserializer() {} | |
- | |
-} // namespace detail | |
-} // namespace archive | |
-} // namespace boost | |
diff --git a/src/mlpack/bindings/R/mlpack/src/boost/serialization/basic_serializer_map.cpp b/src/mlpack/bindings/R/mlpack/src/boost/serialization/basic_serializer_map.cpp | |
deleted file mode 100644 | |
index 5b7910772..000000000 | |
--- a/src/mlpack/bindings/R/mlpack/src/boost/serialization/basic_serializer_map.cpp | |
+++ /dev/null | |
@@ -1,112 +0,0 @@ | |
-/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 | |
-// serializer_map.cpp: | |
- | |
-// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . | |
-// Use, modification and distribution is subject to the Boost Software | |
-// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at | |
-// http://www.boost.org/LICENSE_1_0.txt) | |
- | |
-// See http://www.boost.org for updates, documentation, and revision history. | |
- | |
-#if (defined _MSC_VER) && (_MSC_VER == 1200) | |
-# pragma warning (disable : 4786) // too long name, harmless warning | |
-#endif | |
- | |
-#include <set> | |
-#include <utility> | |
- | |
-#define BOOST_ARCHIVE_SOURCE | |
-// include this to prevent linker errors when the | |
-// same modules are marked export and import. | |
-#define BOOST_SERIALIZATION_SOURCE | |
-#include <boost/serialization/config.hpp> | |
-#include <boost/serialization/throw_exception.hpp> | |
- | |
-#include <boost/archive/archive_exception.hpp> | |
-#include <boost/archive/detail/basic_serializer.hpp> | |
-#include <boost/archive/detail/basic_serializer_map.hpp> | |
- | |
-namespace boost { | |
- namespace serialization { | |
- class extended_type_info; | |
- } | |
-namespace archive { | |
-namespace detail { | |
- | |
-bool | |
-basic_serializer_map::type_info_pointer_compare::operator()( | |
- const basic_serializer * lhs, const basic_serializer * rhs | |
-) const { | |
- return *lhs < *rhs; | |
-} | |
- | |
-BOOST_ARCHIVE_DECL bool | |
-basic_serializer_map::insert(const basic_serializer * bs){ | |
- // attempt to insert serializer into it's map | |
- // the following is commented out - rather than being just | |
- // deleted as a reminder not to try this. | |
- | |
- // const std::pair<map_type::iterator, bool> result = | |
- m_map.insert(bs); | |
- | |
- // At first it seemed like a good idea. It enforced the | |
- // idea that a type be exported from at most one code module | |
- // (DLL or mainline). This would enforce a "one definition rule" | |
- // across code modules. This seems a good idea to me. | |
- // But it seems that it's just too hard for many users to implement. | |
- | |
- // Ideally, I would like to make this exception a warning - | |
- // but there isn't anyway to do that. | |
- | |
- // if this fails, it's because it's been instantiated | |
- // in multiple modules - DLLS - a recipe for problems. | |
- // So trap this here | |
- // if(!result.second){ | |
- // boost::serialization::throw_exception( | |
- // archive_exception( | |
- // archive_exception::multiple_code_instantiation, | |
- // bs->get_debug_info() | |
- // ) | |
- // ); | |
- // } | |
- return true; | |
-} | |
- | |
-BOOST_ARCHIVE_DECL void | |
-basic_serializer_map::erase(const basic_serializer * bs){ | |
- map_type::iterator it = m_map.begin(); | |
- map_type::iterator it_end = m_map.end(); | |
- | |
- while(it != it_end){ | |
- // note item 9 from Effective STL !!! it++ | |
- if(*it == bs) | |
- m_map.erase(it++); | |
- else | |
- it++; | |
- } | |
- // note: we can't do this since some of the eti records | |
- // we're pointing to might be expired and the comparison | |
- // won't work. Leave this as a reminder not to "optimize" this. | |
- //it = m_map.find(bs); | |
- //assert(it != m_map.end()); | |
- //if(*it == bs) | |
- // m_map.erase(it); | |
-} | |
-BOOST_ARCHIVE_DECL const basic_serializer * | |
-basic_serializer_map::find( | |
- const boost::serialization::extended_type_info & eti | |
-) const { | |
- const basic_serializer_arg bs(eti); | |
- map_type::const_iterator it; | |
- it = m_map.find(& bs); | |
- if(it == m_map.end()){ | |
- BOOST_ASSERT(false); | |
- return 0; | |
- } | |
- return *it; | |
-} | |
- | |
-} // namespace detail | |
-} // namespace archive | |
-} // namespace boost | |
- | |
diff --git a/src/mlpack/bindings/R/mlpack/src/boost/serialization/basic_text_oprimitive.cpp b/src/mlpack/bindings/R/mlpack/src/boost/serialization/basic_text_oprimitive.cpp | |
deleted file mode 100644 | |
index 601662294..000000000 | |
--- a/src/mlpack/bindings/R/mlpack/src/boost/serialization/basic_text_oprimitive.cpp | |
+++ /dev/null | |
@@ -1,29 +0,0 @@ | |
-/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 | |
-// basic_text_oprimitive.cpp: | |
- | |
-// (C) Copyright 2004 Robert Ramey - http://www.rrsd.com . | |
-// Use, modification and distribution is subject to the Boost Software | |
-// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at | |
-// http://www.boost.org/LICENSE_1_0.txt) | |
- | |
-// See http://www.boost.org for updates, documentation, and revision history. | |
- | |
-#if (defined _MSC_VER) && (_MSC_VER == 1200) | |
-# pragma warning (disable : 4786) // too long name, harmless warning | |
-#endif | |
- | |
-#include <ostream> | |
- | |
-#define BOOST_ARCHIVE_SOURCE | |
-#include <boost/serialization/config.hpp> | |
-#include <boost/archive/detail/auto_link_archive.hpp> | |
-#include <boost/archive/impl/basic_text_oprimitive.ipp> | |
- | |
-namespace boost { | |
-namespace archive { | |
- | |
-// explicitly instantiate for this type of text stream | |
-template class basic_text_oprimitive<std::ostream> ; | |
- | |
-} // namespace archive | |
-} // namespace boost | |
diff --git a/src/mlpack/bindings/R/mlpack/src/boost/serialization/binary_iarchive.cpp b/src/mlpack/bindings/R/mlpack/src/boost/serialization/binary_iarchive.cpp | |
deleted file mode 100644 | |
index 95f026dc1..000000000 | |
--- a/src/mlpack/bindings/R/mlpack/src/boost/serialization/binary_iarchive.cpp | |
+++ /dev/null | |
@@ -1,40 +0,0 @@ | |
-/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 | |
-// binary_iarchive.cpp: | |
- | |
-// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . | |
-// Use, modification and distribution is subject to the Boost Software | |
-// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at | |
-// http://www.boost.org/LICENSE_1_0.txt) | |
- | |
-// See http://www.boost.org for updates, documentation, and revision history. | |
- | |
-#include <istream> | |
- | |
-#define BOOST_ARCHIVE_SOURCE | |
-#include <boost/serialization/config.hpp> | |
-#include <boost/archive/binary_iarchive.hpp> | |
-#include <boost/archive/detail/archive_serializer_map.hpp> | |
- | |
-#include <boost/archive/impl/archive_serializer_map.ipp> | |
-#include <boost/archive/impl/basic_binary_iprimitive.ipp> | |
-#include <boost/archive/impl/basic_binary_iarchive.ipp> | |
- | |
-namespace boost { | |
-namespace archive { | |
- | |
-// explicitly instantiate for this type of stream | |
-template class detail::archive_serializer_map<binary_iarchive>; | |
-template class basic_binary_iprimitive< | |
- binary_iarchive, | |
- std::istream::char_type, | |
- std::istream::traits_type | |
->; | |
-template class basic_binary_iarchive<binary_iarchive> ; | |
-template class binary_iarchive_impl< | |
- binary_iarchive, | |
- std::istream::char_type, | |
- std::istream::traits_type | |
->; | |
- | |
-} // namespace archive | |
-} // namespace boost | |
diff --git a/src/mlpack/bindings/R/mlpack/src/boost/serialization/binary_oarchive.cpp b/src/mlpack/bindings/R/mlpack/src/boost/serialization/binary_oarchive.cpp | |
deleted file mode 100644 | |
index c5220cad4..000000000 | |
--- a/src/mlpack/bindings/R/mlpack/src/boost/serialization/binary_oarchive.cpp | |
+++ /dev/null | |
@@ -1,38 +0,0 @@ | |
-/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 | |
-// binary_oarchive.cpp: | |
- | |
-// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . | |
-// Use, modification and distribution is subject to the Boost Software | |
-// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at | |
-// http://www.boost.org/LICENSE_1_0.txt) | |
- | |
-// See http://www.boost.org for updates, documentation, and revision history. | |
- | |
-#include <ostream> | |
- | |
-#define BOOST_ARCHIVE_SOURCE | |
-#include <boost/serialization/config.hpp> | |
-#include <boost/archive/binary_oarchive.hpp> | |
-#include <boost/archive/detail/archive_serializer_map.hpp> | |
- | |
-#include <boost/archive/impl/basic_binary_oprimitive.ipp> | |
-#include <boost/archive/impl/basic_binary_oarchive.ipp> | |
- | |
-namespace boost { | |
-namespace archive { | |
- | |
-template class detail::archive_serializer_map<binary_oarchive>; | |
-template class basic_binary_oprimitive< | |
- binary_oarchive, | |
- std::ostream::char_type, | |
- std::ostream::traits_type | |
->; | |
-template class basic_binary_oarchive<binary_oarchive> ; | |
-template class binary_oarchive_impl< | |
- binary_oarchive, | |
- std::ostream::char_type, | |
- std::ostream::traits_type | |
->; | |
- | |
-} // namespace archive | |
-} // namespace boost | |
diff --git a/src/mlpack/bindings/R/mlpack/src/boost/serialization/extended_type_info.cpp b/src/mlpack/bindings/R/mlpack/src/boost/serialization/extended_type_info.cpp | |
deleted file mode 100644 | |
index 573336c86..000000000 | |
--- a/src/mlpack/bindings/R/mlpack/src/boost/serialization/extended_type_info.cpp | |
+++ /dev/null | |
@@ -1,196 +0,0 @@ | |
-/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 | |
-// extended_type_info.cpp: implementation for portable version of type_info | |
- | |
-// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . | |
-// Use, modification and distribution is subject to the Boost Software | |
-// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at | |
-// http://www.boost.org/LICENSE_1_0.txt) | |
- | |
-// See http://www.boost.org for updates, documentation, and revision history. | |
- | |
-#if (defined _MSC_VER) && (_MSC_VER == 1200) | |
-# pragma warning (disable : 4786) // too long name, harmless warning | |
-#endif | |
- | |
-#include <algorithm> | |
-#include <set> | |
-#include <utility> | |
-#include <boost/assert.hpp> | |
-#include <cstddef> // NULL | |
- | |
-#include <cstring> | |
-#if defined(BOOST_NO_STDC_NAMESPACE) | |
-namespace std{ using ::strcmp; } | |
-#endif | |
- | |
-#include <boost/config.hpp> // msvc needs this to suppress warning | |
- | |
-#include <boost/core/no_exceptions_support.hpp> | |
- | |
-// it marks our code with proper attributes as being exported when | |
-// we're compiling it while marking it import when just the headers | |
-// is being included. | |
-#define BOOST_SERIALIZATION_SOURCE | |
-#include <boost/serialization/config.hpp> | |
-#include <boost/serialization/singleton.hpp> | |
-#include <boost/serialization/force_include.hpp> | |
-#include <boost/serialization/extended_type_info.hpp> | |
- | |
-#ifdef BOOST_MSVC | |
-# pragma warning(push) | |
-# pragma warning(disable : 4511 4512) | |
-#endif | |
- | |
-namespace boost { | |
-namespace serialization { | |
-namespace detail { | |
- | |
-struct key_compare | |
-{ | |
- bool | |
- operator()( | |
- const extended_type_info * lhs, | |
- const extended_type_info * rhs | |
- ) const { | |
- // performance shortcut | |
- if(lhs == rhs) | |
- return false; | |
- const char * l = lhs->get_key(); | |
- BOOST_ASSERT(NULL != l); | |
- const char * r = rhs->get_key(); | |
- BOOST_ASSERT(NULL != r); | |
- // performance shortcut | |
- // shortcut to exploit string pooling | |
- if(l == r) | |
- return false; | |
- // for exported types, use the string key so that | |
- // multiple instances in different translation units | |
- // can be matched up | |
- return std::strcmp(l, r) < 0; | |
- } | |
-}; | |
- | |
-typedef std::multiset<const extended_type_info *, key_compare> ktmap; | |
- | |
-#ifdef BOOST_MSVC | |
-# pragma warning(push) | |
-# pragma warning(disable : 4511 4512) | |
-#endif | |
- | |
-class extended_type_info_arg : public extended_type_info | |
-{ | |
- virtual bool | |
- is_less_than(const extended_type_info & /*rhs*/) const { | |
- BOOST_ASSERT(false); | |
- return false; | |
- }; | |
- virtual bool | |
- is_equal(const extended_type_info & /*rhs*/) const { | |
- BOOST_ASSERT(false); | |
- return false; | |
- }; | |
- virtual const char * get_debug_info() const { | |
- return get_key(); | |
- } | |
- virtual void * construct(unsigned int /*count*/, ...) const{ | |
- BOOST_ASSERT(false); | |
- return NULL; | |
- } | |
- virtual void destroy(void const * const /*p*/) const { | |
- BOOST_ASSERT(false); | |
- } | |
-public: | |
- extended_type_info_arg(const char * key) : | |
- extended_type_info(0, key) | |
- {} | |
- | |
- ~extended_type_info_arg(){ | |
- } | |
-}; | |
- | |
-#ifdef BOOST_MSVC | |
-# pragma warning(pop) | |
-#endif | |
- | |
-} // namespace detail | |
- | |
-BOOST_SERIALIZATION_DECL void | |
-extended_type_info::key_register() const{ | |
- if(NULL == get_key()) | |
- return; | |
- singleton<detail::ktmap>::get_mutable_instance().insert(this); | |
-} | |
- | |
-BOOST_SERIALIZATION_DECL void | |
-extended_type_info::key_unregister() const{ | |
- if(NULL == get_key()) | |
- return; | |
- // note: it's been discovered that at least one platform is not guaranteed | |
- // to destroy singletons reverse order of construction. So we can't | |
- // use a runtime assert here. Leave this in a reminder not to do this! | |
- // BOOST_ASSERT(! singleton<detail::ktmap>::is_destroyed()); | |
- if(! singleton<detail::ktmap>::is_destroyed()){ | |
- detail::ktmap & x = singleton<detail::ktmap>::get_mutable_instance(); | |
- detail::ktmap::iterator start = x.lower_bound(this); | |
- detail::ktmap::iterator end = x.upper_bound(this); | |
- // remove entry in map which corresponds to this type | |
- for(;start != end; ++start){ | |
- if(this == *start){ | |
- x.erase(start); | |
- break; | |
- } | |
- } | |
- } | |
-} | |
- | |
-BOOST_SERIALIZATION_DECL const extended_type_info * | |
-extended_type_info::find(const char *key) { | |
- BOOST_ASSERT(NULL != key); | |
- const detail::ktmap & k = singleton<detail::ktmap>::get_const_instance(); | |
- const detail::extended_type_info_arg eti_key(key); | |
- const detail::ktmap::const_iterator it = k.find(& eti_key); | |
- if(k.end() == it) | |
- return NULL; | |
- return *(it); | |
-} | |
- | |
-BOOST_SERIALIZATION_DECL | |
-extended_type_info::extended_type_info( | |
- const unsigned int type_info_key, | |
- const char * key | |
-) : | |
- m_type_info_key(type_info_key), | |
- m_key(key) | |
-{ | |
-} | |
- | |
-BOOST_SERIALIZATION_DECL | |
-extended_type_info::~extended_type_info(){ | |
-} | |
- | |
-BOOST_SERIALIZATION_DECL bool | |
-extended_type_info::operator<(const extended_type_info &rhs) const { | |
- // short cut for a common cases | |
- if(this == & rhs) | |
- return false; | |
- if(m_type_info_key == rhs.m_type_info_key){ | |
- return is_less_than(rhs); | |
- } | |
- if(m_type_info_key < rhs.m_type_info_key) | |
- return true; | |
- return false; | |
-} | |
- | |
-BOOST_SERIALIZATION_DECL bool | |
-extended_type_info::operator==(const extended_type_info &rhs) const { | |
- // short cut for a common cases | |
- if(this == & rhs) | |
- return true; | |
- if(m_type_info_key != rhs.m_type_info_key){ | |
- return false; | |
- } | |
- return is_equal(rhs); | |
-} | |
- | |
-} // namespace serialization | |
-} // namespace boost | |
diff --git a/src/mlpack/bindings/R/mlpack/src/boost/serialization/extended_type_info_typeid.cpp b/src/mlpack/bindings/R/mlpack/src/boost/serialization/extended_type_info_typeid.cpp | |
deleted file mode 100644 | |
index 91ace4c36..000000000 | |
--- a/src/mlpack/bindings/R/mlpack/src/boost/serialization/extended_type_info_typeid.cpp | |
+++ /dev/null | |
@@ -1,167 +0,0 @@ | |
-/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 | |
-// extended_type_info_typeid.cpp: specific implementation of type info | |
-// that is based on typeid | |
- | |
-// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . | |
-// Use, modification and distribution is subject to the Boost Software | |
-// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at | |
-// http://www.boost.org/LICENSE_1_0.txt) | |
- | |
-// See http://www.boost.org for updates, documentation, and revision history. | |
- | |
-#include <algorithm> | |
-#include <set> | |
-#include <boost/assert.hpp> | |
-#include <typeinfo> | |
-#include <cstddef> // NULL | |
- | |
-#include <boost/core/no_exceptions_support.hpp> | |
- | |
-// it marks our code with proper attributes as being exported when | |
-// we're compiling it while marking it import when just the headers | |
-// is being included. | |
-#define BOOST_SERIALIZATION_SOURCE | |
-#include <boost/serialization/config.hpp> | |
-#include <boost/serialization/singleton.hpp> | |
-#include <boost/serialization/extended_type_info_typeid.hpp> | |
- | |
-namespace boost { | |
-namespace serialization { | |
-namespace typeid_system { | |
- | |
-#define EXTENDED_TYPE_INFO_TYPE_KEY 1 | |
- | |
-struct type_compare | |
-{ | |
- bool | |
- operator()( | |
- const extended_type_info_typeid_0 * lhs, | |
- const extended_type_info_typeid_0 * rhs | |
- ) const { | |
- return lhs->is_less_than(*rhs); | |
- } | |
-}; | |
- | |
-typedef std::multiset< | |
- const extended_type_info_typeid_0 *, | |
- type_compare | |
-> tkmap; | |
- | |
-BOOST_SERIALIZATION_DECL bool | |
-extended_type_info_typeid_0::is_less_than( | |
- const boost::serialization::extended_type_info & rhs | |
-) const { | |
- // shortcut for common case | |
- if(this == & rhs) | |
- return false; | |
- return 0 != m_ti->before( | |
- *(static_cast<const extended_type_info_typeid_0 &>(rhs).m_ti) | |
- ); | |
-} | |
- | |
-BOOST_SERIALIZATION_DECL bool | |
-extended_type_info_typeid_0::is_equal( | |
- const boost::serialization::extended_type_info & rhs | |
-) const { | |
- return | |
- // note: std::type_info == operator returns an int !!! | |
- // the following permits conversion to bool without a warning. | |
- ! ( | |
- * m_ti | |
- != *(static_cast<const extended_type_info_typeid_0 &>(rhs).m_ti) | |
- ) | |
- ; | |
-} | |
- | |
-BOOST_SERIALIZATION_DECL | |
-extended_type_info_typeid_0::extended_type_info_typeid_0( | |
- const char * key | |
-) : | |
- extended_type_info(EXTENDED_TYPE_INFO_TYPE_KEY, key), | |
- m_ti(NULL) | |
-{} | |
- | |
-BOOST_SERIALIZATION_DECL | |
-extended_type_info_typeid_0::~extended_type_info_typeid_0() | |
-{} | |
- | |
-BOOST_SERIALIZATION_DECL void | |
-extended_type_info_typeid_0::type_register(const std::type_info & ti){ | |
- m_ti = & ti; | |
- singleton<tkmap>::get_mutable_instance().insert(this); | |
-} | |
- | |
-BOOST_SERIALIZATION_DECL void | |
-extended_type_info_typeid_0::type_unregister() | |
-{ | |
- if(NULL != m_ti){ | |
- // note: previously this conditional was a runtime assertion with | |
- // BOOST_ASSERT. We've changed it because we've discovered that at | |
- // least one platform is not guaranteed to destroy singletons in | |
- // reverse order of distruction. | |
- // BOOST_ASSERT(! singleton<tkmap>::is_destroyed()); | |
- if(! singleton<tkmap>::is_destroyed()){ | |
- tkmap & x = singleton<tkmap>::get_mutable_instance(); | |
- | |
- // remove all entries in map which corresponds to this type | |
- // make sure that we don't use any invalidated iterators | |
- for(;;){ | |
- const tkmap::iterator & it = x.find(this); | |
- if(it == x.end()) | |
- break; | |
- x.erase(it); | |
- }; | |
- } | |
- } | |
- m_ti = NULL; | |
-} | |
- | |
-#ifdef BOOST_MSVC | |
-# pragma warning(push) | |
-# pragma warning(disable : 4511 4512) | |
-#endif | |
- | |
-// this derivation is used for creating search arguments | |
-class extended_type_info_typeid_arg : | |
- public extended_type_info_typeid_0 | |
-{ | |
- virtual void * construct(unsigned int /*count*/, ...) const{ | |
- BOOST_ASSERT(false); | |
- return NULL; | |
- } | |
- virtual void destroy(void const * const /*p*/) const { | |
- BOOST_ASSERT(false); | |
- } | |
-public: | |
- extended_type_info_typeid_arg(const std::type_info & ti) : | |
- extended_type_info_typeid_0(NULL) | |
- { | |
- // note absense of self register and key as this is used only as | |
- // search argument given a type_info reference and is not to | |
- // be added to the map. | |
- m_ti = & ti; | |
- } | |
- ~extended_type_info_typeid_arg(){ | |
- m_ti = NULL; | |
- } | |
-}; | |
- | |
-#ifdef BOOST_MSVC | |
-# pragma warning(pop) | |
-#endif | |
- | |
-BOOST_SERIALIZATION_DECL const extended_type_info * | |
-extended_type_info_typeid_0::get_extended_type_info( | |
- const std::type_info & ti | |
-) const { | |
- typeid_system::extended_type_info_typeid_arg etia(ti); | |
- const tkmap & t = singleton<tkmap>::get_const_instance(); | |
- const tkmap::const_iterator it = t.find(& etia); | |
- if(t.end() == it) | |
- return NULL; | |
- return *(it); | |
-} | |
- | |
-} // namespace detail | |
-} // namespace serialization | |
-} // namespace boost | |
diff --git a/src/mlpack/bindings/R/mlpack/src/boost/serialization/utf8_codecvt_facet.cpp b/src/mlpack/bindings/R/mlpack/src/boost/serialization/utf8_codecvt_facet.cpp | |
deleted file mode 100644 | |
index f6550d07d..000000000 | |
--- a/src/mlpack/bindings/R/mlpack/src/boost/serialization/utf8_codecvt_facet.cpp | |
+++ /dev/null | |
@@ -1,22 +0,0 @@ | |
-// Copyright Vladimir Prus 2004. | |
-// Distributed under the Boost Software License, Version 1.0. | |
-// (See accompanying file LICENSE_1_0.txt | |
-// or copy at http://www.boost.org/LICENSE_1_0.txt) | |
- | |
-#include <boost/config.hpp> | |
- | |
-#ifdef BOOST_NO_STD_WSTREAMBUF | |
-#error "wide char i/o not supported on this platform" | |
-#endif | |
- | |
-// include boost implementation of utf8 codecvt facet | |
-# define BOOST_ARCHIVE_SOURCE | |
-#include <boost/archive/detail/decl.hpp> | |
-#define BOOST_UTF8_BEGIN_NAMESPACE \ | |
- namespace boost { namespace archive { namespace detail { | |
-#define BOOST_UTF8_DECL BOOST_ARCHIVE_DECL | |
-#define BOOST_UTF8_END_NAMESPACE }}} | |
-#include <boost/detail/utf8_codecvt_facet.ipp> | |
-#undef BOOST_UTF8_END_NAMESPACE | |
-#undef BOOST_UTF8_DECL | |
-#undef BOOST_UTF8_BEGIN_NAMESPACE | |
diff --git a/src/mlpack/bindings/R/mlpack/src/boost/serialization/variant.hpp b/src/mlpack/bindings/R/mlpack/src/boost/serialization/variant.hpp | |
deleted file mode 100644 | |
index f508f01c3..000000000 | |
--- a/src/mlpack/bindings/R/mlpack/src/boost/serialization/variant.hpp | |
+++ /dev/null | |
@@ -1,178 +0,0 @@ | |
-#ifndef BOOST_SERIALIZATION_VARIANT_HPP | |
-#define BOOST_SERIALIZATION_VARIANT_HPP | |
- | |
-// MS compatible compilers support #pragma once | |
-#if defined(_MSC_VER) | |
-# pragma once | |
-#endif | |
- | |
-/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 | |
-// variant.hpp - non-intrusive serialization of variant types | |
-// | |
-// copyright (c) 2005 | |
-// troy d. straszheim <troy@resophonic.com> | |
-// http://www.resophonic.com | |
-// | |
-// Use, modification and distribution is subject to the Boost Software | |
-// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at | |
-// http://www.boost.org/LICENSE_1_0.txt) | |
-// | |
-// See http://www.boost.org for updates, documentation, and revision history. | |
-// | |
-// thanks to Robert Ramey, Peter Dimov, and Richard Crossley. | |
-// | |
- | |
-#include <boost/mpl/front.hpp> | |
-#include <boost/mpl/pop_front.hpp> | |
-#include <boost/mpl/eval_if.hpp> | |
-#include <boost/mpl/identity.hpp> | |
-#include <boost/mpl/size.hpp> | |
-#include <boost/mpl/empty.hpp> | |
- | |
-#include <boost/serialization/throw_exception.hpp> | |
- | |
-#include <boost/variant.hpp> | |
- | |
-#include <boost/archive/archive_exception.hpp> | |
- | |
-#include <boost/serialization/split_free.hpp> | |
-#include <boost/serialization/serialization.hpp> | |
-#include <boost/serialization/nvp.hpp> | |
- | |
-namespace boost { | |
-namespace serialization { | |
- | |
-template<class Archive> | |
-struct variant_save_visitor : | |
- boost::static_visitor<> | |
-{ | |
- variant_save_visitor(Archive& ar) : | |
- m_ar(ar) | |
- {} | |
- template<class T> | |
- void operator()(T const & value) const | |
- { | |
- m_ar << BOOST_SERIALIZATION_NVP(value); | |
- } | |
-private: | |
- Archive & m_ar; | |
-}; | |
- | |
-template<class Archive, BOOST_VARIANT_ENUM_PARAMS(/* typename */ class T)> | |
-void save( | |
- Archive & ar, | |
- boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)> const & v, | |
- unsigned int /*version*/ | |
-){ | |
- int which = v.which(); | |
- ar << BOOST_SERIALIZATION_NVP(which); | |
- variant_save_visitor<Archive> visitor(ar); | |
- v.apply_visitor(visitor); | |
-} | |
- | |
-template<class S> | |
-struct variant_impl { | |
- | |
- struct load_null { | |
- template<class Archive, class V> | |
- static void invoke( | |
- Archive & /*ar*/, | |
- int /*which*/, | |
- V & /*v*/, | |
- const unsigned int /*version*/ | |
- ){} | |
- }; | |
- | |
- struct load_impl { | |
- template<class Archive, class V> | |
- static void invoke( | |
- Archive & ar, | |
- int which, | |
- V & v, | |
- const unsigned int version | |
- ){ | |
- if(which == 0){ | |
- // note: A non-intrusive implementation (such as this one) | |
- // necessary has to copy the value. This wouldn't be necessary | |
- // with an implementation that de-serialized to the address of the | |
- // aligned storage included in the variant. | |
- typedef typename mpl::front<S>::type head_type; | |
- head_type value; | |
- ar >> BOOST_SERIALIZATION_NVP(value); | |
- v = value; | |
- head_type * new_address = & boost::get<head_type>(v); | |
- ar.reset_object_address(new_address, & value); | |
- return; | |
- } | |
- typedef typename mpl::pop_front<S>::type type; | |
- variant_impl<type>::load(ar, which - 1, v, version); | |
- } | |
- }; | |
- | |
- template<class Archive, class V> | |
- static void load( | |
- Archive & ar, | |
- int which, | |
- V & v, | |
- const unsigned int version | |
- ){ | |
- typedef typename mpl::eval_if<mpl::empty<S>, | |
- mpl::identity<load_null>, | |
- mpl::identity<load_impl> | |
- >::type typex; | |
- typex::invoke(ar, which, v, version); | |
- } | |
- | |
-}; | |
- | |
-template<class Archive, BOOST_VARIANT_ENUM_PARAMS(/* typename */ class T)> | |
-void load( | |
- Archive & ar, | |
- boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)>& v, | |
- const unsigned int version | |
-){ | |
- int which; | |
- typedef typename boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)>::types types; | |
- ar >> BOOST_SERIALIZATION_NVP(which); | |
- if(which >= mpl::size<types>::value) | |
- // this might happen if a type was removed from the list of variant types | |
- boost::serialization::throw_exception( | |
- boost::archive::archive_exception( | |
- boost::archive::archive_exception::unsupported_version | |
- ) | |
- ); | |
- variant_impl<types>::load(ar, which, v, version); | |
-} | |
- | |
-template<class Archive,BOOST_VARIANT_ENUM_PARAMS(/* typename */ class T)> | |
-inline void serialize( | |
- Archive & ar, | |
- boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)> & v, | |
- const unsigned int file_version | |
-){ | |
- split_free(ar,v,file_version); | |
-} | |
- | |
-} // namespace serialization | |
-} // namespace boost | |
- | |
-//template<typename T0_, BOOST_VARIANT_ENUM_SHIFTED_PARAMS(typename T)> | |
- | |
-#include <boost/serialization/tracking.hpp> | |
- | |
-namespace boost { | |
- namespace serialization { | |
- | |
-template<BOOST_VARIANT_ENUM_PARAMS(/* typename */ class T)> | |
-struct tracking_level< | |
- variant<BOOST_VARIANT_ENUM_PARAMS(T)> | |
->{ | |
- typedef mpl::integral_c_tag tag; | |
- typedef mpl::int_< ::boost::serialization::track_always> type; | |
- BOOST_STATIC_CONSTANT(int, value = type::value); | |
-}; | |
- | |
-} // namespace serialization | |
-} // namespace boost | |
- | |
-#endif //BOOST_SERIALIZATION_VARIANT_HPP | |
diff --git a/src/mlpack/bindings/R/mlpack/src/boost/serialization/void_cast.cpp b/src/mlpack/bindings/R/mlpack/src/boost/serialization/void_cast.cpp | |
deleted file mode 100644 | |
index 535988f86..000000000 | |
--- a/src/mlpack/bindings/R/mlpack/src/boost/serialization/void_cast.cpp | |
+++ /dev/null | |
@@ -1,382 +0,0 @@ | |
-/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 | |
-// void_cast.cpp: implementation of run-time casting of void pointers | |
- | |
-// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . | |
-// Use, modification and distribution is subject to the Boost Software | |
-// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at | |
-// http://www.boost.org/LICENSE_1_0.txt) | |
-// <gennadiy.rozental@tfn.com> | |
- | |
-// See http://www.boost.org for updates, documentation, and revision history. | |
- | |
-#if (defined _MSC_VER) && (_MSC_VER == 1200) | |
-# pragma warning (disable : 4786) // too long name, harmless warning | |
-#endif | |
- | |
-// STL | |
-#include <set> | |
-#include <functional> | |
-#include <algorithm> | |
-#include <cstddef> // NULL | |
-#ifdef BOOST_SERIALIZATION_LOG | |
-#include <iostream> | |
-#endif | |
- | |
-// BOOST | |
-#include <boost/config.hpp> | |
-#include <boost/assert.hpp> | |
- | |
-#define BOOST_SERIALIZATION_SOURCE | |
-#include <boost/serialization/config.hpp> | |
-// it marks our code with proper attributes as being exported when | |
-// we're compiling it while marking it import when just the headers | |
-// is being included. | |
-#include <boost/serialization/singleton.hpp> | |
-#include <boost/serialization/extended_type_info.hpp> | |
-#include <boost/serialization/void_cast.hpp> | |
- | |
-namespace boost { | |
-namespace serialization { | |
-namespace void_cast_detail { | |
- | |
-// note that void_casters are keyed on value of | |
-// member extended type info records - NOT their | |
-// addresses. This is necessary in order for the | |
-// void cast operations to work across dll and exe | |
-// module boundries. | |
-bool void_caster::operator<(const void_caster & rhs) const { | |
- // include short cut to save time and eliminate | |
- // problems when when base class aren't virtual | |
- if(m_derived != rhs.m_derived){ | |
- if(*m_derived < *rhs.m_derived) | |
- return true; | |
- if(*rhs.m_derived < *m_derived) | |
- return false; | |
- } | |
- // m_derived == rhs.m_derived | |
- if(m_base != rhs.m_base) | |
- return *m_base < *rhs.m_base; | |
- else | |
- return false; | |
-} | |
- | |
-struct void_caster_compare { | |
- bool operator()(const void_caster * lhs, const void_caster * rhs) const { | |
- return *lhs < *rhs; | |
- } | |
-}; | |
- | |
-typedef std::set<const void_caster *, void_caster_compare> set_type; | |
-typedef boost::serialization::singleton<set_type> void_caster_registry; | |
- | |
-#ifdef BOOST_MSVC | |
-# pragma warning(push) | |
-# pragma warning(disable : 4511 4512) | |
-#endif | |
- | |
-// implementation of shortcut void caster | |
-class void_caster_shortcut : public void_caster | |
-{ | |
- bool m_includes_virtual_base; | |
- | |
- void const * | |
- vbc_upcast( | |
- void const * const t | |
- ) const; | |
- void const * | |
- vbc_downcast( | |
- void const * const t | |
- ) const; | |
- virtual void const * | |
- upcast(void const * const t) const{ | |
- if(m_includes_virtual_base) | |
- return vbc_upcast(t); | |
- return static_cast<const char *> ( t ) - m_difference; | |
- } | |
- virtual void const * | |
- downcast(void const * const t) const{ | |
- if(m_includes_virtual_base) | |
- return vbc_downcast(t); | |
- return static_cast<const char *> ( t ) + m_difference; | |
- } | |
- virtual bool is_shortcut() const { | |
- return true; | |
- } | |
- virtual bool has_virtual_base() const { | |
- return m_includes_virtual_base; | |
- } | |
-public: | |
- void_caster_shortcut( | |
- extended_type_info const * derived, | |
- extended_type_info const * base, | |
- std::ptrdiff_t difference, | |
- bool includes_virtual_base, | |
- void_caster const * const parent | |
- ) : | |
- void_caster(derived, base, difference, parent), | |
- m_includes_virtual_base(includes_virtual_base) | |
- { | |
- recursive_register(includes_virtual_base); | |
- } | |
- virtual ~void_caster_shortcut(){ | |
- recursive_unregister(); | |
- } | |
-}; | |
- | |
-#ifdef BOOST_MSVC | |
-# pragma warning(pop) | |
-#endif | |
- | |
-void const * | |
-void_caster_shortcut::vbc_downcast( | |
- void const * const t | |
-) const { | |
- // try to find a chain that gives us what we want | |
- const void_cast_detail::set_type & s | |
- = void_cast_detail::void_caster_registry::get_const_instance(); | |
- void_cast_detail::set_type::const_iterator it; | |
- for(it = s.begin(); it != s.end(); ++it){ | |
- // if the current candidate casts to the desired target type | |
- if ((*it)->m_derived == m_derived){ | |
- // and if it's not us | |
- if ((*it)->m_base != m_base){ | |
- // try to cast from the candidate base to our base | |
- const void * t_new; | |
- t_new = void_downcast(*(*it)->m_base, *m_base, t); | |
- // if we were successful | |
- if(NULL != t_new){ | |
- // recast to our derived | |
- const void_caster * vc = *it; | |
- return vc->downcast(t_new); | |
- } | |
- } | |
- } | |
- } | |
- return NULL; | |
-} | |
- | |
-void const * | |
-void_caster_shortcut::vbc_upcast( | |
- void const * const t | |
-) const { | |
- // try to find a chain that gives us what we want | |
- const void_cast_detail::set_type & s | |
- = void_cast_detail::void_caster_registry::get_const_instance(); | |
- void_cast_detail::set_type::const_iterator it; | |
- for(it = s.begin(); it != s.end(); ++it){ | |
- // if the current candidate casts from the desired base type | |
- if((*it)->m_base == m_base){ | |
- // and if it's not us | |
- if ((*it)->m_derived != m_derived){ | |
- // try to cast from the candidate derived to our our derived | |
- const void * t_new; | |
- t_new = void_upcast(*m_derived, *(*it)->m_derived, t); | |
- if(NULL != t_new) | |
- return (*it)->upcast(t_new); | |
- } | |
- } | |
- } | |
- return NULL; | |
-} | |
- | |
-#ifdef BOOST_MSVC | |
-# pragma warning(push) | |
-# pragma warning(disable : 4511 4512) | |
-#endif | |
- | |
-// just used as a search key | |
-class void_caster_argument : public void_caster | |
-{ | |
- virtual void const * | |
- upcast(void const * const /*t*/) const { | |
- BOOST_ASSERT(false); | |
- return NULL; | |
- } | |
- virtual void const * | |
- downcast( void const * const /*t*/) const { | |
- BOOST_ASSERT(false); | |
- return NULL; | |
- } | |
- virtual bool has_virtual_base() const { | |
- BOOST_ASSERT(false); | |
- return false; | |
- } | |
-public: | |
- void_caster_argument( | |
- extended_type_info const * derived, | |
- extended_type_info const * base | |
- ) : | |
- void_caster(derived, base) | |
- {} | |
- virtual ~void_caster_argument(){}; | |
-}; | |
- | |
-#ifdef BOOST_MSVC | |
-# pragma warning(pop) | |
-#endif | |
- | |
-// implementation of void caster base class | |
-BOOST_SERIALIZATION_DECL void | |
-void_caster::recursive_register(bool includes_virtual_base) const { | |
- void_cast_detail::set_type & s | |
- = void_cast_detail::void_caster_registry::get_mutable_instance(); | |
- | |
- #ifdef BOOST_SERIALIZATION_LOG | |
- std::clog << "recursive_register\n"; | |
- std::clog << m_derived->get_debug_info(); | |
- std::clog << "<-"; | |
- std::clog << m_base->get_debug_info(); | |
- std::clog << "\n"; | |
- #endif | |
- | |
- std::pair<void_cast_detail::set_type::const_iterator, bool> result; | |
- // comment this out for now. | |
- result = s.insert(this); | |
- //assert(result.second); | |
- | |
- // generate all implied void_casts. | |
- void_cast_detail::set_type::const_iterator it; | |
- for(it = s.begin(); it != s.end(); ++it){ | |
- if(* m_derived == * (*it)->m_base){ | |
- const void_caster_argument vca( | |
- (*it)->m_derived, | |
- m_base | |
- ); | |
- void_cast_detail::set_type::const_iterator i; | |
- i = s.find(& vca); | |
- if(i == s.end()){ | |
- new void_caster_shortcut( | |
- (*it)->m_derived, | |
- m_base, | |
- m_difference + (*it)->m_difference, | |
- (*it)->has_virtual_base() || includes_virtual_base, | |
- this | |
- ); | |
- } | |
- } | |
- if(* (*it)->m_derived == * m_base){ | |
- const void_caster_argument vca( | |
- m_derived, | |
- (*it)->m_base | |
- ); | |
- void_cast_detail::set_type::const_iterator i; | |
- i = s.find(& vca); | |
- if(i == s.end()){ | |
- new void_caster_shortcut( | |
- m_derived, | |
- (*it)->m_base, | |
- m_difference + (*it)->m_difference, | |
- (*it)->has_virtual_base() || includes_virtual_base, | |
- this | |
- ); | |
- } | |
- } | |
- } | |
-} | |
- | |
-BOOST_SERIALIZATION_DECL void | |
-void_caster::recursive_unregister() const { | |
- // note: it's been discovered that at least one platform is not guaranteed | |
- // to destroy singletons reverse order of construction. So we can't | |
- // use a runtime assert here. Leave this in a reminder not to do this! | |
- // BOOST_ASSERT(! void_caster_registry::is_destroyed()); | |
- if(void_caster_registry::is_destroyed()) | |
- return; | |
- | |
- #ifdef BOOST_SERIALIZATION_LOG | |
- std::clog << "recursive_unregister\n"; | |
- std::clog << m_derived->get_debug_info(); | |
- std::clog << "<-"; | |
- std::clog << m_base->get_debug_info(); | |
- std::clog << "\n"; | |
- #endif | |
- | |
- void_cast_detail::set_type & s | |
- = void_caster_registry::get_mutable_instance(); | |
- | |
- // delete all shortcuts which use this primitive | |
- void_cast_detail::set_type::iterator it; | |
- for(it = s.begin(); it != s.end();){ | |
- const void_caster * vc = *it; | |
- if(vc == this){ | |
- s.erase(it++); | |
- } | |
- else | |
- if(vc->m_parent == this){ | |
- s.erase(it); | |
- delete vc; | |
- it = s.begin(); | |
- } | |
- else | |
- it++; | |
- } | |
-} | |
- | |
-} // namespace void_cast_detail | |
- | |
-BOOST_SYMBOL_VISIBLE void const * | |
-void_upcast( | |
- extended_type_info const & derived, | |
- extended_type_info const & base, | |
- void const * const t | |
-); | |
- | |
-// Given a void *, assume that it really points to an instance of one type | |
-// and alter it so that it would point to an instance of a related type. | |
-// Return the altered pointer. If there exists no sequence of casts that | |
-// can transform from_type to to_type, return a NULL. | |
-BOOST_SERIALIZATION_DECL void const * | |
-void_upcast( | |
- extended_type_info const & derived, | |
- extended_type_info const & base, | |
- void const * const t | |
-){ | |
- // same types - trivial case | |
- if (derived == base) | |
- return t; | |
- | |
- // check to see if base/derived pair is found in the registry | |
- const void_cast_detail::set_type & s | |
- = void_cast_detail::void_caster_registry::get_const_instance(); | |
- const void_cast_detail::void_caster_argument ca(& derived, & base); | |
- | |
- void_cast_detail::set_type::const_iterator it; | |
- it = s.find(& ca); | |
- if (s.end() != it) | |
- return (*it)->upcast(t); | |
- | |
- return NULL; | |
-} | |
- | |
-BOOST_SYMBOL_VISIBLE void const * | |
-void_downcast( | |
- extended_type_info const & derived, | |
- extended_type_info const & base, | |
- void const * const t | |
-); | |
- | |
-BOOST_SERIALIZATION_DECL void const * | |
-void_downcast( | |
- extended_type_info const & derived, | |
- extended_type_info const & base, | |
- void const * const t | |
-){ | |
- // same types - trivial case | |
- if (derived == base) | |
- return t; | |
- | |
- // check to see if base/derived pair is found in the registry | |
- const void_cast_detail::set_type & s | |
- = void_cast_detail::void_caster_registry::get_const_instance(); | |
- const void_cast_detail::void_caster_argument ca(& derived, & base); | |
- | |
- void_cast_detail::set_type::const_iterator it; | |
- it = s.find(&ca); | |
- if (s.end() != it) | |
- return(*it)->downcast(t); | |
- | |
- return NULL; | |
-} | |
- | |
-} // namespace serialization | |
-} // namespace boost | |
diff --git a/src/mlpack/bindings/R/mlpack/src/rcpp_mlpack.h b/src/mlpack/bindings/R/mlpack/src/rcpp_mlpack.h | |
index 14d9823ae..8743733c5 100644 | |
--- a/src/mlpack/bindings/R/mlpack/src/rcpp_mlpack.h | |
+++ b/src/mlpack/bindings/R/mlpack/src/rcpp_mlpack.h | |
@@ -15,6 +15,8 @@ | |
#include <Rcpp.h> | |
+#define CEREAL_ARCHIVES_JSON_HPP_ | |
+ | |
// To suppress Found ‘__assert_fail’, possibly from ‘assert’ (C). | |
#define BOOST_DISABLE_ASSERTS | |
diff --git a/src/mlpack/core/cereal/is_loading.hpp b/src/mlpack/core/cereal/is_loading.hpp | |
index 4590b13bd..371f4a3d2 100644 | |
--- a/src/mlpack/core/cereal/is_loading.hpp | |
+++ b/src/mlpack/core/cereal/is_loading.hpp | |
@@ -21,6 +21,10 @@ | |
#include <cereal/archives/xml.hpp> | |
#include <cereal/archives/json.hpp> | |
namespace cereal { | |
template<typename Archive> | |
@@ -29,7 +33,9 @@ struct is_cereal_archive | |
// Archive::is_loading is not implemented yet, so we can use std::is_same<> | |
// to check if it is a loading archive. | |
constexpr static bool value = std::is_same<Archive, cereal::BinaryInputArchive>::value || | |
- std::is_same<Archive, cereal::JSONInputArchive>::value || | |
+#if (BINDING_TYPE != BINDING_TYPE_R) | |
+std::is_same<Archive, cereal::JSONInputArchive>::value || | |
+#endif | |
std::is_same<Archive, cereal::XMLInputArchive>::value; | |
}; | |
diff --git a/src/mlpack/core/cereal/is_saving.hpp b/src/mlpack/core/cereal/is_saving.hpp | |
index 8df76382d..e88556825 100644 | |
--- a/src/mlpack/core/cereal/is_saving.hpp | |
+++ b/src/mlpack/core/cereal/is_saving.hpp | |
@@ -30,8 +30,10 @@ struct is_cereal_archive_saving | |
// Archive::is_saving is not implemented yet, so we can use std::is_same<> | |
// to check if it is a loading archive. | |
constexpr static bool value = std::is_same<Archive, cereal::BinaryOutputArchive>::value || | |
- std::is_same<Archive, cereal::JSONOutputArchive>::value || | |
- std::is_same<Archive, cereal::XMLOutputArchive>::value; | |
+#if (BINDING_TYPE != BINDING_TYPE_R) | |
+std::is_same<Archive, cereal::JSONOutputArchive>::value || | |
+#endif | |
+ std::is_same<Archive, cereal::XMLOutputArchive>::value; | |
}; | |
template<typename Archive> | |
diff --git a/src/mlpack/core/data/load_model_impl.hpp b/src/mlpack/core/data/load_model_impl.hpp | |
index ac80b6aca..af6940d4b 100644 | |
--- a/src/mlpack/core/data/load_model_impl.hpp | |
+++ b/src/mlpack/core/data/load_model_impl.hpp | |
@@ -91,12 +91,13 @@ bool Load(const std::string& filename, | |
cereal::XMLInputArchive ar(ifs); | |
ar(cereal::make_nvp(name.c_str(), t)); | |
} | |
- | |
+#if (BINDING_TYPE != BINDING_TYPE_R) | |
else if (f == format::json) | |
{ | |
cereal::JSONInputArchive ar(ifs); | |
ar(cereal::make_nvp(name.c_str(), t)); | |
} | |
+#endif | |
else if (f == format::binary) | |
{ | |
cereal::BinaryInputArchive ar(ifs); | |
diff --git a/src/mlpack/core/data/save_impl.hpp b/src/mlpack/core/data/save_impl.hpp | |
index 3a437c9fe..2fc936aa6 100644 | |
--- a/src/mlpack/core/data/save_impl.hpp | |
+++ b/src/mlpack/core/data/save_impl.hpp | |
@@ -375,11 +375,13 @@ bool Save(const std::string& filename, | |
cereal::XMLOutputArchive ar(ofs); | |
ar(cereal::make_nvp(name.c_str(), t)); | |
} | |
+#if (BINDING_TYPE != BINDING_TYPE_R) | |
else if (f == format::json) | |
{ | |
cereal::JSONOutputArchive ar(ofs); | |
ar(cereal::make_nvp(name.c_str(), t)); | |
} | |
+#endif | |
else if (f == format::binary) | |
{ | |
cereal::BinaryOutputArchive ar(ofs); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment