diff --git a/modules/rmf/dependency/RMF/bin/rmf3_dump.cpp b/modules/rmf/dependency/RMF/bin/rmf3_dump.cpp index d620169764..8f0f7dddb0 100644 --- a/modules/rmf/dependency/RMF/bin/rmf3_dump.cpp +++ b/modules/rmf/dependency/RMF/bin/rmf3_dump.cpp @@ -3,7 +3,7 @@ */ #include -#include +#include #include #include #include diff --git a/modules/rmf/dependency/RMF/bin/rmf_cat.cpp b/modules/rmf/dependency/RMF/bin/rmf_cat.cpp index c0d11e1555..9ec94438b9 100644 --- a/modules/rmf/dependency/RMF/bin/rmf_cat.cpp +++ b/modules/rmf/dependency/RMF/bin/rmf_cat.cpp @@ -25,7 +25,7 @@ int main(int argc, char** argv) { "input-files,i", boost::program_options::value >(&inputs), "input rmf file"); - positional_names.push_back("input_1.rmf input_2.rmf ... output.rmf"); + positional_names.emplace_back("input_1.rmf input_2.rmf ... output.rmf"); positional_options_description.add("input-files", -1); process_options(argc, argv); if (inputs.size() < 3) { diff --git a/modules/rmf/dependency/RMF/bin/rmf_interpolate.cpp b/modules/rmf/dependency/RMF/bin/rmf_interpolate.cpp index 983c5e0add..a3f1412145 100644 --- a/modules/rmf/dependency/RMF/bin/rmf_interpolate.cpp +++ b/modules/rmf/dependency/RMF/bin/rmf_interpolate.cpp @@ -118,7 +118,7 @@ void interpolate_frames(int num, double noise, double angle_noise, // boost::random_device seed_gen; boost::mt19937 rng; // rng.seed(seed_gen()); - rng.seed(static_cast(std::time(NULL))); + rng.seed(static_cast(std::time(nullptr))); boost::normal_distribution<> nd(0.0, noise); boost::variate_generator > normal_random(rng, nd); diff --git a/modules/rmf/dependency/RMF/bin/rmf_pdb.cpp b/modules/rmf/dependency/RMF/bin/rmf_pdb.cpp index aba7505254..9e3b516fe2 100644 --- a/modules/rmf/dependency/RMF/bin/rmf_pdb.cpp +++ b/modules/rmf/dependency/RMF/bin/rmf_pdb.cpp @@ -148,8 +148,8 @@ RMF_ENABLE_WARNINGS namespace { out << str; } RMF::NodeConstHandles ch = nh.get_children(); - for (unsigned int i = 0; i < ch.size(); ++i) { - current_index = write_atoms(out, current_index, ch[i], ipf, af, cf, rf, + for (const auto &c : ch) { + current_index = write_atoms(out, current_index, c, ipf, af, cf, rf, chain, residue_index, residue_type); } return current_index; diff --git a/modules/rmf/dependency/RMF/bin/rmf_transform.cpp b/modules/rmf/dependency/RMF/bin/rmf_transform.cpp index 25cee949b7..0f5260ce09 100644 --- a/modules/rmf/dependency/RMF/bin/rmf_transform.cpp +++ b/modules/rmf/dependency/RMF/bin/rmf_transform.cpp @@ -67,8 +67,8 @@ void transform(RMF::NodeHandle nh, RMF_TRANSFORM_LIST(cf, Cylinder, coordinates_list); RMF_TRANSFORM_LIST(sf, Segment, coordinates_list); RMF::NodeHandles children = nh.get_children(); - for (unsigned int i = 0; i < children.size(); ++i) { - transform(children[i], ipf, rpf, rff, bf, cf, sf, scale, translation); + for (const auto &child: children) { + transform(child, ipf, rpf, rff, bf, cf, sf, scale, translation); } } } diff --git a/modules/rmf/dependency/RMF/bin/rmf_xml.cpp b/modules/rmf/dependency/RMF/bin/rmf_xml.cpp index 40c3a338c6..018ba32c1b 100644 --- a/modules/rmf/dependency/RMF/bin/rmf_xml.cpp +++ b/modules/rmf/dependency/RMF/bin/rmf_xml.cpp @@ -74,14 +74,14 @@ void show_hierarchy(RMF::NodeConstHandle nh, const RMF::Categories& cs, << "type=\"" << nh.get_type() << "\">\n"; if (seen.find(nh) == seen.end()) { if (variables_map.count("verbose")) { - for (unsigned int i = 0; i < cs.size(); ++i) { - show_data_xml(nh, cs[i], out); + for (const auto &c : cs) { + show_data_xml(nh, c, out); } } RMF::NodeConstHandles children = nh.get_children(); - for (unsigned int i = 0; i < children.size(); ++i) { + for (const auto &child : children) { out << "\n"; - show_hierarchy(children[i], cs, seen, out); + show_hierarchy(child, cs, seen, out); out << "\n"; } seen.insert(nh); diff --git a/modules/rmf/dependency/RMF/src/backend/BackwardsIO.cpp b/modules/rmf/dependency/RMF/src/backend/BackwardsIO.cpp index b1a8e2efee..6cf51b1ed9 100644 --- a/modules/rmf/dependency/RMF/src/backend/BackwardsIO.cpp +++ b/modules/rmf/dependency/RMF/src/backend/BackwardsIO.cpp @@ -26,7 +26,7 @@ std::array make_array(std::string a, std::string b, return ret; } } -typedef std::pair > P3; +using P3 = std::pair >; const P3 vector_3_names[] = { P3("coordinates", make_array("cartesian x", "cartesian y", "cartesian z")), P3("translation", @@ -44,7 +44,7 @@ const int vector_3_names_size = V3N vector_3_names_map(vector_3_names, vector_3_names + vector_3_names_size); -typedef std::pair > P4; +using P4 = std::pair >; const P4 vector_4_names[] = { P4("orientation", make_array("orientation r", "orientation i", diff --git a/modules/rmf/dependency/RMF/src/backend/avro/traits.cpp b/modules/rmf/dependency/RMF/src/backend/avro/traits.cpp index 86d6755b29..6dd0de6ffd 100644 --- a/modules/rmf/dependency/RMF/src/backend/avro/traits.cpp +++ b/modules/rmf/dependency/RMF/src/backend/avro/traits.cpp @@ -398,7 +398,7 @@ struct BackwardsTypeDatas { }; struct BackwardsFrame { - typedef rmf_raw_avro2::_Frame_json_Union__0__ info_t; + using info_t = rmf_raw_avro2::_Frame_json_Union__0__; info_t info; std::vector nodes; std::vector keys; diff --git a/modules/rmf/dependency/RMF/src/backend/deprecated_avro/create.cpp b/modules/rmf/dependency/RMF/src/backend/deprecated_avro/create.cpp index c6fea31d2d..26626157d8 100644 --- a/modules/rmf/dependency/RMF/src/backend/deprecated_avro/create.cpp +++ b/modules/rmf/dependency/RMF/src/backend/deprecated_avro/create.cpp @@ -36,12 +36,12 @@ namespace RMF { namespace avro_backend { namespace { -typedef backends::BackwardsIO > SingleAvroShareData; -typedef backends::BackwardsIO > AvroWriterShareData; -typedef backends::BackwardsIO > AvroReaderShareData; +using SingleAvroShareData = backends::BackwardsIO >; +using AvroWriterShareData = backends::BackwardsIO >; +using AvroReaderShareData = backends::BackwardsIO >; struct SingleTextAvroFactory : public RMF::backends::IOFactory { virtual std::string get_file_extension() const override { @@ -55,7 +55,7 @@ struct SingleTextAvroFactory : public RMF::backends::IOFactory { const std::string& name) const override { return std::make_shared(name, true, false); } - virtual ~SingleTextAvroFactory() {} + virtual ~SingleTextAvroFactory() = default; }; struct SingleAvroFactory : public SingleTextAvroFactory { @@ -76,7 +76,7 @@ struct SingleAvroFactory : public SingleTextAvroFactory { return std::shared_ptr(); } } - virtual ~SingleAvroFactory() {} + virtual ~SingleAvroFactory() = default; }; struct MultipleAvroFactory : public RMF::backends::IOFactory { @@ -91,7 +91,7 @@ struct MultipleAvroFactory : public RMF::backends::IOFactory { const std::string& name) const override { return std::make_shared(name, true, false); } - virtual ~MultipleAvroFactory() {} + virtual ~MultipleAvroFactory() = default; }; } // namespace std::vector > get_factories() { diff --git a/modules/rmf/dependency/RMF/src/backend/deprecated_hdf5/HDF5SharedData.cpp b/modules/rmf/dependency/RMF/src/backend/deprecated_hdf5/HDF5SharedData.cpp index 341f8adc63..aa16435883 100644 --- a/modules/rmf/dependency/RMF/src/backend/deprecated_hdf5/HDF5SharedData.cpp +++ b/modules/rmf/dependency/RMF/src/backend/deprecated_hdf5/HDF5SharedData.cpp @@ -278,10 +278,9 @@ unsigned int HDF5SharedData::add_category_impl(std::string name) { Categories HDF5SharedData::get_categories() const { Categories ret; - for (CategoryDataMap::const_iterator it = category_data_map_.begin(); - it != category_data_map_.end(); ++it) { - if (it->second.name == "link") continue; - ret.push_back(it->first); + for (const auto &it : category_data_map_) { + if (it.second.name == "link") continue; + ret.push_back(it.first); } return ret; } diff --git a/modules/rmf/dependency/RMF/src/backend/deprecated_hdf5/HDF5SharedData.h b/modules/rmf/dependency/RMF/src/backend/deprecated_hdf5/HDF5SharedData.h index 6bce500666..f384bb6bce 100644 --- a/modules/rmf/dependency/RMF/src/backend/deprecated_hdf5/HDF5SharedData.h +++ b/modules/rmf/dependency/RMF/src/backend/deprecated_hdf5/HDF5SharedData.h @@ -13,7 +13,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/modules/rmf/dependency/RMF/src/backend/deprecated_hdf5/create.cpp b/modules/rmf/dependency/RMF/src/backend/deprecated_hdf5/create.cpp index d236559ca0..fb8fdee07d 100644 --- a/modules/rmf/dependency/RMF/src/backend/deprecated_hdf5/create.cpp +++ b/modules/rmf/dependency/RMF/src/backend/deprecated_hdf5/create.cpp @@ -29,7 +29,7 @@ namespace RMF { namespace hdf5_backend { namespace { -typedef backends::BackwardsIO MIO; +using MIO = backends::BackwardsIO; struct HDF5Factory : public RMF::backends::IOFactory { virtual std::string get_file_extension() const override { @@ -43,7 +43,7 @@ struct HDF5Factory : public RMF::backends::IOFactory { const std::string& name) const override { return std::make_shared(name, true, false); } - virtual ~HDF5Factory() {} + virtual ~HDF5Factory() = default; }; } // namespace diff --git a/modules/rmf/dependency/RMF/src/exceptions.cpp b/modules/rmf/dependency/RMF/src/exceptions.cpp index 65ebe3c77f..5fc0a2230c 100644 --- a/modules/rmf/dependency/RMF/src/exceptions.cpp +++ b/modules/rmf/dependency/RMF/src/exceptions.cpp @@ -17,7 +17,7 @@ RMF_ENABLE_WARNINGS namespace RMF { -Exception::Exception() {} +Exception::Exception() = default; const char* Exception::what() const noexcept { try { @@ -30,7 +30,8 @@ const char* Exception::what() const noexcept { return message_.c_str(); } -Exception::~Exception() noexcept {} +Exception::~Exception() noexcept = default; + std::string get_message(const Exception& e) { using namespace RMF::internal::ErrorInfo; try { @@ -95,16 +96,16 @@ std::string get_message(const Exception& e) { } } UsageException::UsageException() : Exception() {} -UsageException::~UsageException() noexcept {} +UsageException::~UsageException() noexcept = default; IOException::IOException() : Exception() {} -IOException::~IOException() noexcept {} +IOException::~IOException() noexcept = default; IndexException::IndexException() : Exception() {} -IndexException::~IndexException() noexcept {} +IndexException::~IndexException() noexcept = default; InternalException::InternalException() : Exception() {} -InternalException::~InternalException() noexcept {} +InternalException::~InternalException() noexcept = default; } /* namespace RMF */ diff --git a/modules/rmf/dependency/RMF/src/hdf5_wrapper.cpp b/modules/rmf/dependency/RMF/src/hdf5_wrapper.cpp index 06bdfdfb60..da39c71f69 100644 --- a/modules/rmf/dependency/RMF/src/hdf5_wrapper.cpp +++ b/modules/rmf/dependency/RMF/src/hdf5_wrapper.cpp @@ -223,8 +223,8 @@ std::string File::get_name() const { return std::string(buf.get()); } -File::~File() {} -ConstFile::~ConstFile() {} +File::~File() = default; +ConstFile::~ConstFile() = default; int get_number_of_open_handles(ConstFile f) { H5garbage_collect(); diff --git a/modules/rmf/dependency/RMF/test/test_associations.cpp b/modules/rmf/dependency/RMF/test/test_associations.cpp index b16ac289de..4aa7c8d955 100644 --- a/modules/rmf/dependency/RMF/test/test_associations.cpp +++ b/modules/rmf/dependency/RMF/test/test_associations.cpp @@ -5,7 +5,7 @@ * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ -#include +#include #include #include #include diff --git a/modules/rmf/dependency/RMF/test/test_avro2_low_level.cpp b/modules/rmf/dependency/RMF/test/test_avro2_low_level.cpp index c0e2c5cf7d..d1d70eda72 100644 --- a/modules/rmf/dependency/RMF/test/test_avro2_low_level.cpp +++ b/modules/rmf/dependency/RMF/test/test_avro2_low_level.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include #include diff --git a/modules/rmf/dependency/RMF/test/test_avro2_validate.cpp b/modules/rmf/dependency/RMF/test/test_avro2_validate.cpp index 029af4eaaa..cc6f896be3 100644 --- a/modules/rmf/dependency/RMF/test/test_avro2_validate.cpp +++ b/modules/rmf/dependency/RMF/test/test_avro2_validate.cpp @@ -107,10 +107,10 @@ void validate() { fr.id = FrameID(1); validate_one(fr, Frame()); FileDataChanges changes; - changes.categories.push_back(std::make_pair(Category(0), "hi")); - changes.node_types.push_back(std::make_pair(ROOT, "root")); - changes.frame_types.push_back(std::make_pair(STATIC, "static")); - changes.node_sets.push_back(std::make_pair(1, NodeIDs(2, NodeID(10)))); + changes.categories.emplace_back(Category(0), "hi"); + changes.node_types.emplace_back(ROOT, "root"); + changes.frame_types.emplace_back(STATIC, "static"); + changes.node_sets.emplace_back(1, NodeIDs(2, NodeID(10))); FileData data; validate_one(changes, data); validate_raw(fr); diff --git a/modules/rmf/dependency/RMF/test/test_buffer.cpp b/modules/rmf/dependency/RMF/test/test_buffer.cpp index ab639865d5..5d056a9b8c 100644 --- a/modules/rmf/dependency/RMF/test/test_buffer.cpp +++ b/modules/rmf/dependency/RMF/test/test_buffer.cpp @@ -5,7 +5,7 @@ * Copyright 2007-2022 IMP Inventors. All rights reserved. * */ -#include +#include #include "RMF/BufferHandle.h" #include "RMF/FileConstHandle.h" diff --git a/modules/rmf/dependency/RMF/test/test_fill.cpp b/modules/rmf/dependency/RMF/test/test_fill.cpp index c6a301a1dc..985491c6e9 100644 --- a/modules/rmf/dependency/RMF/test/test_fill.cpp +++ b/modules/rmf/dependency/RMF/test/test_fill.cpp @@ -15,7 +15,7 @@ #include #include #include -#include +#include #include #define HDF5_CALL(x) \ @@ -48,12 +48,13 @@ void set_value(hid_t ds, int i, int j, double v) { ij[0] = i; ij[1] = j; hsize_t one = 1; - HDF5_HANDLE(ids, H5Screate_simple(1, &one, NULL), &H5Sclose); + HDF5_HANDLE(ids, H5Screate_simple(1, &one, nullptr), &H5Sclose); hsize_t ones[2]; ones[0] = 1; ones[1] = 1; HDF5_HANDLE(space, H5Dget_space(ds), &H5Sclose); - HDF5_CALL(H5Sselect_hyperslab(space, H5S_SELECT_SET, ij, ones, ones, NULL)); + HDF5_CALL(H5Sselect_hyperslab(space, H5S_SELECT_SET, ij, ones, ones, + nullptr)); HDF5_CALL(H5Dwrite(ds, H5T_NATIVE_DOUBLE, ids, space, H5P_DEFAULT, &v)); } } diff --git a/modules/rmf/dependency/RMF/test/test_json_encode_decode.cpp b/modules/rmf/dependency/RMF/test/test_json_encode_decode.cpp index cdae78042f..688ccca30b 100644 --- a/modules/rmf/dependency/RMF/test/test_json_encode_decode.cpp +++ b/modules/rmf/dependency/RMF/test/test_json_encode_decode.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include #include diff --git a/modules/rmf/dependency/RMF/test/test_ranges.cpp b/modules/rmf/dependency/RMF/test/test_ranges.cpp index b7b7257d97..8500ded249 100644 --- a/modules/rmf/dependency/RMF/test/test_ranges.cpp +++ b/modules/rmf/dependency/RMF/test/test_ranges.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include #include