diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a18d4236..09ff68d1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -56,7 +56,7 @@ jobs: - name: Install dependencies (Mac) if: matrix.os == 'macos-latest' run: | - brew install swig boost ${{ matrix.install }} + brew install swig boost log4cxx ${{ matrix.install }} pip install coverage - name: Build and test run: | diff --git a/CMakeLists.txt b/CMakeLists.txt index a60daaca..734992b3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -134,7 +134,7 @@ set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib) # Version information set (RMF_VERSION_MAJOR 1) -set (RMF_VERSION_MINOR 3) +set (RMF_VERSION_MINOR 4) set(RMF_SOVERSION "${RMF_VERSION_MAJOR}.${RMF_VERSION_MINOR}" CACHE INTERNAL "" FORCE) set(RMF_HAS_DEBUG_VECTOR 0 CACHE BOOL "Whether to use a bounds checked vector") diff --git a/ChangeLog.md b/ChangeLog.md index 5c23cc54..c9bd1844 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,6 +1,14 @@ Change Log {#changelog} ========== +# 1.4 - 2022-03-10 # {#changelog_1_4} +- RMF now requires a C++11 compiler and SWIG 3 (or later) to build. Most + recent compilers should support C++11, such as gcc, clang + or MS Visual Studio 2012 or later. Various macro and header workarounds + for pre-C++11 environments are thus no longer needed and are deprecated: + `RMF_FINAL`, `RMF_OVERRIDE`, and `RMF_FOREACH`. +- Build fixes for latest log4cxx, in C++17 mode, or with newer versions of gcc. + # 1.3.1 - 2021-12-01 # {#changelog_1_3_1} - Various build fixes for newer versions of gcc and clang. - Build fixes for Fedora 33 or later. diff --git a/README.md b/README.md index 4afbaa79..61ab395a 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ and score data. The main documentation is found on the [web site](http://integrativemodeling.org/rmf/nightly/doc/). -Copyright 2007-2021 IMP Inventors. +Copyright 2007-2022 IMP Inventors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/benchmark/benchmark_rmf.cpp b/benchmark/benchmark_rmf.cpp index d95408e9..709acc51 100644 --- a/benchmark/benchmark_rmf.cpp +++ b/benchmark/benchmark_rmf.cpp @@ -2,7 +2,7 @@ * \brief Benchmark typical creation, traversal and loading with different RMF * backends. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. */ #include @@ -110,7 +110,7 @@ std::pair create_frame(RMF::FileHandle fh, int frame) { RMF::Vector3 ret(0, 0, 0); std::size_t total_size = 0; - RMF_FOREACH(RMF::NodeID n, atoms) { + for(RMF::NodeID n : atoms) { RMF::Vector3 v((n.get_index() + 0 + frame) / 17.0, (n.get_index() + 1 + frame) / 19.0, (n.get_index() + 2 + frame) / 23.0); @@ -125,7 +125,7 @@ std::pair create_frame(RMF::FileHandle fh, boost::tuple create(RMF::FileHandle file, RMF::NodeIDs& atoms) { std::size_t hierarchy_size = create_hierarchy(file); - RMF_FOREACH(RMF::NodeID n, file.get_node_ids()) { + for(RMF::NodeID n : file.get_node_ids()) { if (file.get_node(n).get_children().empty()) { atoms.push_back(n); } @@ -166,9 +166,9 @@ double traverse(RMF::FileConstHandle file) { double load(RMF::FileConstHandle file, const RMF::NodeIDs& nodes) { RMF::decorator::IntermediateParticleFactory ipcf(file); RMF::Vector3 v(0, 0, 0); - RMF_FOREACH(RMF::FrameID fr, file.get_frames()) { + for(RMF::FrameID fr : file.get_frames()) { file.set_current_frame(fr); - RMF_FOREACH(RMF::NodeID n, nodes) { + for(RMF::NodeID n : nodes) { RMF::Vector3 cur = ipcf.get(file.get_node(n)).get_coordinates(); v[0] += cur[0]; v[1] += cur[1]; @@ -208,7 +208,7 @@ void benchmark_traverse(RMF::FileConstHandle file, std::string type) { void benchmark_load(RMF::FileConstHandle file, std::string type) { RMF::NodeIDs nodes; RMF::decorator::ParticleFactory ipcf(file); - RMF_FOREACH(RMF::NodeID n, file.get_node_ids()) { + for(RMF::NodeID n : file.get_node_ids()) { if (ipcf.get_is(file.get_node(n))) nodes.push_back(n); } boost::timer timer; diff --git a/bin/common.h b/bin/common.h index 9f6ed957..e8037dcd 100644 --- a/bin/common.h +++ b/bin/common.h @@ -1,6 +1,6 @@ /** * \file common.h - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. */ #ifndef RMF_COMMON_H diff --git a/bin/rmf3_dump.cpp b/bin/rmf3_dump.cpp index 5f526453..06f6e849 100644 --- a/bin/rmf3_dump.cpp +++ b/bin/rmf3_dump.cpp @@ -1,5 +1,5 @@ /** - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. */ #include diff --git a/bin/rmf_cat.cpp b/bin/rmf_cat.cpp index 9d73a7b9..c0d11e15 100644 --- a/bin/rmf_cat.cpp +++ b/bin/rmf_cat.cpp @@ -1,5 +1,5 @@ /** - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. */ #include @@ -44,7 +44,7 @@ int main(int argc, char** argv) { RMF::clone_static_frame(rh, orh); } orh.set_description(orh.get_description() + "\n" + rh.get_description()); - RMF_FOREACH(RMF::FrameID ni, rh.get_frames()) { + for(RMF::FrameID ni : rh.get_frames()) { rh.set_current_frame(ni); orh.add_frame(rh.get_name(ni), rh.get_type(ni)); RMF::clone_loaded_frame(rh, orh); diff --git a/bin/rmf_frames.cpp b/bin/rmf_frames.cpp index 6c796930..82dd48f6 100644 --- a/bin/rmf_frames.cpp +++ b/bin/rmf_frames.cpp @@ -1,5 +1,5 @@ /** - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. */ #include diff --git a/bin/rmf_info.cpp b/bin/rmf_info.cpp index bd5c2756..eba41a7b 100644 --- a/bin/rmf_info.cpp +++ b/bin/rmf_info.cpp @@ -1,5 +1,5 @@ /** - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. */ #include diff --git a/bin/rmf_interpolate.cpp b/bin/rmf_interpolate.cpp index cd161f32..983c5e0a 100644 --- a/bin/rmf_interpolate.cpp +++ b/bin/rmf_interpolate.cpp @@ -1,5 +1,5 @@ /** - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. */ #include diff --git a/bin/rmf_pdb.cpp b/bin/rmf_pdb.cpp index 0369709d..aba75052 100644 --- a/bin/rmf_pdb.cpp +++ b/bin/rmf_pdb.cpp @@ -1,5 +1,5 @@ /** - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. */ #include // IWYU pragma: keep diff --git a/bin/rmf_show.cpp b/bin/rmf_show.cpp index adf699f7..ee3b38b3 100644 --- a/bin/rmf_show.cpp +++ b/bin/rmf_show.cpp @@ -1,5 +1,5 @@ /** - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. */ #include diff --git a/bin/rmf_signature.cpp b/bin/rmf_signature.cpp index 5a273cc0..e06be3e0 100644 --- a/bin/rmf_signature.cpp +++ b/bin/rmf_signature.cpp @@ -1,5 +1,5 @@ /** - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. */ #include diff --git a/bin/rmf_slice.cpp b/bin/rmf_slice.cpp index a81d20f5..072b8afd 100644 --- a/bin/rmf_slice.cpp +++ b/bin/rmf_slice.cpp @@ -1,5 +1,5 @@ /** - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. */ #include @@ -36,7 +36,7 @@ int main(int argc, char** argv) { RMF::clone_static_frame(rh, orh); if(!quiet) std::cout << "Copying frames"; unsigned num_copied = 0; - RMF_FOREACH(RMF::FrameID f, rh.get_frames()) { + for(RMF::FrameID f : rh.get_frames()) { if (f.get_index() < static_cast(start_frame)) continue; if ((f.get_index() - start_frame) % step_frame != 0) continue; rh.set_current_frame(f); diff --git a/bin/rmf_transform.cpp b/bin/rmf_transform.cpp index 91d01733..25cee949 100644 --- a/bin/rmf_transform.cpp +++ b/bin/rmf_transform.cpp @@ -1,5 +1,5 @@ /** - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. */ #include @@ -116,7 +116,7 @@ int main(int argc, char** argv) { RMF::decorator::BallFactory bf(rh); RMF::decorator::CylinderFactory cf(rh); RMF::decorator::SegmentFactory sf(rh); - RMF_FOREACH(RMF::FrameID frame, rhi.get_frames()) { + for(RMF::FrameID frame : rhi.get_frames()) { RMF::clone_loaded_frame(rhi, rh); RMF_INFO("Processing frame " << frame); rh.set_current_frame(frame); diff --git a/bin/rmf_update.cpp b/bin/rmf_update.cpp index 0064d7e4..b81d8f72 100644 --- a/bin/rmf_update.cpp +++ b/bin/rmf_update.cpp @@ -1,5 +1,5 @@ /** - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. */ #include #include diff --git a/bin/rmf_validate.cpp b/bin/rmf_validate.cpp index f13351e3..317ef542 100644 --- a/bin/rmf_validate.cpp +++ b/bin/rmf_validate.cpp @@ -1,5 +1,5 @@ /** - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. */ #include diff --git a/bin/rmf_xml.cpp b/bin/rmf_xml.cpp index 542d60de..40c3a338 100644 --- a/bin/rmf_xml.cpp +++ b/bin/rmf_xml.cpp @@ -1,5 +1,5 @@ /** - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. */ #include diff --git a/cmake_modules/IMPFindC++11.cmake b/cmake_modules/IMPFindC++11.cmake index 509bec1a..f5ce215e 100644 --- a/cmake_modules/IMPFindC++11.cmake +++ b/cmake_modules/IMPFindC++11.cmake @@ -1,59 +1,55 @@ -if(NOT DEFINED IMP_CXX11) - set(IMP_CXX11 1 CACHE BOOL "Whether to use C++11 if possible") -endif() - # Put flags in a cmake variable so we can set them before running compiler # checks (elsewhere in the build) set(IMP_CXX11_FLAGS "" CACHE INTERNAL "Flags to enable C++11 support" FORCE) -if(IMP_CXX11) - if (APPLE) - execute_process(COMMAND uname -v OUTPUT_VARIABLE DARWIN_VERSION) - string(REGEX MATCH "[0-9]+" DARWIN_VERSION ${DARWIN_VERSION}) - endif() +if (APPLE) + execute_process(COMMAND uname -v OUTPUT_VARIABLE DARWIN_VERSION) + string(REGEX MATCH "[0-9]+" DARWIN_VERSION ${DARWIN_VERSION}) +endif() - if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU") - execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE - GCC_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE) - message(STATUS "GCC version: ${GCC_VERSION}") - if (GCC_VERSION VERSION_GREATER 6.1 OR GCC_VERSION VERSION_EQUAL 6.1) - # gcc 6.1 and up use C++14 by default, so no explicit switch required - # (in fact adding --std=c++11 will break compilation of packages that - # require C++14 features, like CGAL 5). - message(STATUS "Using g++ C++11 (or later) support") - elseif (GCC_VERSION VERSION_GREATER 4.7 OR GCC_VERSION VERSION_EQUAL 4.7) - message(STATUS "Enabling g++ C++11 support") - set(IMP_CXX11_FLAGS "--std=c++11" CACHE INTERNAL "" FORCE) - elseif (GCC_VERSION VERSION_GREATER 4.3 OR GCC_VERSION VERSION_EQUAL 4.3) - message(STATUS "Enabling g++ C++0x support") - set(IMP_CXX11_FLAGS "--std=c++0x" CACHE INTERNAL "" FORCE) - endif() - elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") - execute_process(COMMAND ${CMAKE_CXX_COMPILER} --version - OUTPUT_VARIABLE CLANG_VERSION) - if(CLANG_VERSION MATCHES "clang version ([0-9.]+)") - set(CLANG_VERSION ${CMAKE_MATCH_1}) - endif() - message(STATUS "clang version: ${CLANG_VERSION}") - # Modern clang (6 or later) uses C++14 by default; don't force older C++11 - if(CLANG_VERSION VERSION_GREATER 6.0) - message(STATUS "Enabling clang C++17 support") - set(IMP_CXX11_FLAGS "--std=c++17" CACHE INTERNAL "" FORCE) - # c++11's std::move (which boost/CGAL use) doesn't work until - # OS X 10.9 (Darwin version 13) - elseif(APPLE AND DARWIN_VERSION LESS 13) - message(STATUS "Disabling C++11 for mac os < 10.9") - elseif(BOOST_VERSION LESS 105000) - message(STATUS "Disabling C++11 due to clang and older boost") - else() - message(STATUS "Enabling clang C++11 support") - set(IMP_CXX11_FLAGS "--std=c++11" CACHE INTERNAL "" FORCE) - endif() - elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") - message(STATUS "Using MSVC C++11 support") +if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU") + execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE + GCC_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE) + message(STATUS "GCC version: ${GCC_VERSION}") + if (GCC_VERSION VERSION_GREATER 6.1 OR GCC_VERSION VERSION_EQUAL 6.1) + # gcc 6.1 and up use C++14 by default, so no explicit switch required + # (in fact adding --std=c++11 will break compilation of packages that + # require C++14 features, like CGAL 5). + message(STATUS "Using g++ C++11 (or later) support") + elseif (GCC_VERSION VERSION_GREATER 4.7 OR GCC_VERSION VERSION_EQUAL 4.7) + message(STATUS "Enabling g++ C++11 support") + set(IMP_CXX11_FLAGS "--std=c++11" CACHE INTERNAL "" FORCE) + elseif (GCC_VERSION VERSION_GREATER 4.3 OR GCC_VERSION VERSION_EQUAL 4.3) + message(STATUS "Enabling g++ C++0x support") + set(IMP_CXX11_FLAGS "--std=c++0x" CACHE INTERNAL "" FORCE) + else() + message(FATAL_ERROR "IMP requires a C++11 compiler, but this GCC appears to be too old to support C++11") + endif() +elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") + execute_process(COMMAND ${CMAKE_CXX_COMPILER} --version + OUTPUT_VARIABLE CLANG_VERSION) + if(CLANG_VERSION MATCHES "clang version ([0-9.]+)") + set(CLANG_VERSION ${CMAKE_MATCH_1}) + endif() + message(STATUS "clang version: ${CLANG_VERSION}") + # Modern clang (6 or later) uses C++14 by default; don't force older C++11 + if(CLANG_VERSION VERSION_GREATER 6.0) + message(STATUS "Enabling clang C++17 support") + set(IMP_CXX11_FLAGS "--std=c++17" CACHE INTERNAL "" FORCE) + # c++11's std::move (which boost/CGAL use) doesn't work until + # OS X 10.9 (Darwin version 13) + elseif(APPLE AND DARWIN_VERSION LESS 13) + message(FATAL_ERROR "IMP requires a C++11 compiler, but this version of OS X is too old to properly support C++11") + elseif(BOOST_VERSION LESS 105000) + message(FATAL_ERROR "IMP requires a C++11 compiler, but this version of Boost is too old to properly support C++11") else() - message(STATUS "Unknown compiler, not sure what to do about C++11") + message(STATUS "Enabling clang C++11 support") + set(IMP_CXX11_FLAGS "--std=c++11" CACHE INTERNAL "" FORCE) endif() +elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") + message(STATUS "Using MSVC C++11 support") +else() + message(STATUS "Unknown compiler, not sure what to do about C++11") endif() if(IMP_CXX11_FLAGS) diff --git a/config.h.in b/config.h.in index 8f2f12a7..dda2d498 100644 --- a/config.h.in +++ b/config.h.in @@ -4,7 +4,7 @@ * Provide version information, plus macros to mark functions and * classes as exported from a DLL/.so and to set up namespaces. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/doc/Main.md b/doc/Main.md index ebdf721e..7de426e7 100644 --- a/doc/Main.md +++ b/doc/Main.md @@ -19,7 +19,7 @@ See Also see the [rmf examples](https://github.com/salilab/rmf_examples) repository for examples of interesting or problematic RMF files. -Copyright 2007-2021 IMP Inventors. +Copyright 2007-2022 IMP Inventors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/include/RMF/BufferConstHandle.h b/include/RMF/BufferConstHandle.h index 814377ba..4aa71609 100644 --- a/include/RMF/BufferConstHandle.h +++ b/include/RMF/BufferConstHandle.h @@ -2,7 +2,7 @@ * \file RMF/BufferConstHandle.h * \brief Declare RMF::BufferConstHandle. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/include/RMF/BufferHandle.h b/include/RMF/BufferHandle.h index 1b93b907..7392f40b 100644 --- a/include/RMF/BufferHandle.h +++ b/include/RMF/BufferHandle.h @@ -2,7 +2,7 @@ * \file RMF/BufferHandle.h * \brief Declare RMF::BufferHandle. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/include/RMF/CoordinateTransformer.h b/include/RMF/CoordinateTransformer.h index d3563570..ed58817a 100644 --- a/include/RMF/CoordinateTransformer.h +++ b/include/RMF/CoordinateTransformer.h @@ -2,7 +2,7 @@ * \file RMF/CoordinateTransformer.h * \brief Declare the RMF::CoordinateTransformer class. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/include/RMF/Decorator.h b/include/RMF/Decorator.h index 17cd0f2a..7fa6c984 100644 --- a/include/RMF/Decorator.h +++ b/include/RMF/Decorator.h @@ -2,7 +2,7 @@ * \file RMF/Decorator.h * \brief Mostly empty base classes for decorators and factories. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/include/RMF/Enum.h b/include/RMF/Enum.h index a9085fa5..5269f4fc 100644 --- a/include/RMF/Enum.h +++ b/include/RMF/Enum.h @@ -2,7 +2,7 @@ * \file RMF/Enum.h * \brief Declaration of RMF::Enum. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/include/RMF/FileConstHandle.h b/include/RMF/FileConstHandle.h index 629d432d..518fea48 100644 --- a/include/RMF/FileConstHandle.h +++ b/include/RMF/FileConstHandle.h @@ -2,7 +2,7 @@ * \file RMF/FileConstHandle.h * \brief Handle read/write of Model data from/to files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/include/RMF/FileHandle.h b/include/RMF/FileHandle.h index dc332dad..d77abb8e 100644 --- a/include/RMF/FileHandle.h +++ b/include/RMF/FileHandle.h @@ -2,7 +2,7 @@ * \file RMF/FileHandle.h * \brief Declaration for RMF::FileHandle. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/include/RMF/HDF5/ConstAttributes.h b/include/RMF/HDF5/ConstAttributes.h index 8b4e6ac9..fbfdcf9b 100644 --- a/include/RMF/HDF5/ConstAttributes.h +++ b/include/RMF/HDF5/ConstAttributes.h @@ -2,7 +2,7 @@ * \file RMF/HDF5/ConstAttributes.h * \brief Handle read/write of Model data from/to files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/include/RMF/HDF5/ConstDataSetD.h b/include/RMF/HDF5/ConstDataSetD.h index 0fc91eff..9f718b0d 100644 --- a/include/RMF/HDF5/ConstDataSetD.h +++ b/include/RMF/HDF5/ConstDataSetD.h @@ -2,7 +2,7 @@ * \file RMF/HDF5/ConstDataSetD.h * \brief Handle read/write of Model data from/to files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ @@ -72,7 +72,7 @@ class ConstDataSetD : public ConstDataSetAttributes { } void initialize() { hsize_t one = 1; - data_->ids_.open(H5Screate_simple(1, &one, NULL), &H5Sclose); + data_->ids_.open(H5Screate_simple(1, &one, nullptr), &H5Sclose); std::fill(data_->ones_, data_->ones_ + D, 1); // pos_.reset(new hsize_t[dim_]); // sel_= new SharedHandle(H5Dget_space(h_->get_hid()), &H5Sclose); @@ -139,19 +139,19 @@ class ConstDataSetD : public ConstDataSetAttributes { // must be second hsize_t ret[D]; std::fill(ret, ret + D, -1); - RMF_HDF5_CALL(H5Sget_simple_extent_dims(get_data_space(), ret, NULL)); + RMF_HDF5_CALL(H5Sget_simple_extent_dims(get_data_space(), ret, nullptr)); RMF_INTERNAL_CHECK(ret[D - 1] < 1000000, "extents not returned properly"); if (ret[D - 1] > 0) { // some versions will spew an error on this // we will call this function again before rds_ is needed // std::cout << "initializing row to " << ret[data_->dim_-1] << std::endl; - data_->rds_.open(H5Screate_simple(1, ret + D - 1, NULL), &H5Sclose); + data_->rds_.open(H5Screate_simple(1, ret + D - 1, nullptr), &H5Sclose); } else { // std::cout << "clearing row data" << std::endl; data_->rds_.close(); } RMF_HDF5_CALL(H5Sget_simple_extent_dims(get_data_space(), - data_->size_.begin(), NULL)); + data_->size_.begin(), nullptr)); } public: @@ -182,7 +182,7 @@ class ConstDataSetD : public ConstDataSetAttributes { // RMF_HDF5_HANDLE(sel, H5Dget_space(h_->get_hid()), &H5Sclose); RMF_HDF5_CALL(H5Sselect_hyperslab(get_data_space(), H5S_SELECT_SET, ijk.get(), data_->ones_, data_->ones_, - NULL)); + nullptr)); return TypeTraits::read_value_dataset( Object::get_handle(), data_->ids_.get_hid(), get_data_space()); } @@ -199,7 +199,8 @@ class ConstDataSetD : public ConstDataSetAttributes { size[D - 1] = get_size()[D - 1]; // set last to size of row // RMF_HDF5_HANDLE(sel, H5Dget_space(h_->get_hid()), &H5Sclose); RMF_HDF5_CALL(H5Sselect_hyperslab(get_data_space(), H5S_SELECT_SET, - ijk.get(), data_->ones_, &size[0], NULL)); + ijk.get(), data_->ones_, &size[0], + nullptr)); return TypeTraits::read_values_dataset(Object::get_handle(), get_row_data_space().get_hid(), get_data_space(), size[D - 1]); @@ -216,8 +217,8 @@ class ConstDataSetD : public ConstDataSetAttributes { // RMF_HDF5_HANDLE(sel, H5Dget_space(h_->get_hid()), &H5Sclose); RMF_HDF5_CALL(H5Sselect_hyperslab(get_data_space(), H5S_SELECT_SET, lb.get(), data_->ones_, size.get(), - NULL)); - RMF_HDF5_HANDLE(input, H5Screate_simple(1, &total, NULL), &H5Sclose); + nullptr)); + RMF_HDF5_HANDLE(input, H5Screate_simple(1, &total, nullptr), &H5Sclose); typename TypeTraits::Types ret = TypeTraits::read_values_dataset( Object::get_handle(), input, get_data_space(), total); RMF_INTERNAL_CHECK(ret.size() == total, "Size mismatch"); diff --git a/include/RMF/HDF5/ConstFile.h b/include/RMF/HDF5/ConstFile.h index d9d74872..efc3f6b2 100644 --- a/include/RMF/HDF5/ConstFile.h +++ b/include/RMF/HDF5/ConstFile.h @@ -2,7 +2,7 @@ * \file RMF/HDF5/ConstFile.h * \brief Handle read/write of Model data from/to files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/include/RMF/HDF5/ConstGroup.h b/include/RMF/HDF5/ConstGroup.h index db3de114..4b3afa0c 100644 --- a/include/RMF/HDF5/ConstGroup.h +++ b/include/RMF/HDF5/ConstGroup.h @@ -2,7 +2,7 @@ * \file RMF/HDF5/ConstGroup.h * \brief Handle read/write of Model data from/to files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/include/RMF/HDF5/DataSetAccessPropertiesD.h b/include/RMF/HDF5/DataSetAccessPropertiesD.h index fcadeb77..c2c0a508 100644 --- a/include/RMF/HDF5/DataSetAccessPropertiesD.h +++ b/include/RMF/HDF5/DataSetAccessPropertiesD.h @@ -2,7 +2,7 @@ * \file RMF/HDF5/DataSetAccessPropertiesD.h * \brief Handle read/write of Model data from/to files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/include/RMF/HDF5/DataSetCreationPropertiesD.h b/include/RMF/HDF5/DataSetCreationPropertiesD.h index a895336c..9e3bcda6 100644 --- a/include/RMF/HDF5/DataSetCreationPropertiesD.h +++ b/include/RMF/HDF5/DataSetCreationPropertiesD.h @@ -2,7 +2,7 @@ * \file RMF/HDF5/DataSetCreationPropertiesD.h * \brief Handle read/write of Model data from/to files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/include/RMF/HDF5/DataSetD.h b/include/RMF/HDF5/DataSetD.h index 05d39872..6315a2a0 100644 --- a/include/RMF/HDF5/DataSetD.h +++ b/include/RMF/HDF5/DataSetD.h @@ -2,7 +2,7 @@ * \file RMF/HDF5/DataSetD.h * \brief Handle read/write of Model data from/to files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ @@ -58,7 +58,7 @@ class DataSetD : public MutableAttributes > { // RMF_HDF5_HANDLE(sel, H5Dget_space(h_->get_hid()), &H5Sclose); RMF_HDF5_CALL(H5Sselect_hyperslab(P::get_data_space(), H5S_SELECT_SET, ijk.get(), P::get_ones(), P::get_ones(), - NULL)); + nullptr)); TypeTraits::write_value_dataset(Object::get_handle(), P::get_input_data_space().get_hid(), P::get_data_space(), value); @@ -77,7 +77,7 @@ class DataSetD : public MutableAttributes > { // RMF_HDF5_HANDLE(sel, H5Dget_space(h_->get_hid()), &H5Sclose); RMF_HDF5_CALL(H5Sselect_hyperslab(P::get_data_space(), H5S_SELECT_SET, ijk.get(), P::get_ones(), &size[0], - NULL)); + nullptr)); TypeTraits::write_values_dataset(Object::get_handle(), P::get_row_data_space().get_hid(), P::get_data_space(), value); @@ -104,9 +104,9 @@ class DataSetD : public MutableAttributes > { // RMF_HDF5_HANDLE(sel, H5Dget_space(h_->get_hid()), &H5Sclose); RMF_HDF5_CALL(H5Sselect_hyperslab(P::get_data_space(), H5S_SELECT_SET, lb.get(), P::get_ones(), size.get(), - NULL)); + nullptr)); hsize_t sz = value.size(); - RMF_HDF5_HANDLE(input, H5Screate_simple(1, &sz, NULL), &H5Sclose); + RMF_HDF5_HANDLE(input, H5Screate_simple(1, &sz, nullptr), &H5Sclose); TypeTraits::write_values_dataset(Object::get_handle(), input, P::get_data_space(), value); } diff --git a/include/RMF/HDF5/DataSetIndexD.h b/include/RMF/HDF5/DataSetIndexD.h index 5c6ff4b8..0a6169fb 100644 --- a/include/RMF/HDF5/DataSetIndexD.h +++ b/include/RMF/HDF5/DataSetIndexD.h @@ -2,7 +2,7 @@ * \file RMF/HDF5/DataSetIndexD.h * \brief Handle read/write of Model data from/to files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/include/RMF/HDF5/File.h b/include/RMF/HDF5/File.h index 26d806f9..edf081f4 100644 --- a/include/RMF/HDF5/File.h +++ b/include/RMF/HDF5/File.h @@ -2,7 +2,7 @@ * \file RMF/HDF5/File.h * \brief Handle read/write of Model data from/to files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/include/RMF/HDF5/Group.h b/include/RMF/HDF5/Group.h index 42d8fe1e..6583a936 100644 --- a/include/RMF/HDF5/Group.h +++ b/include/RMF/HDF5/Group.h @@ -2,7 +2,7 @@ * \file RMF/HDF5/Group.h * \brief Handle read/write of Model data from/to files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/include/RMF/HDF5/MutableAttributes.h b/include/RMF/HDF5/MutableAttributes.h index 4f35b1b5..60793220 100644 --- a/include/RMF/HDF5/MutableAttributes.h +++ b/include/RMF/HDF5/MutableAttributes.h @@ -2,7 +2,7 @@ * \file RMF/HDF5/MutableAttributes.h * \brief Handle read/write of Model data from/to files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/include/RMF/HDF5/Object.h b/include/RMF/HDF5/Object.h index 81d2a005..05316bfa 100644 --- a/include/RMF/HDF5/Object.h +++ b/include/RMF/HDF5/Object.h @@ -2,7 +2,7 @@ * \file RMF/HDF5/Object.h * \brief Handle read/write of Model data from/to files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/include/RMF/HDF5/handle.h b/include/RMF/HDF5/handle.h index ee7722d7..6b99342e 100644 --- a/include/RMF/HDF5/handle.h +++ b/include/RMF/HDF5/handle.h @@ -2,7 +2,7 @@ * \file RMF/HDF5/handle.h * \brief Handle read/write of Model data from/to files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ @@ -49,7 +49,7 @@ class RMFEXPORT Handle : public boost::noncopyable { IOException); } } - Handle() : h_(-1), f_(NULL) {} + Handle() : h_(-1), f_(nullptr) {} hid_t get_hid() const { RMF_USAGE_CHECK(h_ >= 0, "Uninitialized handle used."); return h_; diff --git a/include/RMF/HDF5/infrastructure_macros.h b/include/RMF/HDF5/infrastructure_macros.h index afae11e5..f05ec25d 100644 --- a/include/RMF/HDF5/infrastructure_macros.h +++ b/include/RMF/HDF5/infrastructure_macros.h @@ -2,7 +2,7 @@ * \file RMF/HDF5/infrastructure_macros.h * \brief Various general useful macros for IMP. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/include/RMF/HDF5/internal/types.h b/include/RMF/HDF5/internal/types.h index a6901338..e397f378 100644 --- a/include/RMF/HDF5/internal/types.h +++ b/include/RMF/HDF5/internal/types.h @@ -2,7 +2,7 @@ * \file RMF/types.h * \brief Handle read/write of Model data from/to files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/include/RMF/HDF5/types.h b/include/RMF/HDF5/types.h index e4b04e2c..e5eda414 100644 --- a/include/RMF/HDF5/types.h +++ b/include/RMF/HDF5/types.h @@ -2,7 +2,7 @@ * \file RMF/HDF5/types.h * \brief Handle read/write of Model data from/to files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ @@ -205,7 +205,7 @@ struct SimplePluralTraits { if (data.len > 0) { data.p = const_cast(&v[0]); } else { - data.p = NULL; + data.p = nullptr; } RMF_HDF5_CALL( H5Dwrite(d, get_hdf5_memory_type(), iss, s, H5P_DEFAULT, &data)); diff --git a/include/RMF/ID.h b/include/RMF/ID.h index 80a6ef1d..674f4ebf 100644 --- a/include/RMF/ID.h +++ b/include/RMF/ID.h @@ -2,7 +2,7 @@ * \file RMF/ID.h * \brief Declaration of RMF::ID. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/include/RMF/Label.h b/include/RMF/Label.h index 0c72fc90..45269099 100644 --- a/include/RMF/Label.h +++ b/include/RMF/Label.h @@ -2,7 +2,7 @@ * \file RMF/Label.h * \brief Declaration of RMF::Label. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/include/RMF/NodeConstHandle.h b/include/RMF/NodeConstHandle.h index 0eafb21a..860963c1 100644 --- a/include/RMF/NodeConstHandle.h +++ b/include/RMF/NodeConstHandle.h @@ -2,7 +2,7 @@ * \file RMF/NodeConstHandle.h * \brief Declaration of NodeConstHandlke. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/include/RMF/NodeHandle.h b/include/RMF/NodeHandle.h index 2b5138e1..36e27ca9 100644 --- a/include/RMF/NodeHandle.h +++ b/include/RMF/NodeHandle.h @@ -2,7 +2,7 @@ * \file RMF/NodeHandle.h * \brief Declaration of NodeHandle. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/include/RMF/Nullable.h b/include/RMF/Nullable.h index bd9debde..af5aa9ad 100644 --- a/include/RMF/Nullable.h +++ b/include/RMF/Nullable.h @@ -2,7 +2,7 @@ * \file RMF/Nullable.h * \brief A helper class for allowing nice return of possibly null values. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ @@ -58,7 +58,7 @@ class Nullable { /** For python since it nicely becomes None. */ const T* get_ptr() const { if (get_is_null()) - return NULL; + return nullptr; else return &v_; } diff --git a/include/RMF/RestoreCurrentFrame.h b/include/RMF/RestoreCurrentFrame.h index eadf4cc5..daa51cdd 100644 --- a/include/RMF/RestoreCurrentFrame.h +++ b/include/RMF/RestoreCurrentFrame.h @@ -2,7 +2,7 @@ * \file RMF/RestoreCurrentFrame.h * \brief Restore the current frame when exiting a scope. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/include/RMF/SetCurrentFrame.h b/include/RMF/SetCurrentFrame.h index 0528f7b8..e3d66913 100644 --- a/include/RMF/SetCurrentFrame.h +++ b/include/RMF/SetCurrentFrame.h @@ -2,7 +2,7 @@ * \file RMF/SetCurrentFrame.h * \brief Temporarily change the current frame. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/include/RMF/TraverseHelper.h b/include/RMF/TraverseHelper.h index b9c3eb31..afd32e95 100644 --- a/include/RMF/TraverseHelper.h +++ b/include/RMF/TraverseHelper.h @@ -2,7 +2,7 @@ * \file RMF/TraverseHelper.h * \brief A helper class for managing data when traversing an RMF. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/include/RMF/Vector.h b/include/RMF/Vector.h index 2655ca2f..0d6108ce 100644 --- a/include/RMF/Vector.h +++ b/include/RMF/Vector.h @@ -2,7 +2,7 @@ * \file RMF/Vector.h * \brief Represent coordinates. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/include/RMF/compiler_macros.h b/include/RMF/compiler_macros.h index 64ba32ad..ecbcd589 100644 --- a/include/RMF/compiler_macros.h +++ b/include/RMF/compiler_macros.h @@ -2,7 +2,7 @@ * \file RMF/compiler_macros.h * \brief Various compiler workarounds * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. */ #ifndef RMF_INTERNAL_COMPILER_MACROS_H @@ -21,35 +21,11 @@ #endif #endif -#ifdef __clang__ -#define RMF_COMPILER_HAS_OVERRIDE 1 -#elif defined(__GNUC__) && __cplusplus >= 201103L -// probably should be finer here -#define RMF_COMPILER_HAS_OVERRIDE 1 -#else -#define RMF_COMPILER_HAS_OVERRIDE 0 -#endif - -#if RMF_COMPILER_HAS_OVERRIDE +// Deprecated; just use 'override' keyword instead #define RMF_OVERRIDE override -#else -#define RMF_OVERRIDE -#endif -#ifdef __clang__ -#define RMF_COMPILER_HAS_FINAL 1 -#elif defined(__GNUC__) && __cplusplus >= 201103L -// probably should be finer here -#define RMF_COMPILER_HAS_FINAL 1 -#else -#define RMF_COMPILER_HAS_FINAL 0 -#endif - -#if RMF_COMPILER_HAS_FINAL +// Deprecated; just use 'final' keyword instead #define RMF_FINAL final -#else -#define RMF_FINAL -#endif #if defined(__GNUC__) && __cplusplus >= 201103L #define RMF_HAS_NOEXCEPT 1 @@ -159,7 +135,7 @@ #define RMF_GCC_PROTOTYPES #endif -// Warn about missing RMF_OVERRIDE on virtual methods if gcc is new enough +// Warn about missing override on virtual methods if gcc is new enough #if __GNUC__ > 5 || (__GNUC__ == 5 && __GNUC_MINOR__ >= 1) #ifdef RMF_SWIG_WRAPPER #define RMF_GCC_OVERRIDE diff --git a/include/RMF/constants.h b/include/RMF/constants.h index c34dc798..d48cad8b 100644 --- a/include/RMF/constants.h +++ b/include/RMF/constants.h @@ -2,7 +2,7 @@ * \file RMF/constants.h * \brief Various constants. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/include/RMF/decorator/alternatives.h b/include/RMF/decorator/alternatives.h index 889ba229..dd2316f9 100644 --- a/include/RMF/decorator/alternatives.h +++ b/include/RMF/decorator/alternatives.h @@ -2,7 +2,7 @@ * \file RMF/decorator/alternatives.h * \brief Helper functions for manipulating RMF files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/include/RMF/decorator/bond.h b/include/RMF/decorator/bond.h index bbc13a75..ab93d6cb 100644 --- a/include/RMF/decorator/bond.h +++ b/include/RMF/decorator/bond.h @@ -2,7 +2,7 @@ * \file RMF/decorator/bond.h * \brief Helper functions for manipulating RMF files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/include/RMF/decorator/labels.h b/include/RMF/decorator/labels.h index 4ecf8e98..3202e6ff 100644 --- a/include/RMF/decorator/labels.h +++ b/include/RMF/decorator/labels.h @@ -2,7 +2,7 @@ * \file RMF/decorator/labels.h * \brief Helper functions for manipulating RMF files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/include/RMF/decorator/reference.h b/include/RMF/decorator/reference.h index fe23846f..21e6c088 100644 --- a/include/RMF/decorator/reference.h +++ b/include/RMF/decorator/reference.h @@ -2,7 +2,7 @@ * \file RMF/decorator/reference.h * \brief Add a pointer from a node to another reference node. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/include/RMF/decorator/representation.h b/include/RMF/decorator/representation.h index b0a3247c..303c9e3b 100644 --- a/include/RMF/decorator/representation.h +++ b/include/RMF/decorator/representation.h @@ -2,7 +2,7 @@ * \file RMF/decorator/representation.h * \brief Helper functions for manipulating RMF files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ @@ -33,7 +33,7 @@ class RepresentationConst : public Decorator { template std::vector get_it(const Ints &in) const { std::vector ret; - RMF_FOREACH(int i, in) { + for(int i : in) { ret.push_back(get_node().get_file().get_node(NodeID(i))); } return ret; @@ -77,13 +77,13 @@ class Representation : public RepresentationConst { Ints set_it(const std::vector &in) const { Ints ret; ret.reserve(in.size()); - RMF_FOREACH(T n, in) { ret.push_back(n.get_id().get_index()); } + for(T n : in) { ret.push_back(n.get_id().get_index()); } return ret; } Ints set_it(const NodeIDs &in) { Ints ret; ret.reserve(in.size()); - RMF_FOREACH(NodeID n, in) { ret.push_back(n.get_index()); } + for(NodeID n : in) { ret.push_back(n.get_index()); } return ret; } diff --git a/include/RMF/decorators.h b/include/RMF/decorators.h index 10349640..390c5fa9 100644 --- a/include/RMF/decorators.h +++ b/include/RMF/decorators.h @@ -2,7 +2,7 @@ * \file RMF/decorators.h * \brief Import all the decorators headers. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/include/RMF/enums.h b/include/RMF/enums.h index 6badbfad..87963a2f 100644 --- a/include/RMF/enums.h +++ b/include/RMF/enums.h @@ -2,7 +2,7 @@ * \file RMF/enums.h * \brief The various enums used in RMF. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/include/RMF/exceptions.h b/include/RMF/exceptions.h index 62231460..85b3c989 100644 --- a/include/RMF/exceptions.h +++ b/include/RMF/exceptions.h @@ -2,7 +2,7 @@ * \file RMF/exceptions.h * \brief Declarations of the various exception types. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ @@ -31,7 +31,7 @@ class RMFEXPORT Exception : public virtual std::exception, public: RMF_CXX11_DEFAULT_COPY_CONSTRUCTOR(Exception); Exception(); - const char* what() const RMF_NOEXCEPT RMF_OVERRIDE; + const char* what() const RMF_NOEXCEPT override; virtual ~Exception() RMF_NOEXCEPT; }; diff --git a/include/RMF/info.h b/include/RMF/info.h index 454d7a70..0874be91 100644 --- a/include/RMF/info.h +++ b/include/RMF/info.h @@ -2,7 +2,7 @@ * \file RMF/info.h * \brief Show info about the file. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/include/RMF/infrastructure_macros.h b/include/RMF/infrastructure_macros.h index 60cdd9d2..a1e02a51 100644 --- a/include/RMF/infrastructure_macros.h +++ b/include/RMF/infrastructure_macros.h @@ -2,7 +2,7 @@ * \file RMF/infrastructure_macros.h * \brief Various general useful macros for IMP. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ @@ -17,12 +17,9 @@ #include #include #include -#if defined(BOOST_NO_CXX11_RANGE_BASED_FOR) || BOOST_VERSION < 105300 -#define RMF_FOREACH(v, r) BOOST_FOREACH(v, r) -#include // IWYU pragma: export -#else + +// Deprecated: just use range-based for directly #define RMF_FOREACH(v, r) for (v : r) -#endif RMF_ENABLE_WARNINGS diff --git a/include/RMF/internal/SharedData.h b/include/RMF/internal/SharedData.h index f181f7e3..55817a73 100644 --- a/include/RMF/internal/SharedData.h +++ b/include/RMF/internal/SharedData.h @@ -2,7 +2,7 @@ * \file RMF/internal/SharedData.h * \brief Handle read/write of Model data from/to files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/include/RMF/internal/SharedDataCategory.h b/include/RMF/internal/SharedDataCategory.h index a094c154..3acff368 100644 --- a/include/RMF/internal/SharedDataCategory.h +++ b/include/RMF/internal/SharedDataCategory.h @@ -2,7 +2,7 @@ * \file RMF/internal/SharedData.h * \brief Handle read/write of Model data from/to files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ @@ -42,7 +42,7 @@ class SharedDataCategory { SharedDataCategory() {} Categories get_categories() const { Categories ret; - RMF_FOREACH(const CategoryData::From::value_type & it, data_.from_name) { + for(const auto &it : data_.from_name) { ret.push_back(it.second); } return ret; diff --git a/include/RMF/internal/SharedDataData.h b/include/RMF/internal/SharedDataData.h index 456e2b62..30889c7d 100644 --- a/include/RMF/internal/SharedDataData.h +++ b/include/RMF/internal/SharedDataData.h @@ -2,7 +2,7 @@ * \file RMF/internal/SharedData.h * \brief Handle read/write of Model data from/to files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ @@ -28,15 +28,9 @@ struct KeyData : public RMF_LARGE_UNORDERED_MAP { KeyData() {} }; -// boost flat_map::operator[] segfaults on Fedora 32+; use std::map instead template -#if __GNUC__ >= 10 -struct TypeData : std::map, KeyData > { - typedef std::map, KeyData > P; -#else struct TypeData : RMF_SMALL_UNORDERED_MAP, KeyData > { typedef RMF_SMALL_UNORDERED_MAP, KeyData > P; -#endif // Mac OS 10.8 and earlier clang needs this for some reason TypeData() {} TypeData(const TypeData& o) : P(o) {} diff --git a/include/RMF/internal/SharedDataData_impl.h b/include/RMF/internal/SharedDataData_impl.h index b93093df..70cdbb95 100644 --- a/include/RMF/internal/SharedDataData_impl.h +++ b/include/RMF/internal/SharedDataData_impl.h @@ -2,7 +2,7 @@ * \file RMF/internal/SharedData.h * \brief Handle read/write of Model data from/to files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/include/RMF/internal/SharedDataFile.h b/include/RMF/internal/SharedDataFile.h index 0d453b1d..7048ec52 100644 --- a/include/RMF/internal/SharedDataFile.h +++ b/include/RMF/internal/SharedDataFile.h @@ -2,7 +2,7 @@ * \file RMF/internal/SharedData.h * \brief Handle read/write of Model data from/to files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/include/RMF/internal/SharedDataFrames.h b/include/RMF/internal/SharedDataFrames.h index 77d02fa4..eefea4da 100644 --- a/include/RMF/internal/SharedDataFrames.h +++ b/include/RMF/internal/SharedDataFrames.h @@ -2,7 +2,7 @@ * \file RMF/internal/SharedData.h * \brief Handle read/write of Model data from/to files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/include/RMF/internal/SharedDataHierarchy.h b/include/RMF/internal/SharedDataHierarchy.h index e9f0cbdd..64148677 100644 --- a/include/RMF/internal/SharedDataHierarchy.h +++ b/include/RMF/internal/SharedDataHierarchy.h @@ -2,7 +2,7 @@ * \file RMF/internal/SharedData.h * \brief Handle read/write of Model data from/to files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/include/RMF/internal/SharedDataKeys.h b/include/RMF/internal/SharedDataKeys.h index 5cf0b3d8..2712f44c 100644 --- a/include/RMF/internal/SharedDataKeys.h +++ b/include/RMF/internal/SharedDataKeys.h @@ -2,7 +2,7 @@ * \file RMF/internal/SharedData.h * \brief Handle read/write of Model data from/to files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ @@ -82,16 +82,14 @@ class SharedDataKeys { } std::vector > ret; ret.reserve(data_.category_keys.find(cat)->second.size()); - RMF_FOREACH(typename Keys::KeyInfo::value_type it, - data_.category_keys.find(cat)->second) { + for(auto it : data_.category_keys.find(cat)->second) { ret.push_back(it.second); } return ret; } std::vector > get_keys(Traits) const { std::vector > ret; - typedef std::pair, Category> KP; - RMF_FOREACH(KP kp, data_.key_categories) { ret.push_back(kp.first); } + for(const auto &kp : data_.key_categories) { ret.push_back(kp.first); } return ret; } diff --git a/include/RMF/internal/SharedDataUserData.h b/include/RMF/internal/SharedDataUserData.h index 0cee12ae..88af5749 100644 --- a/include/RMF/internal/SharedDataUserData.h +++ b/include/RMF/internal/SharedDataUserData.h @@ -2,7 +2,7 @@ * \file RMF/internal/SharedData.h * \brief Handle read/write of Model data from/to files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/include/RMF/internal/SharedData_impl.h b/include/RMF/internal/SharedData_impl.h index e3cf8233..a0423474 100644 --- a/include/RMF/internal/SharedData_impl.h +++ b/include/RMF/internal/SharedData_impl.h @@ -2,7 +2,7 @@ * \file RMF/internal/SharedData.h * \brief Handle read/write of Model data from/to files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/include/RMF/internal/Transform.h b/include/RMF/internal/Transform.h index 79b03486..c2683a05 100644 --- a/include/RMF/internal/Transform.h +++ b/include/RMF/internal/Transform.h @@ -2,7 +2,7 @@ * \file RMF/internal/Transform.h * \brief Handle read/write of Model data from/to files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/include/RMF/internal/errors.h b/include/RMF/internal/errors.h index f85879e2..a2f7c6c4 100644 --- a/include/RMF/internal/errors.h +++ b/include/RMF/internal/errors.h @@ -2,7 +2,7 @@ * \file RMF/operations.h * \brief Handle read/write of Model data from/to files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/include/RMF/internal/hash.h b/include/RMF/internal/hash.h index 6eeb10bf..f24e874b 100644 --- a/include/RMF/internal/hash.h +++ b/include/RMF/internal/hash.h @@ -2,7 +2,7 @@ * \file compatibility/hash.h * \brief Make sure that we avoid errors in specialization of boost hash * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. */ #ifndef RMF_INTERNAL_HASH_H diff --git a/include/RMF/internal/large_set_map.h b/include/RMF/internal/large_set_map.h index 19e56e31..46356cb2 100644 --- a/include/RMF/internal/large_set_map.h +++ b/include/RMF/internal/large_set_map.h @@ -2,7 +2,7 @@ * \file RMF/internal/SharedData.h * \brief Handle read/write of Model data from/to files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/include/RMF/internal/paths.h b/include/RMF/internal/paths.h index eff52530..d1f465b5 100644 --- a/include/RMF/internal/paths.h +++ b/include/RMF/internal/paths.h @@ -2,7 +2,7 @@ * \file RMF/internal/SharedData.h * \brief Handle read/write of Model data from/to files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/include/RMF/internal/shared_data_factories.h b/include/RMF/internal/shared_data_factories.h index 543c9707..f6b3a2d6 100644 --- a/include/RMF/internal/shared_data_factories.h +++ b/include/RMF/internal/shared_data_factories.h @@ -2,7 +2,7 @@ * \file RMF/internal/SharedData.h * \brief Handle read/write of Model data from/to files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/include/RMF/internal/shared_data_ranges.h b/include/RMF/internal/shared_data_ranges.h index 967ff95f..a3598da8 100644 --- a/include/RMF/internal/shared_data_ranges.h +++ b/include/RMF/internal/shared_data_ranges.h @@ -2,7 +2,7 @@ * \file RMF/internal/SharedData.h * \brief Handle read/write of Model data from/to files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/include/RMF/internal/small_set_map.h b/include/RMF/internal/small_set_map.h index f7f16e35..5722d7ed 100644 --- a/include/RMF/internal/small_set_map.h +++ b/include/RMF/internal/small_set_map.h @@ -2,7 +2,7 @@ * \file RMF/internal/SharedData.h * \brief Handle read/write of Model data from/to files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/include/RMF/internal/swig_helpers.h b/include/RMF/internal/swig_helpers.h index 0dff5ba9..68b4ad37 100644 --- a/include/RMF/internal/swig_helpers.h +++ b/include/RMF/internal/swig_helpers.h @@ -2,7 +2,7 @@ * \file internal/swig_helpers.h * \brief Functions for use in swig wrappers * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. */ #ifndef RMF_INTERNAL_SWIG_HELPERS_H @@ -42,7 +42,7 @@ struct PyPointer : boost::noncopyable { PyObject* release() { RMF_INTERNAL_CHECK(ptr_->ob_refcnt >= 1, "No refcount"); PyObject* ret = ptr_; - ptr_ = NULL; + ptr_ = nullptr; return ret; } ~PyPointer() { diff --git a/include/RMF/internal/use.h b/include/RMF/internal/use.h index 06efe512..8c5387c1 100644 --- a/include/RMF/internal/use.h +++ b/include/RMF/internal/use.h @@ -2,7 +2,7 @@ * \file RMF/operations.h * \brief Handle read/write of Model data from/to files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/include/RMF/keys.h b/include/RMF/keys.h index d707db26..3a39b10f 100644 --- a/include/RMF/keys.h +++ b/include/RMF/keys.h @@ -2,7 +2,7 @@ * \file RMF/keys.h * \brief Declarations of the various key types. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/include/RMF/log.h b/include/RMF/log.h index 0ed4308c..6715155b 100644 --- a/include/RMF/log.h +++ b/include/RMF/log.h @@ -2,7 +2,7 @@ * \file RMF/log.h * \brief Functions and macros for logging. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ @@ -16,7 +16,6 @@ #include // IWYU pragma: export #include // IWYU pragma: export #include // IWYU pragma: export -#include // IWYU pragma: export #include // IWYU pragma: export #endif diff --git a/include/RMF/names.h b/include/RMF/names.h index cb79cc32..77056dd6 100644 --- a/include/RMF/names.h +++ b/include/RMF/names.h @@ -2,7 +2,7 @@ * \file RMF/names.h * \brief Functions to check if names are valid. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/include/RMF/show_hierarchy.h b/include/RMF/show_hierarchy.h index 56b39795..a5fe3e34 100644 --- a/include/RMF/show_hierarchy.h +++ b/include/RMF/show_hierarchy.h @@ -2,7 +2,7 @@ * \file RMF/show_hierarchy.h * \brief Functions to show the hierarchy. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/include/RMF/signature.h b/include/RMF/signature.h index 2232470e..fdbc7631 100644 --- a/include/RMF/signature.h +++ b/include/RMF/signature.h @@ -2,7 +2,7 @@ * \file RMF/signature.h * \brief Return a (long) string describing a file that can be compared. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/include/RMF/traits.h b/include/RMF/traits.h index 529815b5..0cb997e4 100644 --- a/include/RMF/traits.h +++ b/include/RMF/traits.h @@ -2,7 +2,7 @@ * \file RMF/traits.h * \brief Handle read/write of Model data from/to files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/include/RMF/types.h b/include/RMF/types.h index dd3e160b..2688bbfe 100644 --- a/include/RMF/types.h +++ b/include/RMF/types.h @@ -4,7 +4,7 @@ * Use RMF_TYPES_HEADER to replace it with another header. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/include/RMF/utility.h b/include/RMF/utility.h index bb46da51..deb84469 100644 --- a/include/RMF/utility.h +++ b/include/RMF/utility.h @@ -2,7 +2,7 @@ * \file RMF/utility.h * \brief Helper functions for manipulating RMF files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/include/RMF/validate.h b/include/RMF/validate.h index c0299e41..724dfd89 100644 --- a/include/RMF/validate.h +++ b/include/RMF/validate.h @@ -2,7 +2,7 @@ * \file RMF/validate.h * \brief Support for validating the data in a file. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/plugins/vmd/Data.cpp b/plugins/vmd/Data.cpp index 7749c9a8..313002d2 100644 --- a/plugins/vmd/Data.cpp +++ b/plugins/vmd/Data.cpp @@ -2,7 +2,7 @@ * \file rmfplugin.h * \brief Handle read/write of Model data from/to files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ @@ -91,7 +91,7 @@ double Data::get_resolution() { int Data::get_show_restraints() { bool has_restraints = false; - RMF_FOREACH(RMF::NodeID n, file_.get_node_ids()) { + for(RMF::NodeID n : file_.get_node_ids()) { if (rcf_.get_is(file_.get_node(n))) { has_restraints = true; break; @@ -157,7 +157,7 @@ Data::handle_alternative(RMF::NodeConstHandle cur, int body, } else { RMF::NodeConstHandles alts = altf_.get(cur).get_alternatives(RMF::PARTICLE); int alt = 1; - RMF_FOREACH(RMF::NodeConstHandle c, + for(RMF::NodeConstHandle c : boost::make_iterator_range(alts.begin() + 1, alts.end())) { altid[0] = 'A' + alt; boost::array cur = fill_bodies(c, body, chain, resid, resname, @@ -202,7 +202,7 @@ boost::array Data::fill_bodies(RMF::NodeConstHandle cur, int body, my_copy_n(rf_.get(cur).get_residue_type(), 8, resname.begin()); } - RMF_FOREACH(RMF::NodeConstHandle c, cur.get_children()) { + for(RMF::NodeConstHandle c : cur.get_children()) { boost::array count = fill_bodies(c, body, chain, resid, resname, altid, segment, resolution); for (unsigned int i = 0; i < 2; ++i) { @@ -225,11 +225,11 @@ boost::array Data::fill_bodies(RMF::NodeConstHandle cur, int body, void Data::fill_index() { int cur_index = -1; - RMF_FOREACH(const Body & body, bodies_) { - RMF_FOREACH(const AtomInfo & n, body.particles) { + for(const Body & body : bodies_) { + for(const AtomInfo & n : body.particles) { index_[n.node_id] = ++cur_index; } - RMF_FOREACH(const AtomInfo & n, body.balls) { + for(const AtomInfo & n : body.balls) { index_[n.node_id] = ++cur_index; } } @@ -251,7 +251,7 @@ void Data::fill_graphics(RMF::NodeConstHandle cur, size = cf_.get(cur).get_radius(); } RMF::Vector3 last_coords = tr.get_global_coordinates(coords[0]); - RMF_FOREACH(const RMF::Vector3 & cc, + for(const RMF::Vector3 & cc : boost::make_iterator_range(coords.begin() + 1, coords.end())) { molfile_graphics_t g; g.type = type; @@ -263,7 +263,7 @@ void Data::fill_graphics(RMF::NodeConstHandle cur, graphics_.push_back(g); } } - RMF_FOREACH(RMF::NodeConstHandle c, cur.get_children()) { + for(RMF::NodeConstHandle c : cur.get_children()) { fill_graphics(c, tr); } } @@ -282,7 +282,7 @@ void Data::handle_bond(RMF::NodeConstHandle cur) { void Data::handle_restraint(RMF::NodeConstHandle cur) { bool child_feature = false; - RMF_FOREACH(RMF::NodeConstHandle c, cur.get_children()) { + for(RMF::NodeConstHandle c : cur.get_children()) { if (c.get_type() == RMF::FEATURE) { child_feature = true; break; @@ -312,7 +312,7 @@ void Data::fill_bonds(RMF::NodeConstHandle cur) { if (show_restraints_ & RESTRAINTS && cur.get_type() == RMF::FEATURE) { handle_restraint(cur); } - RMF_FOREACH(RMF::NodeConstHandle c, cur.get_children()) { fill_bonds(c); } + for(RMF::NodeConstHandle c : cur.get_children()) { fill_bonds(c); } } void Data::copy_basics(const AtomInfo &n, molfile_atom_t *out) { @@ -327,7 +327,7 @@ void Data::copy_basics(const AtomInfo &n, molfile_atom_t *out) { molfile_atom_t *Data::copy_particles(const std::vector &atoms, molfile_atom_t *out) { - RMF_FOREACH(const AtomInfo & n, atoms) { + for(const AtomInfo & n : atoms) { copy_basics(n, out); RMF::NodeConstHandle cur = file_.get_node(n.node_id); @@ -353,7 +353,7 @@ molfile_atom_t *Data::copy_particles(const std::vector &atoms, molfile_atom_t *Data::copy_balls(const std::vector &balls, molfile_atom_t *out) { - RMF_FOREACH(AtomInfo n, balls) { + for(AtomInfo n : balls) { copy_basics(n, out); RMF::NodeConstHandle cur = file_.get_node(n.node_id); diff --git a/plugins/vmd/Data.h b/plugins/vmd/Data.h index b7121044..f2751290 100644 --- a/plugins/vmd/Data.h +++ b/plugins/vmd/Data.h @@ -2,7 +2,7 @@ * \file rmfplugin.h * \brief Handle read/write of Model data from/to files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/plugins/vmd/Data_read.cpp b/plugins/vmd/Data_read.cpp index 692d9197..471c952c 100644 --- a/plugins/vmd/Data_read.cpp +++ b/plugins/vmd/Data_read.cpp @@ -2,7 +2,7 @@ * \file rmfplugin.h * \brief Handle read/write of Model data from/to files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ @@ -14,7 +14,7 @@ namespace RMF_vmd { int Data::read_structure(int *optflags, molfile_atom_t *out) { RMF_INFO("Reading structure"); - RMF_FOREACH(const Body & body, bodies_) { + for(const Body & body : bodies_) { out = copy_particles(body.particles, out); out = copy_balls(body.balls, out); } @@ -29,21 +29,21 @@ int Data::read_timestep(molfile_timestep_t *frame) { frame->physical_time = curf.get_index(); float *coords = frame->coords; file_.set_current_frame(RMF::FrameID(curf.get_index())); - RMF_FOREACH(const Body & body, bodies_) { + for(const Body & body : bodies_) { RMF::CoordinateTransformer tr; double offset = (bounds_[1][0] - bounds_[0][0] + max_radius_ * 3) * body.state; - RMF_FOREACH(RMF::decorator::ReferenceFrameConst rf, body.frames) { + for(RMF::decorator::ReferenceFrameConst rf : body.frames) { tr = RMF::CoordinateTransformer(tr, rf); } - RMF_FOREACH(const AtomInfo & n, body.particles) { + for(const AtomInfo & n : body.particles) { RMF::Vector3 cc = pf_.get(file_.get_node(n.node_id)).get_coordinates(); cc = tr.get_global_coordinates(cc); cc[0] += offset; std::copy(cc.begin(), cc.end(), coords); coords += 3; } - RMF_FOREACH(const AtomInfo & n, body.balls) { + for(const AtomInfo & n : body.balls) { RMF::Vector3 cc = bf_.get(file_.get_node(n.node_id)).get_coordinates(); cc = tr.get_global_coordinates(cc); cc[0] += offset; @@ -93,8 +93,7 @@ int Data::read_bonds(int *nbonds, int **fromptr, int **toptr, bond_type_names_.push_back(restraint_bond_type_name_.get()); *bondtypename = &bond_type_names_[0]; - RMF_FOREACH(int bt, - boost::make_iterator_range(*bondtype, *bondtype + *nbonds)) { + for(int bt : boost::make_iterator_range(*bondtype, *bondtype + *nbonds)) { RMF_UNUSED(bt); RMF_INTERNAL_CHECK(bt >= 0 && bt < *nbondtypes, "Invalid bond type "); } @@ -105,7 +104,7 @@ int Data::read_timestep_metadata(molfile_timestep_metadata_t *data) { RMF_INFO("Reading timestep data"); data->count = file_.get_number_of_frames(); int na = 0; - RMF_FOREACH(const Body & bd, bodies_) { + for(const Body & bd : bodies_) { na += bd.particles.size() + bd.balls.size(); } data->avg_bytes_per_timestep = sizeof(float) * 3 * na; diff --git a/plugins/vmd/init.cpp b/plugins/vmd/init.cpp index 440eb7ba..09a8e44f 100644 --- a/plugins/vmd/init.cpp +++ b/plugins/vmd/init.cpp @@ -1,6 +1,6 @@ /** * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ #include "Data.h" diff --git a/src/BufferConstHandle.cpp b/src/BufferConstHandle.cpp index 80d5ca09..9f33a3e2 100644 --- a/src/BufferConstHandle.cpp +++ b/src/BufferConstHandle.cpp @@ -2,7 +2,7 @@ * \file RMF/Category.h * \brief Handle read/write of Model data from/to files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/src/CoordinateTransformer.cpp b/src/CoordinateTransformer.cpp index 33a0a4c6..c32136f4 100644 --- a/src/CoordinateTransformer.cpp +++ b/src/CoordinateTransformer.cpp @@ -2,7 +2,7 @@ * \file RMF/Category.h * \brief Handle read/write of Model data from/to files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/src/Enum.cpp b/src/Enum.cpp index b1f5ad44..c336c7c7 100644 --- a/src/Enum.cpp +++ b/src/Enum.cpp @@ -2,7 +2,7 @@ * \file RMF/Category.h * \brief Handle read/write of Model data from/to files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/src/FileConstHandle.cpp b/src/FileConstHandle.cpp index 7e211073..824d256e 100644 --- a/src/FileConstHandle.cpp +++ b/src/FileConstHandle.cpp @@ -2,7 +2,7 @@ * \file RMF/Category.h * \brief Handle read/write of Model data from/to files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ @@ -67,7 +67,7 @@ FileConstHandle open_rmf_buffer_read_only(BufferConstHandle buffer) { FrameIDs FileConstHandle::get_root_frames() const { FrameIDs ret; - RMF_FOREACH(FrameID fr, get_frames()) { + for(FrameID fr : get_frames()) { if (get_parents(fr).empty()) ret.push_back(fr); } return ret; diff --git a/src/FileHandle.cpp b/src/FileHandle.cpp index dac1f036..5d569c6b 100644 --- a/src/FileHandle.cpp +++ b/src/FileHandle.cpp @@ -2,7 +2,7 @@ * \file RMF/Category.h * \brief Handle read/write of Model data from/to files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/src/NodeConstHandle.cpp b/src/NodeConstHandle.cpp index 42d0c278..983018db 100644 --- a/src/NodeConstHandle.cpp +++ b/src/NodeConstHandle.cpp @@ -2,7 +2,7 @@ * \file RMF/Category.h * \brief Handle read/write of Model data from/to files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/src/NodeHandle.cpp b/src/NodeHandle.cpp index 8ebe5d1c..bde17c48 100644 --- a/src/NodeHandle.cpp +++ b/src/NodeHandle.cpp @@ -2,7 +2,7 @@ * \file RMF/Category.h * \brief Handle read/write of Model data from/to files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/src/RestoreCurrentFrame.cpp b/src/RestoreCurrentFrame.cpp index b463c10b..32f4a1d7 100644 --- a/src/RestoreCurrentFrame.cpp +++ b/src/RestoreCurrentFrame.cpp @@ -2,7 +2,7 @@ * \file RMF/Category.h * \brief Handle read/write of Model data from/to files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/src/SetCurrentFrame.cpp b/src/SetCurrentFrame.cpp index c7e320ac..e6ae307f 100644 --- a/src/SetCurrentFrame.cpp +++ b/src/SetCurrentFrame.cpp @@ -2,7 +2,7 @@ * \file RMF/Category.h * \brief Handle read/write of Model data from/to files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/src/TraverseHelper.cpp b/src/TraverseHelper.cpp index 7e38f861..c414d03e 100644 --- a/src/TraverseHelper.cpp +++ b/src/TraverseHelper.cpp @@ -2,7 +2,7 @@ * \file RMF/TraverseHelper.cpp * \brief A helper class for managing data when traversing an RMF. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ @@ -95,7 +95,7 @@ unsigned int TraverseHelper::get_index(NodeID n) const { std::vector TraverseHelper::get_children() const { std::vector ret; // handle alternatives later - RMF_FOREACH(NodeConstHandle ch, NodeConstHandle::get_children()) { + for(NodeConstHandle ch : NodeConstHandle::get_children()) { if (data_->state_filter_ != -1 && data_->state_factory_.get_is(ch) && data_->state_factory_.get(ch).get_state_index() != data_->state_filter_) continue; diff --git a/src/backend/BackwardsIO.h b/src/backend/BackwardsIO.h index cdc4ee15..c6f326b6 100644 --- a/src/backend/BackwardsIO.h +++ b/src/backend/BackwardsIO.h @@ -2,7 +2,7 @@ * \file RMF/internal/SharedData.h * \brief Handle read/write of Model data from/to files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ @@ -63,7 +63,7 @@ RMF_ENABLE_WARNINGS namespace RMF { template ID get_key_const(Category cat, std::string name, Traits, SDC *sd) const { - RMF_FOREACH(ID k, sd->get_keys(cat, Traits())) { + for(ID k : sd->get_keys(cat, Traits())) { if (sd->get_name(k) == name) return k; } return ID(); @@ -71,9 +71,8 @@ RMF_ENABLE_WARNINGS namespace RMF { template void filter_vector(Filter &filter, Category cat) const { - RMF_FOREACH(std::string key_name, - get_vector_names(cat, RMF_VECTOR())) { - RMF_FOREACH(std::string subkey_name, + for(std::string key_name : get_vector_names(cat, RMF_VECTOR())) { + for(std::string subkey_name : get_vector_subkey_names(key_name, RMF_VECTOR())) { filter.add_float_key(cat, subkey_name); RMF_TRACE("Filtering " << subkey_name); @@ -83,9 +82,8 @@ RMF_ENABLE_WARNINGS namespace RMF { template void filter_vectors(Filter &filter, Category cat) const { - RMF_FOREACH(std::string key_name, - get_vectors_names(cat, RMF_VECTOR())) { - RMF_FOREACH(std::string subkey_name, + for(std::string key_name : get_vectors_names(cat, RMF_VECTOR())) { + for(std::string subkey_name : get_vectors_subkey_names(key_name, RMF_VECTOR())) { filter.add_floats_key(cat, subkey_name); RMF_TRACE("Filtering " << subkey_name); @@ -142,7 +140,7 @@ RMF_ENABLE_WARNINGS namespace RMF { ret = sd_->get_static_value(NodeID(0), key); } typedef std::pair > KP; - RMF_FOREACH(KP kp, get_vector_names_map(RMF_VECTOR())) { + for(KP kp : get_vector_names_map(RMF_VECTOR())) { ret.push_back(kp.first); } std::sort(ret.begin(), ret.end()); @@ -161,7 +159,7 @@ RMF_ENABLE_WARNINGS namespace RMF { ret = sd_->get_static_value(NodeID(0), key); } typedef std::pair > KP; - RMF_FOREACH(KP kp, get_vectors_names_map(RMF_VECTOR())) { + for(KP kp : get_vectors_names_map(RMF_VECTOR())) { ret.push_back(kp.first); } std::sort(ret.begin(), ret.end()); @@ -174,7 +172,7 @@ RMF_ENABLE_WARNINGS namespace RMF { typedef ID > > Key; typedef boost::tuple Data; RMF_LARGE_UNORDERED_MAP map; - RMF_FOREACH(std::string key_name, + for(std::string key_name : get_vector_names(category_b, RMF_VECTOR())) { boost::array subkey_names = get_vector_subkey_names(key_name, RMF_VECTOR()); @@ -187,9 +185,8 @@ RMF_ENABLE_WARNINGS namespace RMF { } } if (map.empty()) return; - typedef std::pair KP; - RMF_FOREACH(KP kp, map) { - RMF_FOREACH(NodeID n, internal::get_nodes(sdb)) { + for(const auto &kp : map) { + for(NodeID n : internal::get_nodes(sdb)) { double v = H::get(sdb, n, kp.first); if (!FloatTraits::get_is_null_value(v)) { RMF_VECTOR &old = H::access(sdb, n, kp.second.template get<0>()); @@ -208,7 +205,7 @@ RMF_ENABLE_WARNINGS namespace RMF { typedef boost::array, D> Data; RMF_LARGE_UNORDERED_MAP map; Strings key_names; - RMF_FOREACH(VectorKey k, keys) { + for(VectorKey k : keys) { std::string name = sda->get_name(k); key_names.push_back(name); boost::array subkey_names = @@ -225,9 +222,8 @@ RMF_ENABLE_WARNINGS namespace RMF { sdb->set_static_value(NodeID(0), k, key_names); } - typedef std::pair KP; - RMF_FOREACH(KP kp, map) { - RMF_FOREACH(NodeID n, internal::get_nodes(sda)) { + for(const auto &kp : map) { + for(NodeID n : internal::get_nodes(sda)) { RMF_VECTOR v = H::get(sda, n, kp.first); if (!Traits >::get_is_null_value(v)) { for (unsigned int i = 0; i < D; ++i) { @@ -243,7 +239,7 @@ RMF_ENABLE_WARNINGS namespace RMF { typedef Vector3sKey Key; typedef boost::tuple Data; RMF_LARGE_UNORDERED_MAP map; - RMF_FOREACH(std::string key_name, + for(std::string key_name : get_vectors_names(category_b, RMF_VECTOR<3>())) { boost::array subkey_names = get_vectors_subkey_names(key_name, RMF_VECTOR<3>()); @@ -256,9 +252,8 @@ RMF_ENABLE_WARNINGS namespace RMF { } } if (map.empty()) return; - typedef std::pair KP; - RMF_FOREACH(KP kp, map) { - RMF_FOREACH(NodeID n, internal::get_nodes(sdb)) { + for(const auto &kp : map) { + for(NodeID n : internal::get_nodes(sdb)) { Floats v = H::get(sdb, n, kp.first); if (!v.empty()) { std::vector > &old = @@ -281,7 +276,7 @@ RMF_ENABLE_WARNINGS namespace RMF { typedef boost::array, 3> Data; RMF_LARGE_UNORDERED_MAP map; Strings key_names; - RMF_FOREACH(VectorKey k, keys) { + for(VectorKey k : keys) { std::string name = sda->get_name(k); key_names.push_back(name); boost::array subkey_names = @@ -298,9 +293,8 @@ RMF_ENABLE_WARNINGS namespace RMF { sdb->set_static_value(NodeID(0), k, key_names); } - typedef std::pair KP; - RMF_FOREACH(KP kp, map) { - RMF_FOREACH(NodeID n, internal::get_nodes(sda)) { + for(const auto &kp : map) { + for(NodeID n : internal::get_nodes(sda)) { std::vector > v = H::get(sda, n, kp.first); if (!v.empty()) { for (unsigned int i = 0; i < 3; ++i) { @@ -318,7 +312,7 @@ RMF_ENABLE_WARNINGS namespace RMF { template ID get_alias_key(const SDA *a) { Category alias_cat; - RMF_FOREACH(Category cur_cat, a->get_categories()) { + for(Category cur_cat : a->get_categories()) { if (a->get_name(cur_cat) == "alias") { alias_cat = cur_cat; } @@ -326,7 +320,7 @@ RMF_ENABLE_WARNINGS namespace RMF { if (alias_cat == Category()) return ID(); ID alias_key; - RMF_FOREACH(ID nik_cur, + for(ID nik_cur : a->get_keys(alias_cat, backward_types::NodeIDTraits())) { if (a->get_name(nik_cur) == "aliased") { alias_key = nik_cur; @@ -347,13 +341,13 @@ RMF_ENABLE_WARNINGS namespace RMF { IntsKey rep_key = b->get_key(feature_category, "representation", IntsTraits()); - RMF_FOREACH(NodeID n, internal::get_nodes(b)) { + for(NodeID n : internal::get_nodes(b)) { if (b->get_type(n) == FEATURE) { RMF_TRACE("Processing restraint node " << b->get_name(n)); // make a copy as it can change NodeIDs chs = b->get_children(n); Ints val; - RMF_FOREACH(NodeID ch, chs) { + for(NodeID ch : chs) { if (b->get_type(ch) == ALIAS) { RMF_TRACE("Found alias child " << b->get_name(ch)); val.push_back(a->get_static_value(ch, alias_key).get_index()); @@ -376,7 +370,7 @@ RMF_ENABLE_WARNINGS namespace RMF { Category bond_cat = b->get_category("bond"); IntKey k0 = b->get_key(bond_cat, "bonded 0", IntTraits()); IntKey k1 = b->get_key(bond_cat, "bonded 1", IntTraits()); - RMF_FOREACH(NodeID n, internal::get_nodes(a)) { + for(NodeID n : internal::get_nodes(a)) { if (a->get_type(n) == BOND) { NodeIDs ch = a->get_children(n); if (ch.size() == 2 && a->get_type(ch[0]) == ALIAS && @@ -433,7 +427,7 @@ RMF_ENABLE_WARNINGS namespace RMF { if (cidk != backward_types::IndexKey()) { StringKey cidsk = shared_data->get_key(category, "chain id", StringTraits()); - RMF_FOREACH(NodeID ni, internal::get_nodes(shared_data)) { + for(NodeID ni : internal::get_nodes(shared_data)) { int ci = H::get(sd_.get(), ni, cidk); if (!backward_types::IndexTraits::get_is_null_value(ci)) { H::set(shared_data, ni, cidsk, std::string(1, ci = 'A')); @@ -449,7 +443,7 @@ RMF_ENABLE_WARNINGS namespace RMF { if (rtk != StringKey() && bk != IntKey() && ek != IntKey()) { IntKey rik = shared_data->get_key(category, "residue index", IntTraits()); - RMF_FOREACH(NodeID ni, internal::get_nodes(shared_data)) { + for(NodeID ni : internal::get_nodes(shared_data)) { std::string rt = H::get(shared_data, ni, rtk); if (!rt.empty()) { int b = H::get(shared_data, ni, bk); @@ -468,7 +462,7 @@ RMF_ENABLE_WARNINGS namespace RMF { FloatKey nbk = shared_data->get_key(category, "rgb color blue", FloatTraits()); if (bk != FloatKey()) { - RMF_FOREACH(NodeID ni, internal::get_nodes(shared_data)) { + for(NodeID ni : internal::get_nodes(shared_data)) { float v = H::get(shared_data, ni, bk); if (!FloatTraits::get_is_null_value(v)) { H::set(shared_data, ni, nbk, v); @@ -512,9 +506,8 @@ RMF_ENABLE_WARNINGS namespace RMF { virtual ~BackwardsIO() { flush(); } protected: - virtual void load_static_frame(internal::SharedData *shared_data) - RMF_OVERRIDE { - RMF_FOREACH(Category category, shared_data->get_categories()) { + virtual void load_static_frame(internal::SharedData *shared_data) override { + for(Category category : shared_data->get_categories()) { load_frame_category(category, shared_data, internal::StaticValues()); } @@ -522,36 +515,33 @@ RMF_ENABLE_WARNINGS namespace RMF { load_restraints(sd_.get(), shared_data); } - virtual void save_static_frame(internal::SharedData *shared_data) - RMF_OVERRIDE { - RMF_FOREACH(Category category, shared_data->get_categories()) { + virtual void save_static_frame(internal::SharedData *shared_data) override { + for(Category category : shared_data->get_categories()) { save_frame_category(category, shared_data, internal::StaticValues()); } } - virtual void load_file(internal::SharedData *shared_data) RMF_OVERRIDE { + virtual void load_file(internal::SharedData *shared_data) override { sd_->reload(); RMF_INFO("Loading file"); RMF::internal::clone_file(sd_.get(), shared_data); shared_data->set_file_type(sd_->get_file_type()); - RMF_FOREACH(FrameID id, internal::get_frames(sd_.get())) { + for(FrameID id : internal::get_frames(sd_.get())) { shared_data->add_frame_data(id, "", FRAME); } RMF_TRACE("Found " << sd_->get_number_of_frames() << " frames."); - RMF_FOREACH(Category c, sd_->get_categories()) { + for(Category c : sd_->get_categories()) { shared_data->get_category(sd_->get_name(c)); } } - virtual void save_file(const internal::SharedData *shared_data) - RMF_OVERRIDE { + virtual void save_file(const internal::SharedData *shared_data) override { RMF_INFO("Saving file"); RMF::internal::clone_file(shared_data, sd_.get()); flush(); } - virtual void save_loaded_frame(internal::SharedData *shared_data) - RMF_OVERRIDE { + virtual void save_loaded_frame(internal::SharedData *shared_data) override { RMF_INFO("Saving frame " << shared_data->get_loaded_frame()); FrameID cur = shared_data->get_loaded_frame(); RMF_USAGE_CHECK(cur.get_index() == sd_->get_number_of_frames(), @@ -565,34 +555,32 @@ RMF_ENABLE_WARNINGS namespace RMF { RMF_INTERNAL_CHECK(nfid == cur, "Number of frames don't match."); } sd_->set_loaded_frame(cur); - RMF_FOREACH(Category category, shared_data->get_categories()) { + for(Category category : shared_data->get_categories()) { save_frame_category(category, shared_data, internal::LoadedValues()); } } - virtual void load_loaded_frame(internal::SharedData *shared_data) - RMF_OVERRIDE { + virtual void load_loaded_frame(internal::SharedData *shared_data) override { RMF_INFO("Loading frame " << shared_data->get_loaded_frame()); FrameID cur = shared_data->get_loaded_frame(); sd_->set_loaded_frame(cur); - RMF_FOREACH(Category category, sd_->get_categories()) { + for(Category category : sd_->get_categories()) { load_frame_category(category, shared_data, internal::LoadedValues()); } } - virtual void load_hierarchy(internal::SharedData *shared_data) - RMF_OVERRIDE { + virtual void load_hierarchy(internal::SharedData *shared_data) override { RMF_INFO("Loading hierarchy"); RMF::internal::clone_hierarchy(sd_.get(), shared_data); } virtual void save_hierarchy(const internal::SharedData *shared_data) - RMF_OVERRIDE { + override { RMF_INFO("Saving hierarchy"); RMF::internal::clone_hierarchy(shared_data, sd_.get()); } - virtual void flush() RMF_OVERRIDE { sd_->flush(); } + virtual void flush() override { sd_->flush(); } }; } // namespace internal diff --git a/src/backend/BackwardsIOBase.h b/src/backend/BackwardsIOBase.h index 06472898..d203c6c7 100644 --- a/src/backend/BackwardsIOBase.h +++ b/src/backend/BackwardsIOBase.h @@ -2,7 +2,7 @@ * \file RMF/internal/SharedData.h * \brief Handle read/write of Model data from/to files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/src/backend/IO.cpp b/src/backend/IO.cpp index 4b7c95b6..d69a5779 100644 --- a/src/backend/IO.cpp +++ b/src/backend/IO.cpp @@ -2,7 +2,7 @@ * \file RMF/Category.h * \brief Handle read/write of Model data from/to files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ @@ -55,7 +55,7 @@ boost::shared_ptr create_file(const std::string &name) { test_buffers[name] = BufferHandle(); return create_buffer(test_buffers.find(name)->second); } else { - RMF_FOREACH(boost::shared_ptr f, factories) { + for(boost::shared_ptr f : factories) { if (!boost::algorithm::ends_with(name, f->get_file_extension())) continue; boost::shared_ptr cur = f->create_file(name); if (cur) return cur; @@ -64,7 +64,7 @@ boost::shared_ptr create_file(const std::string &name) { return boost::shared_ptr(); } boost::shared_ptr create_buffer(BufferHandle buffer) { - RMF_FOREACH(boost::shared_ptr f, factories) { + for(boost::shared_ptr f : factories) { boost::shared_ptr cur = f->create_buffer(buffer); if (cur) return cur; } @@ -74,7 +74,7 @@ boost::shared_ptr read_file(const std::string &name) { if (boost::algorithm::ends_with(name, "_rmf_test_buffer")) { return read_buffer(test_buffers.find(name)->second); } else { - RMF_FOREACH(boost::shared_ptr f, factories) { + for(boost::shared_ptr f : factories) { // if (!boost::algorithm::ends_with(name, f->get_file_extension())) // continue; try { @@ -89,7 +89,7 @@ boost::shared_ptr read_file(const std::string &name) { return boost::shared_ptr(); } boost::shared_ptr read_buffer(BufferConstHandle buffer) { - RMF_FOREACH(boost::shared_ptr f, factories) { + for(boost::shared_ptr f : factories) { boost::shared_ptr cur = f->read_buffer(buffer); if (cur) return cur; } diff --git a/src/backend/IO.h b/src/backend/IO.h index 7516da0c..5ffbf287 100644 --- a/src/backend/IO.h +++ b/src/backend/IO.h @@ -2,7 +2,7 @@ * \file RMF/internal/SharedData.h * \brief Handle read/write of Model data from/to files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/src/backend/IOFactory.h b/src/backend/IOFactory.h index dbbaee06..12af1506 100644 --- a/src/backend/IOFactory.h +++ b/src/backend/IOFactory.h @@ -2,7 +2,7 @@ * \file RMF/internal/SharedData.h * \brief Handle read/write of Model data from/to files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/src/backend/KeyFilter.h b/src/backend/KeyFilter.h index 64e12b25..dc3c5305 100644 --- a/src/backend/KeyFilter.h +++ b/src/backend/KeyFilter.h @@ -2,7 +2,7 @@ * \file RMF/internal/SharedData.h * \brief Handle read/write of Model data from/to files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ @@ -31,7 +31,7 @@ class KeyFilter : public SharedDataAdaptor { public: KeyFilter(SD* sd) : P(sd) {} void add_index_key(Category cat, std::string name) { - RMF_FOREACH(backward_types::IndexKey k, + for(backward_types::IndexKey k : P::sync_->get_keys(cat, backward_types::IndexTraits())) { if (P::sync_->get_name(k) == name) { index_keys_.push_back(k); @@ -41,7 +41,7 @@ class KeyFilter : public SharedDataAdaptor { } } void add_float_key(Category cat, std::string name) { - RMF_FOREACH(FloatKey k, P::sync_->get_keys(cat, FloatTraits())) { + for(FloatKey k : P::sync_->get_keys(cat, FloatTraits())) { if (P::sync_->get_name(k) == name) { float_keys_.push_back(k); std::sort(float_keys_.begin(), float_keys_.end()); @@ -50,7 +50,7 @@ class KeyFilter : public SharedDataAdaptor { } } void add_floats_key(Category cat, std::string name) { - RMF_FOREACH(FloatsKey k, P::sync_->get_keys(cat, FloatsTraits())) { + for(FloatsKey k : P::sync_->get_keys(cat, FloatsTraits())) { if (P::sync_->get_name(k) == name) { floats_keys_.push_back(k); std::sort(floats_keys_.begin(), floats_keys_.end()); diff --git a/src/backend/SharedDataAdaptor.h b/src/backend/SharedDataAdaptor.h index c5dc7058..68460c13 100644 --- a/src/backend/SharedDataAdaptor.h +++ b/src/backend/SharedDataAdaptor.h @@ -2,7 +2,7 @@ * \file RMF/internal/SharedData.h * \brief Handle read/write of Model data from/to files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/src/backend/avro/data_file.cpp b/src/backend/avro/data_file.cpp index 3d20aa02..86ff0b48 100644 --- a/src/backend/avro/data_file.cpp +++ b/src/backend/avro/data_file.cpp @@ -1,6 +1,6 @@ /** * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/src/backend/avro/encode_decode.h b/src/backend/avro/encode_decode.h index dd3c2c6f..ba7f34f0 100644 --- a/src/backend/avro/encode_decode.h +++ b/src/backend/avro/encode_decode.h @@ -1,6 +1,6 @@ /** * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ @@ -562,7 +562,7 @@ struct codec_traits { } std::vector nodes; internal_avro::decode(d, nodes); - RMF_FOREACH(const RMF::avro2::HierarchyNode & hn, nodes) { + for(const RMF::avro2::HierarchyNode & hn : nodes) { v.nodes.resize( std::max(v.nodes.size(), hn.id.get_index() + 1)); v.nodes[hn.id.get_index()].name = hn.name; @@ -570,7 +570,7 @@ struct codec_traits { v.nodes[hn.id.get_index()] .parents.insert(v.nodes[hn.id.get_index()].parents.end(), hn.parents.begin(), hn.parents.end()); - RMF_FOREACH(RMF::NodeID ch, hn.parents) { + for(RMF::NodeID ch : hn.parents) { v.nodes.resize( std::max(v.nodes.size(), ch.get_index() + 1)); v.nodes[ch.get_index()].children.push_back(hn.id); diff --git a/src/backend/avro/encode_decode_util.h b/src/backend/avro/encode_decode_util.h index c8927b9f..e97e64d0 100644 --- a/src/backend/avro/encode_decode_util.h +++ b/src/backend/avro/encode_decode_util.h @@ -1,6 +1,6 @@ /** * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ @@ -25,7 +25,7 @@ inline void sort_key(const KeyInfo& ki, KeyMaps& maps) { } inline void sort_keys(const std::vector& in, KeyData& out) { - RMF_FOREACH(const KeyInfo & k, in) { + for(const KeyInfo & k : in) { switch (k.type) { case INT: sort_key(k, out.int_keys); diff --git a/src/backend/avro/factory.cpp b/src/backend/avro/factory.cpp index 71fd4e22..998bc8e0 100644 --- a/src/backend/avro/factory.cpp +++ b/src/backend/avro/factory.cpp @@ -2,7 +2,7 @@ * \file RMF/internal/SharedData.h * \brief Handle read/write of Model data from/to files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ @@ -32,7 +32,7 @@ namespace avro2 { template class Avro2IOFileFactory : public backends::IOFactory { public: - virtual std::string get_file_extension() const RMF_OVERRIDE { + virtual std::string get_file_extension() const override { if (OLD) return ".rmf3"; if (GZIP) return ".rmfz"; @@ -40,22 +40,22 @@ class Avro2IOFileFactory : public backends::IOFactory { return ".rmf"; } virtual boost::shared_ptr read_file(const std::string &name) - const RMF_OVERRIDE { + const override { return boost::make_shared > >(name); } virtual boost::shared_ptr create_file(const std::string &name) - const RMF_OVERRIDE { + const override { return boost::make_shared > >(name); } }; class Avro2IOBufferFactory : public backends::IOFactory { public: - virtual std::string get_file_extension() const RMF_OVERRIDE { + virtual std::string get_file_extension() const override { return ".none"; } virtual boost::shared_ptr read_buffer(BufferConstHandle buffer) - const RMF_OVERRIDE { + const override { try { return boost::make_shared > >( buffer); @@ -66,7 +66,7 @@ class Avro2IOBufferFactory : public backends::IOFactory { } } virtual boost::shared_ptr create_buffer(BufferHandle buffer) - const RMF_OVERRIDE { + const override { return boost::make_shared >(buffer); } }; diff --git a/src/backend/avro/io.h b/src/backend/avro/io.h index 221aff75..cc353072 100644 --- a/src/backend/avro/io.h +++ b/src/backend/avro/io.h @@ -2,7 +2,7 @@ * \file RMF/internal/SharedData.h * \brief Handle read/write of Model data from/to files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ @@ -40,20 +40,15 @@ struct Avro2IO : public backends::IO { public: template Avro2IO(T t); - virtual void save_loaded_frame(internal::SharedData *shared_data) - RMF_OVERRIDE; - virtual void load_loaded_frame(internal::SharedData *shared_data) - RMF_OVERRIDE; - virtual void save_static_frame(internal::SharedData *shared_data) - RMF_OVERRIDE; - virtual void load_static_frame(internal::SharedData *shared_data) - RMF_OVERRIDE; - virtual void load_file(internal::SharedData *shared_data) RMF_OVERRIDE; - virtual void save_file(const internal::SharedData *shared_data) RMF_OVERRIDE; - virtual void load_hierarchy(internal::SharedData *shared_data) RMF_OVERRIDE; - virtual void save_hierarchy(const internal::SharedData *shared_data) - RMF_OVERRIDE; - virtual void flush() RMF_OVERRIDE; + virtual void save_loaded_frame(internal::SharedData *shared_data) override; + virtual void load_loaded_frame(internal::SharedData *shared_data) override; + virtual void save_static_frame(internal::SharedData *shared_data) override; + virtual void load_static_frame(internal::SharedData *shared_data) override; + virtual void load_file(internal::SharedData *shared_data) override; + virtual void save_file(const internal::SharedData *shared_data) override; + virtual void load_hierarchy(internal::SharedData *shared_data) override; + virtual void save_hierarchy(const internal::SharedData *shared_data) override; + virtual void flush() override; virtual ~Avro2IO(); }; @@ -63,7 +58,7 @@ template void load(internal::SharedData *shared_data, const KeyMaps &keys, internal::TypeData &data, Loader) { typedef std::pair, Category> KKP; - RMF_FOREACH(KKP kp, keys.category) { + for(KKP kp : keys.category) { shared_data->ensure_key(kp.second, kp.first, keys.name.find(kp.first)->second, Traits()); } @@ -76,10 +71,10 @@ void load(internal::SharedData *shared_data, const KeyMaps &keys, template bool save(KeyType key_type, internal::SharedData *shared_data, KeyMaps &keys, std::vector *keys_changed, - internal::TypeData &data, - internal::TypeData *change_data, Loader) { + internal::TypeData &data, Loader, + internal::TypeData *change_data = nullptr) { bool ret = false; - RMF_FOREACH(ID k, shared_data->get_keys(Traits())) { + for(ID k : shared_data->get_keys(Traits())) { if (keys.category.find(k) == keys.category.end()) { ret = true; std::string name = shared_data->get_name(k); @@ -100,14 +95,14 @@ bool save(KeyType key_type, internal::SharedData *shared_data, } if (change_data) { - RMF_FOREACH(typename internal::TypeData::const_reference kpd, + for(typename internal::TypeData::const_reference kpd : Loader::get_data(shared_data, Traits())) { if (data.find(kpd.first) == data.end() && !kpd.second.empty()) { ret = true; change_data->operator[](kpd.first) = kpd.second; data[kpd.first] = kpd.second; } else { - RMF_FOREACH(typename internal::KeyData::const_reference npd, + for(typename internal::KeyData::const_reference npd : kpd.second) { if (data[kpd.first].find(npd.first) == data[kpd.first].end()) { ret = true; @@ -128,8 +123,7 @@ template void load_all(const std::vector > &categories, internal::SharedData *shared_data, const KeyData &keys, DataTypes &data, Loader) { - typedef std::pair CP; - RMF_FOREACH(CP cp, categories) { + for(const auto &cp : categories) { shared_data->ensure_category(cp.first, cp.second); } load(shared_data, keys.float_keys, data.float_data, Loader()); @@ -158,43 +152,57 @@ bool save_all(FileData &file_data, FileDataChanges &file_data_changes, file_data_changes.categories.push_back(file_data.categories.back()); } - ret = save(FLOAT, shared_data, file_data.keys.float_keys, - &file_data_changes.keys, data.float_data, - data_changes ? &data_changes->float_data : NULL, Loader()) || - ret; - ret = save(INT, shared_data, file_data.keys.int_keys, &file_data_changes.keys, - data.int_data, data_changes ? &data_changes->int_data : NULL, - Loader()) || - ret; - ret = save(STRING, shared_data, file_data.keys.string_keys, - &file_data_changes.keys, data.string_data, - data_changes ? &data_changes->string_data : NULL, Loader()) || - ret; - ret = save(FLOATS, shared_data, file_data.keys.floats_keys, - &file_data_changes.keys, data.floats_data, - data_changes ? &data_changes->floats_data : NULL, Loader()) || - ret; - ret = save(INTS, shared_data, file_data.keys.ints_keys, - &file_data_changes.keys, data.ints_data, - data_changes ? &data_changes->ints_data : NULL, Loader()) || - ret; - ret = save(STRINGS, shared_data, file_data.keys.strings_keys, - &file_data_changes.keys, data.strings_data, - data_changes ? &data_changes->strings_data : NULL, Loader()) || - ret; - - ret = save(VECTOR3, shared_data, file_data.keys.vector3_keys, - &file_data_changes.keys, data.vector3_data, - data_changes ? &data_changes->vector3_data : NULL, Loader()) || - ret; - ret = save(VECTOR4, shared_data, file_data.keys.vector4_keys, - &file_data_changes.keys, data.vector4_data, - data_changes ? &data_changes->vector4_data : NULL, Loader()) || - ret; - ret = save(VECTOR3S, shared_data, file_data.keys.vector3s_keys, - &file_data_changes.keys, data.vector3s_data, - data_changes ? &data_changes->vector3s_data : NULL, Loader()) || - ret; + // This duplication is quite ugly but works around a (compiler?) bug; + // although nullptr was passed for change_data to save(), it tried to + // dereference it anyway and caused a segfault + if (data_changes) { + ret = save(FLOAT, shared_data, file_data.keys.float_keys, + &file_data_changes.keys, data.float_data, Loader(), + &data_changes->float_data) || ret; + ret = save(INT, shared_data, file_data.keys.int_keys, + &file_data_changes.keys, data.int_data, Loader(), + &data_changes->int_data) || ret; + ret = save(STRING, shared_data, file_data.keys.string_keys, + &file_data_changes.keys, data.string_data, Loader(), + &data_changes->string_data) || ret; + ret = save(FLOATS, shared_data, file_data.keys.floats_keys, + &file_data_changes.keys, data.floats_data, Loader(), + &data_changes->floats_data) || ret; + ret = save(INTS, shared_data, file_data.keys.ints_keys, + &file_data_changes.keys, data.ints_data, Loader(), + &data_changes->ints_data) || ret; + ret = save(STRINGS, shared_data, file_data.keys.strings_keys, + &file_data_changes.keys, data.strings_data, Loader(), + &data_changes->strings_data) || ret; + ret = save(VECTOR3, shared_data, file_data.keys.vector3_keys, + &file_data_changes.keys, data.vector3_data, Loader(), + &data_changes->vector3_data) || ret; + ret = save(VECTOR4, shared_data, file_data.keys.vector4_keys, + &file_data_changes.keys, data.vector4_data, Loader(), + &data_changes->vector4_data) || ret; + ret = save(VECTOR3S, shared_data, file_data.keys.vector3s_keys, + &file_data_changes.keys, data.vector3s_data, Loader(), + &data_changes->vector3s_data) || ret; + } else { + ret = save(FLOAT, shared_data, file_data.keys.float_keys, + &file_data_changes.keys, data.float_data, Loader()) || ret; + ret = save(INT, shared_data, file_data.keys.int_keys, + &file_data_changes.keys, data.int_data, Loader()) || ret; + ret = save(STRING, shared_data, file_data.keys.string_keys, + &file_data_changes.keys, data.string_data, Loader()) || ret; + ret = save(FLOATS, shared_data, file_data.keys.floats_keys, + &file_data_changes.keys, data.floats_data, Loader()) || ret; + ret = save(INTS, shared_data, file_data.keys.ints_keys, + &file_data_changes.keys, data.ints_data, Loader()) || ret; + ret = save(STRINGS, shared_data, file_data.keys.strings_keys, + &file_data_changes.keys, data.strings_data, Loader()) || ret; + ret = save(VECTOR3, shared_data, file_data.keys.vector3_keys, + &file_data_changes.keys, data.vector3_data, Loader()) || ret; + ret = save(VECTOR4, shared_data, file_data.keys.vector4_keys, + &file_data_changes.keys, data.vector4_data, Loader()) || ret; + ret = save(VECTOR3S, shared_data, file_data.keys.vector3s_keys, + &file_data_changes.keys, data.vector3s_data, Loader()) || ret; + } return ret; } @@ -231,7 +239,7 @@ void Avro2IO::save_loaded_frame(internal::SharedData *shared_data) { frame_.parents = FrameIDs(fd.parents.begin(), fd.parents.end()); frame_.type = fd.type; frame_.name = fd.name; - save_all(file_data_, file_data_changes_, shared_data, frame_.data, NULL, + save_all(file_data_, file_data_changes_, shared_data, frame_.data, nullptr, internal::LoadedValues()); } @@ -266,16 +274,16 @@ void Avro2IO::load_file(internal::SharedData *shared_data) { shared_data->set_description(file_data_.description); shared_data->set_producer(file_data_.producer); typedef std::pair FDP; - RMF_FOREACH(FDP fdp, file_data_.frames) { + for(FDP fdp : file_data_.frames) { shared_data->add_frame_data(fdp.first, fdp.second.name, fdp.second.type); - RMF_FOREACH(FrameID p, fdp.second.parents) { + for(FrameID p : fdp.second.parents) { shared_data->add_child_frame(p, fdp.first); } } shared_data->set_file_type("rmf3"); typedef std::pair CP; - RMF_FOREACH(CP cp, file_data_.categories) { + for(CP cp : file_data_.categories) { shared_data->ensure_category(cp.first, cp.second); } } @@ -302,7 +310,7 @@ void Avro2IO::load_hierarchy(internal::SharedData *shared_data) { template void Avro2IO::save_hierarchy(const internal::SharedData *shared_data) { - RMF_FOREACH(NodeID n, get_nodes(shared_data)) { + for(NodeID n : get_nodes(shared_data)) { HierarchyNode cur; cur.id = n; bool cur_dirty = false; diff --git a/src/backend/avro/traits.h b/src/backend/avro/traits.h index 9f3d46d6..45ee69b3 100644 --- a/src/backend/avro/traits.h +++ b/src/backend/avro/traits.h @@ -2,7 +2,7 @@ * \file RMF/internal/SharedData.h * \brief Handle read/write of Model data from/to files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/src/backend/backward_types.h b/src/backend/backward_types.h index d17bc53a..2ee3fdff 100644 --- a/src/backend/backward_types.h +++ b/src/backend/backward_types.h @@ -2,7 +2,7 @@ * \file RMF/types.h * \brief Handle read/write of Model data from/to files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/src/backend/deprecated_avro/AvroKeysAndCategories.h b/src/backend/deprecated_avro/AvroKeysAndCategories.h index 89a88db4..25802375 100644 --- a/src/backend/deprecated_avro/AvroKeysAndCategories.h +++ b/src/backend/deprecated_avro/AvroKeysAndCategories.h @@ -2,7 +2,7 @@ * \file RMF/internal/SharedData.h * \brief Handle read/write of Model data from/to files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/src/backend/deprecated_avro/AvroSharedData.h b/src/backend/deprecated_avro/AvroSharedData.h index 4a7d8b66..1f2c29ea 100644 --- a/src/backend/deprecated_avro/AvroSharedData.h +++ b/src/backend/deprecated_avro/AvroSharedData.h @@ -2,7 +2,7 @@ * \file RMF/internal/SharedData.h * \brief Handle read/write of Model data from/to files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/src/backend/deprecated_avro/AvroSharedData.impl.h b/src/backend/deprecated_avro/AvroSharedData.impl.h index 49a6203a..bc6a8d4e 100644 --- a/src/backend/deprecated_avro/AvroSharedData.impl.h +++ b/src/backend/deprecated_avro/AvroSharedData.impl.h @@ -2,7 +2,7 @@ * \file RMF/internal/SharedData.h * \brief Handle read/write of Model data from/to files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/src/backend/deprecated_avro/AvroSharedData.types.h b/src/backend/deprecated_avro/AvroSharedData.types.h index 68ae2282..dca9fe8d 100644 --- a/src/backend/deprecated_avro/AvroSharedData.types.h +++ b/src/backend/deprecated_avro/AvroSharedData.types.h @@ -2,7 +2,7 @@ * \file RMF/internal/SharedData.h * \brief Handle read/write of Model data from/to files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/src/backend/deprecated_avro/MultipleAvroFileBase.cpp b/src/backend/deprecated_avro/MultipleAvroFileBase.cpp index 7e02a727..824f423c 100644 --- a/src/backend/deprecated_avro/MultipleAvroFileBase.cpp +++ b/src/backend/deprecated_avro/MultipleAvroFileBase.cpp @@ -2,7 +2,7 @@ * \file RMF/paths.cpp * \brief Handle read/write of Model data from/to files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/src/backend/deprecated_avro/MultipleAvroFileBase.h b/src/backend/deprecated_avro/MultipleAvroFileBase.h index 74420321..bb558a7b 100644 --- a/src/backend/deprecated_avro/MultipleAvroFileBase.h +++ b/src/backend/deprecated_avro/MultipleAvroFileBase.h @@ -2,7 +2,7 @@ * \file RMF/internal/SharedData.h * \brief Handle read/write of Model data from/to files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/src/backend/deprecated_avro/MultipleAvroFileReader.cpp b/src/backend/deprecated_avro/MultipleAvroFileReader.cpp index 00fadda0..e6155cb4 100644 --- a/src/backend/deprecated_avro/MultipleAvroFileReader.cpp +++ b/src/backend/deprecated_avro/MultipleAvroFileReader.cpp @@ -2,7 +2,7 @@ * \file RMF/paths.cpp * \brief Handle read/write of Model data from/to files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/src/backend/deprecated_avro/MultipleAvroFileReader.h b/src/backend/deprecated_avro/MultipleAvroFileReader.h index d4f69a0d..b9615538 100644 --- a/src/backend/deprecated_avro/MultipleAvroFileReader.h +++ b/src/backend/deprecated_avro/MultipleAvroFileReader.h @@ -2,7 +2,7 @@ * \file RMF/internal/SharedData.h * \brief Handle read/write of Model data from/to files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/src/backend/deprecated_avro/MultipleAvroFileWriter.cpp b/src/backend/deprecated_avro/MultipleAvroFileWriter.cpp index 0870be0c..7cb37afa 100644 --- a/src/backend/deprecated_avro/MultipleAvroFileWriter.cpp +++ b/src/backend/deprecated_avro/MultipleAvroFileWriter.cpp @@ -2,7 +2,7 @@ * \file RMF/paths.cpp * \brief Handle read/write of Model data from/to files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/src/backend/deprecated_avro/MultipleAvroFileWriter.h b/src/backend/deprecated_avro/MultipleAvroFileWriter.h index a6fd8692..c0fac20b 100644 --- a/src/backend/deprecated_avro/MultipleAvroFileWriter.h +++ b/src/backend/deprecated_avro/MultipleAvroFileWriter.h @@ -2,7 +2,7 @@ * \file RMF/internal/SharedData.h * \brief Handle read/write of Model data from/to files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/src/backend/deprecated_avro/SingleAvroFile.cpp b/src/backend/deprecated_avro/SingleAvroFile.cpp index 6e47be65..8c3a727a 100644 --- a/src/backend/deprecated_avro/SingleAvroFile.cpp +++ b/src/backend/deprecated_avro/SingleAvroFile.cpp @@ -2,7 +2,7 @@ * \file RMF/paths.cpp * \brief Handle read/write of Model data from/to files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/src/backend/deprecated_avro/SingleAvroFile.h b/src/backend/deprecated_avro/SingleAvroFile.h index 4bb601fd..a8c8a3ef 100644 --- a/src/backend/deprecated_avro/SingleAvroFile.h +++ b/src/backend/deprecated_avro/SingleAvroFile.h @@ -2,7 +2,7 @@ * \file RMF/internal/SharedData.h * \brief Handle read/write of Model data from/to files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/src/backend/deprecated_avro/avro_schema_io.cpp b/src/backend/deprecated_avro/avro_schema_io.cpp index 44685e21..d5bea82a 100644 --- a/src/backend/deprecated_avro/avro_schema_io.cpp +++ b/src/backend/deprecated_avro/avro_schema_io.cpp @@ -2,7 +2,7 @@ * \file RMF/paths.cpp * \brief Handle read/write of Model data from/to files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/src/backend/deprecated_avro/avro_schema_io.h b/src/backend/deprecated_avro/avro_schema_io.h index a808c8ef..776badd4 100644 --- a/src/backend/deprecated_avro/avro_schema_io.h +++ b/src/backend/deprecated_avro/avro_schema_io.h @@ -2,7 +2,7 @@ * \file compatibility/hash.h * \brief Make sure that we avoid errors in specialization of boost hash * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. */ #ifndef RMF_INTERNAL_AVRO_SCHEMA_IO_H diff --git a/src/backend/deprecated_avro/create.cpp b/src/backend/deprecated_avro/create.cpp index 7a8895e2..fea46707 100644 --- a/src/backend/deprecated_avro/create.cpp +++ b/src/backend/deprecated_avro/create.cpp @@ -2,7 +2,7 @@ * \file RMF/paths.cpp * \brief Handle read/write of Model data from/to files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ @@ -45,30 +45,30 @@ typedef backends::BackwardsIO > AvroReaderShareData; struct SingleTextAvroFactory : public RMF::backends::IOFactory { - virtual std::string get_file_extension() const RMF_OVERRIDE { + virtual std::string get_file_extension() const override { return ".rmf-text"; } virtual boost::shared_ptr read_file( - const std::string& name) const RMF_OVERRIDE { + const std::string& name) const override { return boost::make_shared(name, false, true); } virtual boost::shared_ptr create_file( - const std::string& name) const RMF_OVERRIDE { + const std::string& name) const override { return boost::make_shared(name, true, false); } virtual ~SingleTextAvroFactory() {} }; struct SingleAvroFactory : public SingleTextAvroFactory { - virtual std::string get_file_extension() const RMF_OVERRIDE { + virtual std::string get_file_extension() const override { return ".rmfa"; } /*virtual boost::shared_ptr create_buffer( - BufferHandle buffer) const RMF_OVERRIDE { + BufferHandle buffer) const override { return boost::make_shared(buffer); }*/ virtual boost::shared_ptr read_buffer( - BufferConstHandle buffer) const RMF_OVERRIDE { + BufferConstHandle buffer) const override { try { return boost::make_shared(buffer); } @@ -81,15 +81,15 @@ struct SingleAvroFactory : public SingleTextAvroFactory { }; struct MultipleAvroFactory : public RMF::backends::IOFactory { - virtual std::string get_file_extension() const RMF_OVERRIDE { + virtual std::string get_file_extension() const override { return ".rmf-avro"; } virtual boost::shared_ptr read_file( - const std::string& name) const RMF_OVERRIDE { + const std::string& name) const override { return boost::make_shared(name, false, true); } virtual boost::shared_ptr create_file( - const std::string& name) const RMF_OVERRIDE { + const std::string& name) const override { return boost::make_shared(name, true, false); } virtual ~MultipleAvroFactory() {} diff --git a/src/backend/deprecated_hdf5/HDF5DataSetCache1D.h b/src/backend/deprecated_hdf5/HDF5DataSetCache1D.h index a2ecd18e..4dbed2ca 100644 --- a/src/backend/deprecated_hdf5/HDF5DataSetCache1D.h +++ b/src/backend/deprecated_hdf5/HDF5DataSetCache1D.h @@ -2,7 +2,7 @@ * \file RMF/internal/SharedData.h * \brief Handle read/write of Model data from/to files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/src/backend/deprecated_hdf5/HDF5DataSetCache2D.h b/src/backend/deprecated_hdf5/HDF5DataSetCache2D.h index 07e938ec..5c27ce3c 100644 --- a/src/backend/deprecated_hdf5/HDF5DataSetCache2D.h +++ b/src/backend/deprecated_hdf5/HDF5DataSetCache2D.h @@ -2,7 +2,7 @@ * \file RMF/internal/SharedData.h * \brief Handle read/write of Model data from/to files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/src/backend/deprecated_hdf5/HDF5DataSetCache3D.h b/src/backend/deprecated_hdf5/HDF5DataSetCache3D.h index 3a6427c5..2b4b583a 100644 --- a/src/backend/deprecated_hdf5/HDF5DataSetCache3D.h +++ b/src/backend/deprecated_hdf5/HDF5DataSetCache3D.h @@ -2,7 +2,7 @@ * \file RMF/internal/SharedData.h * \brief Handle read/write of Model data from/to files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/src/backend/deprecated_hdf5/HDF5DataSetCacheD.h b/src/backend/deprecated_hdf5/HDF5DataSetCacheD.h index 990f65fa..bfdbdeae 100644 --- a/src/backend/deprecated_hdf5/HDF5DataSetCacheD.h +++ b/src/backend/deprecated_hdf5/HDF5DataSetCacheD.h @@ -2,7 +2,7 @@ * \file RMF/internal/SharedData.h * \brief Handle read/write of Model data from/to files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/src/backend/deprecated_hdf5/HDF5SharedData.cpp b/src/backend/deprecated_hdf5/HDF5SharedData.cpp index 90260c3a..341f8adc 100644 --- a/src/backend/deprecated_hdf5/HDF5SharedData.cpp +++ b/src/backend/deprecated_hdf5/HDF5SharedData.cpp @@ -2,7 +2,7 @@ * \file RMF/Category.h * \brief Handle read/write of Model data from/to files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ @@ -93,7 +93,7 @@ void HDF5SharedData::open_things(bool create, bool read_only) { void HDF5SharedData::initialize_keys(int) { Categories cats = get_categories(); - RMF_FOREACH(Category cat, cats) { RMF_FOREACH_BACKWARDS_TYPE(RMF_LIST_KEYS); } + for(Category cat : cats) { RMF_FOREACH_BACKWARDS_TYPE(RMF_LIST_KEYS); } initialize_keys(get_category("link"), "nodeid", NodeIDTraits()); } diff --git a/src/backend/deprecated_hdf5/HDF5SharedData.h b/src/backend/deprecated_hdf5/HDF5SharedData.h index 9f3bbcf8..e9ee640a 100644 --- a/src/backend/deprecated_hdf5/HDF5SharedData.h +++ b/src/backend/deprecated_hdf5/HDF5SharedData.h @@ -2,7 +2,7 @@ * \file RMF/internal/SharedData.h * \brief Handle read/write of Model data from/to files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ @@ -137,7 +137,7 @@ class HDF5SharedData : public backends::BackwardsIOBase { kcname, arity, TypeTraits::HDF5Traits::get_name(), true); cache_.resize( std::max(cache_.size(), static_cast(category_index + 1)), - NULL); + nullptr); cache_.replace(category_index, new DS()); cache_[category_index].set_current_frame(frame_.get_index()); cache_[category_index].set(file, nm); @@ -173,7 +173,7 @@ class HDF5SharedData : public backends::BackwardsIOBase { kcname, arity, TypeTraits::HDF5Traits::get_name(), false); cache_.resize( std::max(cache_.size(), static_cast(category_index + 1)), - NULL); + nullptr); cache_.replace(category_index, new DS()); cache_[category_index].set(file, nm); } @@ -210,7 +210,7 @@ class HDF5SharedData : public backends::BackwardsIOBase { cache_[cat.get_index()][pfi] .resize(std::max(cache_[cat.get_index()][pfi].size(), static_cast(type_index + 1)), - NULL); + nullptr); cache_[cat.get_index()][pfi].replace(type_index, new DS()); cache_[cat.get_index()][pfi][type_index].set(file, nm); } @@ -591,7 +591,7 @@ class HDF5SharedData : public backends::BackwardsIOBase { std::vector > ret; typename NameKeyMap::const_iterator oit = name_key_map_.find(cat); if (oit == name_key_map_.end()) return ret; - RMF_FOREACH(NameKeyInnerMap::const_reference rt, oit->second) { + for(NameKeyInnerMap::const_reference rt : oit->second) { if (key_data_map_.find(rt.second)->second.type_index == TypeTraits::HDF5Traits::get_index()) { ret.push_back(ID(rt.second)); diff --git a/src/backend/deprecated_hdf5/create.cpp b/src/backend/deprecated_hdf5/create.cpp index 5b4f99a1..78da7e9f 100644 --- a/src/backend/deprecated_hdf5/create.cpp +++ b/src/backend/deprecated_hdf5/create.cpp @@ -2,7 +2,7 @@ * \file RMF/paths.cpp * \brief Handle read/write of Model data from/to files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ @@ -33,15 +33,15 @@ namespace { typedef backends::BackwardsIO MIO; struct HDF5Factory : public RMF::backends::IOFactory { - virtual std::string get_file_extension() const RMF_OVERRIDE { + virtual std::string get_file_extension() const override { return ".rmf-hdf5"; } virtual boost::shared_ptr read_file( - const std::string& name) const RMF_OVERRIDE { + const std::string& name) const override { return boost::make_shared(name, false, true); } virtual boost::shared_ptr create_file( - const std::string& name) const RMF_OVERRIDE { + const std::string& name) const override { return boost::make_shared(name, true, false); } virtual ~HDF5Factory() {} diff --git a/src/backend/deprecated_hdf5/names.h b/src/backend/deprecated_hdf5/names.h index 64431714..2fed52ca 100644 --- a/src/backend/deprecated_hdf5/names.h +++ b/src/backend/deprecated_hdf5/names.h @@ -2,7 +2,7 @@ * \file RMF/names.h * \brief Handle read/write of Model data from/to files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/src/decorator/alternatives.cpp b/src/decorator/alternatives.cpp index 4867259d..5e126ce5 100644 --- a/src/decorator/alternatives.cpp +++ b/src/decorator/alternatives.cpp @@ -2,7 +2,7 @@ * \file RMF/Category.h * \brief Handle read/write of Model data from/to files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ @@ -26,7 +26,7 @@ std::pair get_resolution_impl(NodeConstHandle root, IntermediateParticleFactory ipcf, GaussianParticleFactory gpf) { std::pair ret(std::numeric_limits::max(), false); - RMF_FOREACH(NodeConstHandle ch, root.get_children()) { + for(NodeConstHandle ch : root.get_children()) { std::pair cur = get_resolution_impl(ch, ipcf, gpf); ret.first = std::min(ret.first, cur.first); ret.second = ret.second || cur.second; @@ -139,7 +139,7 @@ NodeConstHandle AlternativesConst::get_alternative(RepresentationType type, NodeConstHandles AlternativesConst::get_alternatives(RepresentationType type) const { NodeConstHandles ret; - RMF_FOREACH(NodeID nid, get_alternatives_impl(type)) { + for(NodeID nid : get_alternatives_impl(type)) { ret.push_back(get_node().get_file().get_node(nid)); } return ret; @@ -162,11 +162,11 @@ Floats get_resolutions_impl(NodeConstHandle root, AlternativesFactory af, RepresentationType type) { Floats ret; if (af.get_is(root)) { - RMF_FOREACH(NodeConstHandle a, af.get(root).get_alternatives(type)) { + for(NodeConstHandle a : af.get(root).get_alternatives(type)) { ret.push_back(get_resolution(a)); } } else { - RMF_FOREACH(NodeConstHandle ch, root.get_children()) { + for(NodeConstHandle ch : root.get_children()) { Floats cur = get_resolutions_impl(ch, af, type); ret.insert(ret.end(), cur.begin(), cur.end()); } @@ -184,7 +184,7 @@ Floats get_resolutions(NodeConstHandle root, RepresentationType type, double lb = unclustered[0]; double ub = lb; Floats ret; - RMF_FOREACH(double r, unclustered) { + for(double r : unclustered) { if (r > lb + accuracy) { ret.push_back(.5 * (lb + ub)); lb = r; diff --git a/src/decorators.cpp b/src/decorators.cpp index a4f24801..62d68668 100644 --- a/src/decorators.cpp +++ b/src/decorators.cpp @@ -2,7 +2,7 @@ * \file RMF/Category.h * \brief Handle read/write of Model data from/to files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/src/enums.cpp b/src/enums.cpp index 0341bcb3..7319c259 100644 --- a/src/enums.cpp +++ b/src/enums.cpp @@ -2,7 +2,7 @@ * \file RMF/Category.h * \brief Handle read/write of Model data from/to files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/src/exceptions.cpp b/src/exceptions.cpp index 90b8a573..761ced4e 100644 --- a/src/exceptions.cpp +++ b/src/exceptions.cpp @@ -2,7 +2,7 @@ * \file RMF/Category.h * \brief Handle read/write of Model data from/to files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ @@ -19,7 +19,7 @@ RMF_ENABLE_WARNINGS namespace RMF { Exception::Exception() {} -const char* Exception::what() const throw() { +const char* Exception::what() const RMF_NOEXCEPT { try { if (message_.empty()) { message_ = get_message(*this); @@ -30,7 +30,7 @@ const char* Exception::what() const throw() { return message_.c_str(); } -Exception::~Exception() throw() {} +Exception::~Exception() RMF_NOEXCEPT {} std::string get_message(const Exception& e) { using namespace RMF::internal::ErrorInfo; try { @@ -95,16 +95,16 @@ std::string get_message(const Exception& e) { } } UsageException::UsageException() : Exception() {} -UsageException::~UsageException() throw() {} +UsageException::~UsageException() RMF_NOEXCEPT {} IOException::IOException() : Exception() {} -IOException::~IOException() throw() {} +IOException::~IOException() RMF_NOEXCEPT {} IndexException::IndexException() : Exception() {} -IndexException::~IndexException() throw() {} +IndexException::~IndexException() RMF_NOEXCEPT {} InternalException::InternalException() : Exception() {} -InternalException::~InternalException() throw() {} +InternalException::~InternalException() RMF_NOEXCEPT {} } /* namespace RMF */ diff --git a/src/hdf5_wrapper.cpp b/src/hdf5_wrapper.cpp index 2e1a139e..0f2958ce 100644 --- a/src/hdf5_wrapper.cpp +++ b/src/hdf5_wrapper.cpp @@ -2,7 +2,7 @@ * \file RMF/Category.h * \brief Handle read/write of Model data from/to files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ @@ -84,7 +84,7 @@ unsigned int ConstGroup::get_number_of_children() const { } std::string ConstGroup::get_child_name(unsigned int i) const { int sz = H5Lget_name_by_idx(get_handle(), ".", H5_INDEX_NAME, H5_ITER_NATIVE, - (hsize_t)i, NULL, 0, H5P_DEFAULT); + (hsize_t)i, nullptr, 0, H5P_DEFAULT); boost::scoped_array buf(new char[sz + 1]); RMF_HDF5_CALL(H5Lget_name_by_idx(get_handle(), ".", H5_INDEX_NAME, H5_ITER_NATIVE, (hsize_t)i, buf.get(), @@ -166,7 +166,7 @@ herr_t error_function(hid_t, void*) { // throws RMF::IOException on error File create_file(std::string name) { RMF_HDF5_CALL(H5open()); - RMF_HDF5_CALL(H5Eset_auto2(H5E_DEFAULT, &error_function, NULL)); + RMF_HDF5_CALL(H5Eset_auto2(H5E_DEFAULT, &error_function, nullptr)); RMF_HDF5_HANDLE(plist, get_parameters(), H5Pclose); RMF_HDF5_NEW_HANDLE( h, H5Fcreate(name.c_str(), H5F_ACC_TRUNC, H5P_DEFAULT, plist), &H5Fclose); @@ -175,7 +175,7 @@ File create_file(std::string name) { File open_file(std::string name) { RMF_HDF5_CALL(H5open()); - RMF_HDF5_CALL(H5Eset_auto2(H5E_DEFAULT, &error_function, NULL)); + RMF_HDF5_CALL(H5Eset_auto2(H5E_DEFAULT, &error_function, nullptr)); RMF_HDF5_HANDLE(plist, get_parameters(), H5Pclose); RMF_HDF5_NEW_HANDLE(h, H5Fopen(name.c_str(), H5F_ACC_RDWR, plist), &H5Fclose); return File(h); @@ -183,7 +183,7 @@ File open_file(std::string name) { ConstFile open_file_read_only(std::string name) { RMF_HDF5_CALL(H5open()); - RMF_HDF5_CALL(H5Eset_auto2(H5E_DEFAULT, &error_function, NULL)); + RMF_HDF5_CALL(H5Eset_auto2(H5E_DEFAULT, &error_function, nullptr)); RMF_HDF5_HANDLE(plist, get_parameters(), H5Pclose); RMF_HDF5_NEW_HANDLE(h, H5Fopen(name.c_str(), H5F_ACC_RDONLY, plist), &H5Fclose); @@ -192,7 +192,7 @@ ConstFile open_file_read_only(std::string name) { File open_file_read_only_returning_nonconst(std::string name) { RMF_HDF5_CALL(H5open()); - RMF_HDF5_CALL(H5Eset_auto2(H5E_DEFAULT, &error_function, NULL)); + RMF_HDF5_CALL(H5Eset_auto2(H5E_DEFAULT, &error_function, nullptr)); RMF_HDF5_HANDLE(plist, get_parameters(), H5Pclose); RMF_HDF5_NEW_HANDLE(h, H5Fopen(name.c_str(), H5F_ACC_RDONLY, plist), &H5Fclose); @@ -212,13 +212,13 @@ void File::flush() { RMF_HDF5_CALL(H5Fflush(get_handle(), H5F_SCOPE_LOCAL)); } }*/ std::string ConstFile::get_name() const { - int sz = H5Fget_name(get_handle(), NULL, 0); + int sz = H5Fget_name(get_handle(), nullptr, 0); boost::scoped_array buf(new char[sz + 1]); RMF_HDF5_CALL(H5Fget_name(get_handle(), buf.get(), sz + 1)); return std::string(buf.get()); } std::string File::get_name() const { - int sz = H5Fget_name(get_handle(), NULL, 0); + int sz = H5Fget_name(get_handle(), nullptr, 0); boost::scoped_array buf(new char[sz + 1]); RMF_HDF5_CALL(H5Fget_name(get_handle(), buf.get(), sz + 1)); return std::string(buf.get()); @@ -277,7 +277,7 @@ void StringsTraits::write_value_dataset(hid_t d, hid_t iss, hid_t s, } data.p = buf.get(); } else { - data.p = NULL; + data.p = nullptr; } RMF_HDF5_CALL( H5Dwrite(d, get_hdf5_memory_type(), iss, s, H5P_DEFAULT, &data)); @@ -302,7 +302,7 @@ StringsTraits::Type StringsTraits::read_value_dataset(hid_t d, hid_t iss, } const hvl_t& StringsTraits::get_fill_value() { - static hvl_t ret = {0, NULL}; + static hvl_t ret = {0, nullptr}; return ret; } @@ -340,7 +340,7 @@ void StringTraits::write_value_dataset(hid_t d, hid_t iss, hid_t s, StringTraits::Type StringTraits::read_value_dataset(hid_t d, hid_t iss, hid_t sp) { - char* c = NULL; + char* c = nullptr; RMF_HDF5_HANDLE(mt, internal::create_string_type(), H5Tclose); RMF_HDF5_CALL(H5Dread(d, mt, iss, sp, H5P_DEFAULT, &c)); std::string ret; diff --git a/src/info.cpp b/src/info.cpp index 5b2460ef..58947997 100644 --- a/src/info.cpp +++ b/src/info.cpp @@ -2,7 +2,7 @@ * \file RMF/Category.h * \brief Handle read/write of Model data from/to files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ @@ -26,9 +26,9 @@ namespace RMF { template void show_key_info(FileConstHandle rh, Category cat, std::string name, std::ostream& out) { - RMF_FOREACH(ID k, rh.get_keys(cat)) { + for(ID k : rh.get_keys(cat)) { int static_count = 0, frame_count = 0; - RMF_FOREACH(NodeID n, rh.get_node_ids()) { + for(NodeID n : rh.get_node_ids()) { NodeConstHandle nh = rh.get_node(n); if (rh.get_current_frame() != FrameID() && !nh.get_frame_value(k).get_is_null()) { @@ -48,7 +48,7 @@ void show_key_info(FileConstHandle rh, Category cat, std::string name, void show_info(FileConstHandle rh, std::ostream& out) { out << "Nodes: " << rh.get_number_of_nodes() << std::endl; out << "Frames: " << rh.get_number_of_frames() << std::endl; - RMF_FOREACH(Category c, rh.get_categories()) { + for(Category c : rh.get_categories()) { out << rh.get_name(c) << ":" << std::endl; RMF_FOREACH_TYPE(RMF_SHOW_TYPE_DATA_INFO); } diff --git a/src/internal/SharedData.cpp b/src/internal/SharedData.cpp index 321d0fbb..0672d414 100644 --- a/src/internal/SharedData.cpp +++ b/src/internal/SharedData.cpp @@ -2,7 +2,7 @@ * \file RMF/Category.h * \brief Handle read/write of Model data from/to files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/src/internal/Transform.cpp b/src/internal/Transform.cpp index 53cf3b55..d310bda3 100644 --- a/src/internal/Transform.cpp +++ b/src/internal/Transform.cpp @@ -2,7 +2,7 @@ * \file RMF/Transform.h * \brief Handle read/write of Model data from/to files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/src/internal/clone_shared_data.h b/src/internal/clone_shared_data.h index 5ad5593c..19d9e0e5 100644 --- a/src/internal/clone_shared_data.h +++ b/src/internal/clone_shared_data.h @@ -2,7 +2,7 @@ * \file RMF/internal/SharedData.h * \brief Handle read/write of Model data from/to files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ @@ -60,9 +60,9 @@ void clone_hierarchy(SDA* sda, SDB* sdb) { RMF_LARGE_UNORDERED_MAP parents, deferred_parents; typedef RMF_LARGE_UNORDERED_MAP::value_type NodeIDMapValue; - RMF_FOREACH(NodeID na, get_nodes(sda)) { + for(NodeID na : get_nodes(sda)) { NodeIDs children = sda->get_children(na); - RMF_FOREACH(NodeID c, children) { + for(NodeID c : children) { if (parents.find(c) == parents.end() && c.get_index() >= sdb->get_number_of_nodes()) { parents[c] = na; @@ -73,13 +73,13 @@ void clone_hierarchy(SDA* sda, SDB* sdb) { RMF_LARGE_UNORDERED_SET existing; RMF_LARGE_UNORDERED_MAP > existing_parents; - RMF_FOREACH(NodeID nb, get_nodes(sdb)) { + for(NodeID nb : get_nodes(sdb)) { existing.insert(nb); - RMF_FOREACH(NodeID ch, sdb->get_children(nb)) { + for(NodeID ch : sdb->get_children(nb)) { existing_parents[ch].insert(nb); } } - RMF_FOREACH(NodeID na, get_nodes(sda)) { + for(NodeID na : get_nodes(sda)) { if (existing.find(na) != existing.end()) continue; if (parents.find(na) != parents.end()) { NodeID parent = parents.find(na)->second; @@ -102,13 +102,13 @@ void clone_hierarchy(SDA* sda, SDB* sdb) { RMF_INTERNAL_CHECK(nid == na, "Don't match"); } } - RMF_FOREACH(NodeIDMapValue v, deferred_parents) { + for(NodeIDMapValue v : deferred_parents) { sdb->add_child(v.second, v.first); } - RMF_FOREACH(NodeID na, get_nodes(sda)) { + for(NodeID na : get_nodes(sda)) { NodeIDs children = sda->get_children(na); - RMF_FOREACH(NodeID c, children) { + for(NodeID c : children) { if (parents.find(c) != parents.end() && parents.find(c)->second != na && existing_parents[c].find(na) == existing_parents[c].end()) { sdb->add_child(na, c); @@ -142,9 +142,8 @@ void clone_values_type(SDA* sda, Category cata, SDB* sdb, Category catb, H) { RMF_LARGE_UNORDERED_MAP, ID > keys = get_key_map(sda, cata, sdb, catb); if (keys.empty()) return; - typedef std::pair, ID > KP; - RMF_FOREACH(KP ks, keys) { - RMF_FOREACH(NodeID n, get_nodes(sda)) { + for(const auto &ks : keys) { + for(NodeID n : get_nodes(sda)) { typename TraitsA::ReturnType rt = H::get(sda, n, ks.first); if (!TraitsA::get_is_null_value(rt)) { H::set(sdb, n, ks.second, get_as(rt)); @@ -170,7 +169,7 @@ void clone_values_category(SDA* sda, Category cata, SDB* sdb, Category catb, template void clone_static_data(SDA* sda, SDB* sdb) { - RMF_FOREACH(Category cata, sda->get_categories()) { + for(Category cata : sda->get_categories()) { Category catb = sdb->get_category(sda->get_name(cata)); clone_values_category(sda, cata, sdb, catb, StaticValues()); } @@ -178,7 +177,7 @@ void clone_static_data(SDA* sda, SDB* sdb) { template void clone_loaded_data(SDA* sda, SDB* sdb) { - RMF_FOREACH(Category cata, sda->get_categories()) { + for(Category cata : sda->get_categories()) { Category catb = sdb->get_category(sda->get_name(cata)); clone_values_category(sda, cata, sdb, catb, LoadedValues()); } diff --git a/src/internal/paths.cpp b/src/internal/paths.cpp index 9c8f33df..c147bfc1 100644 --- a/src/internal/paths.cpp +++ b/src/internal/paths.cpp @@ -2,7 +2,7 @@ * \file RMF/paths.cpp * \brief Handle read/write of Model data from/to files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ @@ -157,7 +157,7 @@ std::string get_unique_path() { boost::filesystem::path temp = boost::filesystem::unique_path(); return temp.string(); #else - return tmpnam(NULL); + return tmpnam(nullptr); #endif } diff --git a/src/internal/shared_data_equality.h b/src/internal/shared_data_equality.h index 604db0c4..baaccddf 100644 --- a/src/internal/shared_data_equality.h +++ b/src/internal/shared_data_equality.h @@ -2,7 +2,7 @@ * \file RMF/internal/SharedData.h * \brief Handle read/write of Model data from/to files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ @@ -28,9 +28,9 @@ bool get_equal_values_type(SDA* sda, Category cata, SDB* sdb, Category catb, RMF_LARGE_UNORDERED_MAP, ID > keys = get_key_map(sda, cata, sdb, catb); bool ret = true; - RMF_FOREACH(NodeID n, get_nodes(sda)) { + for(NodeID n : get_nodes(sda)) { typedef std::pair, ID > KP; - RMF_FOREACH(KP ks, keys) { + for(KP ks : keys) { typename Traits::ReturnType rta = H::get(sda, n, ks.first); typename Traits::ReturnType rtb = H::get(sdb, n, ks.second); bool ha = !Traits::get_is_null_value(rta); @@ -65,7 +65,7 @@ bool get_equal_current_values_category(SDA* sda, Category cata, SDB* sdb, template bool get_equal_current_values(SDA* sda, SDB* sdb) { - RMF_FOREACH(Category cata, sda->get_categories()) { + for(Category cata : sda->get_categories()) { Category catb = sdb->get_category(sda->get_name(cata)); if (!get_equal_current_values_category(sda, cata, sdb, catb)) return false; } @@ -85,7 +85,7 @@ bool get_equal_static_values_category(SDA* sda, Category cata, SDB* sdb, template bool get_equal_static_values(SDA* sda, SDB* sdb) { - RMF_FOREACH(Category cata, sda->get_categories()) { + for(Category cata : sda->get_categories()) { Category catb = sdb->get_category(sda->get_name(cata)); if (!get_equal_static_values_category(sda, cata, sdb, catb)) return false; } diff --git a/src/internal/shared_data_factories.cpp b/src/internal/shared_data_factories.cpp index 7fa4bcee..7ca77527 100644 --- a/src/internal/shared_data_factories.cpp +++ b/src/internal/shared_data_factories.cpp @@ -2,7 +2,7 @@ * \file RMF/Category.h * \brief Handle read/write of Model data from/to files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/src/internal/shared_data_maps.h b/src/internal/shared_data_maps.h index ccf0ef3d..a45fa37e 100644 --- a/src/internal/shared_data_maps.h +++ b/src/internal/shared_data_maps.h @@ -2,7 +2,7 @@ * \file RMF/internal/SharedData.h * \brief Handle read/write of Model data from/to files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ @@ -26,7 +26,7 @@ RMF_LARGE_UNORDERED_MAP, ID > get_key_map(SDA* sda, Category catb) { RMF_LARGE_UNORDERED_MAP, ID > ret; std::vector > keysa = sda->get_keys(cata, TraitsA()); - RMF_FOREACH(ID keya, keysa) { + for(ID keya : keysa) { ret[keya] = sdb->get_key(catb, sda->get_name(keya), TraitsB()); RMF_TRACE(sda->get_name(keya) << " maps to " << sdb->get_name(ret[keya])); } diff --git a/src/log.cpp b/src/log.cpp index dfd221bd..55a4771d 100644 --- a/src/log.cpp +++ b/src/log.cpp @@ -2,7 +2,7 @@ * \file RMF/Category.h * \brief Handle read/write of Model data from/to files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ // IWYU pragma: no_include @@ -41,10 +41,10 @@ struct Configurator { void do_init() { // "%-4r [%t] %-5p %c %x - %m%n" - static log4cxx::PatternLayoutPtr layout = - new log4cxx::PatternLayout(LOG4CXX_STR("%-6r %-5p %c- %m%n")); - static log4cxx::ConsoleAppenderPtr appender = - new log4cxx::ConsoleAppender(layout); + static log4cxx::PatternLayoutPtr layout( + new log4cxx::PatternLayout(LOG4CXX_STR("%-6r %-5p %c- %m%n"))); + static log4cxx::ConsoleAppenderPtr appender( + new log4cxx::ConsoleAppender(layout)); static Configurator config(appender); use(config); set_log_level("off"); diff --git a/src/names.cpp b/src/names.cpp index 07813ffe..46c0277d 100644 --- a/src/names.cpp +++ b/src/names.cpp @@ -2,7 +2,7 @@ * \file RMF/names.cpp * \brief Functions to check if names are valid. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/src/show_hierarchy.cpp b/src/show_hierarchy.cpp index efbc4ef1..718875f4 100644 --- a/src/show_hierarchy.cpp +++ b/src/show_hierarchy.cpp @@ -2,7 +2,7 @@ * \file RMF/Category.h * \brief Handle read/write of Model data from/to files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ @@ -46,7 +46,7 @@ void show_data(NodeConstHandle n, std::ostream& out, const std::vector >& ks, std::string prefix) { using std::operator<<; FileConstHandle f = n.get_file(); - RMF_FOREACH(ID k, ks) { + for(ID k : ks) { if (n.get_file().get_current_frame() != FrameID() && !n.get_frame_value(k).get_is_null()) { out << std::endl << prefix << n.get_file().get_name(k) << ": " @@ -81,7 +81,7 @@ void print_tree(std::ostream& out, RMF::NodeConstHandle start, Show show) { { NodeConstHandles alts = ad.get_alternatives(GAUSSIAN_PARTICLE); std::reverse(alts.begin(), alts.end()); - RMF_FOREACH(NodeConstHandle cur, alts) { + for(NodeConstHandle cur : alts) { RMF_INTERNAL_CHECK(cur != n, "Node can't be a gaussian one"); std::ostringstream oss; oss << "[G" << decorator::get_resolution(cur) << "]"; @@ -93,7 +93,7 @@ void print_tree(std::ostream& out, RMF::NodeConstHandle start, Show show) { RMF_INTERNAL_CHECK(alts.front() == n, "The node itself is not in front"); std::reverse(alts.begin(), alts.end()); - RMF_FOREACH(NodeConstHandle cur, alts) { + for(NodeConstHandle cur : alts) { if (cur == n) continue; std::ostringstream oss; oss << "[" << decorator::get_resolution(cur) << "]"; @@ -138,7 +138,7 @@ void show_frames_impl(FileConstHandle fh, FrameID root, std::string prefix, out << " + "; } out << fh.get_name(root) << " [" << fh.get_type(root) << "]" << std::endl; - RMF_FOREACH(FrameID id, ch) { show_frames_impl(fh, id, prefix + " ", out); } + for(FrameID id : ch) { show_frames_impl(fh, id, prefix + " ", out); } } void simple_show_node(NodeConstHandle n, std::string /*prefix*/, @@ -372,7 +372,7 @@ void show_hierarchy_with_decorators(NodeConstHandle root, bool, } void show_frames(FileConstHandle fh, std::ostream& out) { - RMF_FOREACH(FrameID fr, fh.get_root_frames()) { + for(FrameID fr : fh.get_root_frames()) { show_frames_impl(fh, fr, std::string(), out); } } diff --git a/src/signature.cpp b/src/signature.cpp index 0976dfd1..6107b727 100644 --- a/src/signature.cpp +++ b/src/signature.cpp @@ -2,7 +2,7 @@ * \file RMF/signature.cpp * \brief Return a (long) string describing a file that can be compared. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ @@ -43,17 +43,17 @@ std::string get_static_signature( decorator::ScaleFactory scalecf) { std::ostringstream ret; ret << "hierarchy [\n"; - RMF_FOREACH(NodeID n, file.get_node_ids()) { + for(NodeID n : file.get_node_ids()) { NodeConstHandle nh = file.get_node(n); ret << n << ":"; - RMF_FOREACH(NodeConstHandle c, nh.get_children()) { + for(NodeConstHandle c : nh.get_children()) { ret << " " << c.get_id(); } ret << "\n"; } ret << "]\n"; ret << "static [\n"; - RMF_FOREACH(NodeID n, file.get_node_ids()) { + for(NodeID n : file.get_node_ids()) { NodeConstHandle nh = file.get_node(n); ret << n << ":"; if (bdcf.get_is_static(nh)) ret << " bond"; @@ -96,7 +96,7 @@ std::string get_frame_signature( decorator::ScaleFactory scalecf) { std::ostringstream ret; ret << file.get_current_frame() << " [\n"; - RMF_FOREACH(NodeID n, file.get_node_ids()) { + for(NodeID n : file.get_node_ids()) { NodeConstHandle nh = file.get_node(n); ret << n << ":"; if (bdcf.get_is(nh)) ret << " bond"; @@ -150,7 +150,7 @@ std::string get_signature_string(FileConstHandle file) { bcf, cycf, segcf, rcf, acf, chaincf, fragcf, copycf, diffusercf, typedcf, refcf, scalecf); - RMF_FOREACH(FrameID frame, file.get_frames()) { + for(FrameID frame : file.get_frames()) { file.set_current_frame(frame); ret += std::string("\n") + get_frame_signature(file, bdf, ccf, pcf, ipcf, rpcf, scf, bcf, cycf, segcf, diff --git a/src/utility.cpp b/src/utility.cpp index 5ab066ca..95ad996d 100644 --- a/src/utility.cpp +++ b/src/utility.cpp @@ -2,7 +2,7 @@ * \file RMF/Category.h * \brief Handle read/write of Model data from/to files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ @@ -139,12 +139,12 @@ void get_bounding_box_impl(NodeConstHandle root, CoordinateTransformer tr, bb); } if (sf.get_is(root)) { - RMF_FOREACH(const Vector3 & v, sf.get(root).get_coordinates_list()) { + for(const Vector3 &v : sf.get(root).get_coordinates_list()) { handle_vector(tr, v, cf.get_is(root) ? cf.get(root).get_radius() : 0.0f, bb); } } - RMF_FOREACH(NodeConstHandle ch, root.get_children()) { + for(NodeConstHandle ch : root.get_children()) { get_bounding_box_impl(ch, tr, ipf, bf, sf, cf, gpf, rff, bb); } } diff --git a/src/validate.cpp b/src/validate.cpp index 8cf8a0d0..8c16dc18 100644 --- a/src/validate.cpp +++ b/src/validate.cpp @@ -2,7 +2,7 @@ * \file RMF/validate.h * \brief Support for validating the data in a file. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ @@ -32,7 +32,7 @@ bool validate_impl(NodeConstHandle cur, decorator::ParticleFactory pcf, ret = false; } } - RMF_FOREACH(NodeConstHandle c, ch) { + for(NodeConstHandle c : ch) { ret = ret && validate_impl(c, pcf, rcf, acf); } return ret; diff --git a/test/test_associations.cpp b/test/test_associations.cpp index d8930da0..f6628648 100644 --- a/test/test_associations.cpp +++ b/test/test_associations.cpp @@ -2,7 +2,7 @@ * \file test_associations.cpp * \brief A nullptr-initialized pointer to an \imp Object. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ #include diff --git a/test/test_avro2_validate.cpp b/test/test_avro2_validate.cpp index 0718d4c2..22147648 100644 --- a/test/test_avro2_validate.cpp +++ b/test/test_avro2_validate.cpp @@ -1,6 +1,6 @@ /** * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/test/test_buffer.cpp b/test/test_buffer.cpp index 53e13e7f..ab639865 100644 --- a/test/test_buffer.cpp +++ b/test/test_buffer.cpp @@ -2,7 +2,7 @@ * \file test_associations.cpp * \brief A nullptr-initialized pointer to an \imp Object. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ #include diff --git a/test/test_fill.cpp b/test/test_fill.cpp index 9754a5a5..c6a301a1 100644 --- a/test/test_fill.cpp +++ b/test/test_fill.cpp @@ -2,7 +2,7 @@ * \file test_fill.cpp * \brief A nullptr-initialized pointer to an \imp Object. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/test/test_ranges.cpp b/test/test_ranges.cpp index 299fcbfc..b7b7257d 100644 --- a/test/test_ranges.cpp +++ b/test/test_ranges.cpp @@ -15,7 +15,7 @@ int main(int, char * []) { fh.add_frame("hi", RMF::FRAME); assert(boost::distance(fh.get_frames()) == 1); int count = 0; - RMF_FOREACH(RMF::NodeID n, fh.get_node_ids()) { + for(RMF::NodeID n : fh.get_node_ids()) { RMF_UNUSED(n); ++count; } diff --git a/tools/build/_decorators.py b/tools/build/_decorators.py index 28dd6b11..bc9293ad 100755 --- a/tools/build/_decorators.py +++ b/tools/build/_decorators.py @@ -541,7 +541,7 @@ def make_header(name, infos, deps): * \\file RMF/decorator/%(name)s.h * \\brief Helper functions for manipulating RMF files. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ diff --git a/tools/dev_tools/.github/workflows/build.yml b/tools/dev_tools/.github/workflows/build.yml index a4896204..8a286104 100644 --- a/tools/dev_tools/.github/workflows/build.yml +++ b/tools/dev_tools/.github/workflows/build.yml @@ -9,7 +9,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest] - python-version: [2.7, 3.7, 3.8, 3.9] + python-version: [2.7, 3.7, 3.8, 3.9, "3.10"] runs-on: ${{ matrix.os }} steps: diff --git a/tools/dev_tools/make_all_header.py b/tools/dev_tools/make_all_header.py index b194691d..288c9e1a 100755 --- a/tools/dev_tools/make_all_header.py +++ b/tools/dev_tools/make_all_header.py @@ -31,7 +31,7 @@ def _add_includes(headers, output): * \\file %s * \\brief Include all non-deprecated headers in %s. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. */ """ % (includepath, includepath[:-2].replace('/', '.'))] guard = includepath.replace( diff --git a/tools/dev_tools/setup_cmake.py b/tools/dev_tools/setup_cmake.py index 3dd65368..7b0b2507 100755 --- a/tools/dev_tools/setup_cmake.py +++ b/tools/dev_tools/setup_cmake.py @@ -39,7 +39,7 @@ def make_files(d): def search_start(d): for cd in [o for o in os.listdir(d) if os.path.isdir(os.path.join(d, o))]: - if cd.startswith("."): + if cd.startswith(".") or cd == 'components': continue cp = os.path.join(d, cd) if cd in ["bin", "src", "test", "examples", "benchmark", "utility"]: diff --git a/tools/dev_tools/test/test_header.py b/tools/dev_tools/test/test_header.py index 56a71069..a00c32bd 100644 --- a/tools/dev_tools/test/test_header.py +++ b/tools/dev_tools/test/test_header.py @@ -32,7 +32,7 @@ def test_header(self): * \\file test.h * \\brief Include all non-deprecated headers in test. * - * Copyright 2007-2021 IMP Inventors. All rights reserved. + * Copyright 2007-2022 IMP Inventors. All rights reserved. */ #ifndef TEST_H