Skip to content

Commit

Permalink
Squashed 'modules/rmf/dependency/RMF/' changes from b2caa73f34..7ca61…
Browse files Browse the repository at this point in the history
…270d2

7ca61270d2 Replace typedef with 'using'
20f87aa7e5 Use equals keyword for empty special methods
9251ccaf34 Use range-based for loops
0b6c0470d7 Replace NULL with nullptr
cad4f2b59b Remove deprecated C++ headers
1b2ab66f4b Simplify by using emplace_back

git-subtree-dir: modules/rmf/dependency/RMF
git-subtree-split: 7ca61270d20076ccd838b4e6444020edc69a6b03
  • Loading branch information
benmwebb committed Oct 16, 2023
1 parent 2970ec3 commit 0311700
Show file tree
Hide file tree
Showing 21 changed files with 51 additions and 50 deletions.
2 changes: 1 addition & 1 deletion modules/rmf/dependency/RMF/bin/rmf3_dump.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/

#include <memory>
#include <stddef.h>
#include <cstddef>
#include <exception>
#include <iostream>
#include <string>
Expand Down
2 changes: 1 addition & 1 deletion modules/rmf/dependency/RMF/bin/rmf_cat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ int main(int argc, char** argv) {
"input-files,i",
boost::program_options::value<std::vector<std::string> >(&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) {
Expand Down
2 changes: 1 addition & 1 deletion modules/rmf/dependency/RMF/bin/rmf_interpolate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<boost::uint64_t>(std::time(NULL)));
rng.seed(static_cast<boost::uint64_t>(std::time(nullptr)));
boost::normal_distribution<> nd(0.0, noise);
boost::variate_generator<boost::mt19937&, boost::normal_distribution<> >
normal_random(rng, nd);
Expand Down
4 changes: 2 additions & 2 deletions modules/rmf/dependency/RMF/bin/rmf_pdb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions modules/rmf/dependency/RMF/bin/rmf_transform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions modules/rmf/dependency/RMF/bin/rmf_xml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 << "<child>\n";
show_hierarchy(children[i], cs, seen, out);
show_hierarchy(child, cs, seen, out);
out << "</child>\n";
}
seen.insert(nh);
Expand Down
4 changes: 2 additions & 2 deletions modules/rmf/dependency/RMF/src/backend/BackwardsIO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ std::array<std::string, 4> make_array(std::string a, std::string b,
return ret;
}
}
typedef std::pair<std::string, std::array<std::string, 3> > P3;
using P3 = std::pair<std::string, std::array<std::string, 3> >;
const P3 vector_3_names[] = {
P3("coordinates", make_array("cartesian x", "cartesian y", "cartesian z")),
P3("translation",
Expand All @@ -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<std::string, std::array<std::string, 4> > P4;
using P4 = std::pair<std::string, std::array<std::string, 4> >;

const P4 vector_4_names[] = {
P4("orientation", make_array("orientation r", "orientation i",
Expand Down
2 changes: 1 addition & 1 deletion modules/rmf/dependency/RMF/src/backend/avro/traits.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<rmf_raw_avro2::Node> nodes;
std::vector<rmf_raw_avro2::KeyInfo> keys;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ namespace RMF {
namespace avro_backend {
namespace {

typedef backends::BackwardsIO<avro_backend::AvroSharedData<
avro_backend::SingleAvroFile> > SingleAvroShareData;
typedef backends::BackwardsIO<avro_backend::AvroSharedData<
avro_backend::MultipleAvroFileWriter> > AvroWriterShareData;
typedef backends::BackwardsIO<avro_backend::AvroSharedData<
avro_backend::MultipleAvroFileReader> > AvroReaderShareData;
using SingleAvroShareData = backends::BackwardsIO<avro_backend::AvroSharedData<
avro_backend::SingleAvroFile> >;
using AvroWriterShareData = backends::BackwardsIO<avro_backend::AvroSharedData<
avro_backend::MultipleAvroFileWriter> >;
using AvroReaderShareData = backends::BackwardsIO<avro_backend::AvroSharedData<
avro_backend::MultipleAvroFileReader> >;

struct SingleTextAvroFactory : public RMF::backends::IOFactory {
virtual std::string get_file_extension() const override {
Expand All @@ -55,7 +55,7 @@ struct SingleTextAvroFactory : public RMF::backends::IOFactory {
const std::string& name) const override {
return std::make_shared<SingleAvroShareData>(name, true, false);
}
virtual ~SingleTextAvroFactory() {}
virtual ~SingleTextAvroFactory() = default;
};

struct SingleAvroFactory : public SingleTextAvroFactory {
Expand All @@ -76,7 +76,7 @@ struct SingleAvroFactory : public SingleTextAvroFactory {
return std::shared_ptr<RMF::backends::IO>();
}
}
virtual ~SingleAvroFactory() {}
virtual ~SingleAvroFactory() = default;
};

struct MultipleAvroFactory : public RMF::backends::IOFactory {
Expand All @@ -91,7 +91,7 @@ struct MultipleAvroFactory : public RMF::backends::IOFactory {
const std::string& name) const override {
return std::make_shared<AvroWriterShareData>(name, true, false);
}
virtual ~MultipleAvroFactory() {}
virtual ~MultipleAvroFactory() = default;
};
} // namespace
std::vector<std::shared_ptr<backends::IOFactory> > get_factories() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <array>
#include <boost/ptr_container/ptr_vector.hpp>
#include <hdf5.h>
#include <stddef.h>
#include <cstddef>
#include <algorithm>
#include <functional>
#include <string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ namespace RMF {
namespace hdf5_backend {
namespace {

typedef backends::BackwardsIO<HDF5SharedData> MIO;
using MIO = backends::BackwardsIO<HDF5SharedData>;

struct HDF5Factory : public RMF::backends::IOFactory {
virtual std::string get_file_extension() const override {
Expand All @@ -43,7 +43,7 @@ struct HDF5Factory : public RMF::backends::IOFactory {
const std::string& name) const override {
return std::make_shared<MIO>(name, true, false);
}
virtual ~HDF5Factory() {}
virtual ~HDF5Factory() = default;
};

} // namespace
Expand Down
13 changes: 7 additions & 6 deletions modules/rmf/dependency/RMF/src/exceptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
RMF_ENABLE_WARNINGS

namespace RMF {
Exception::Exception() {}
Exception::Exception() = default;

const char* Exception::what() const noexcept {
try {
Expand All @@ -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 {
Expand Down Expand Up @@ -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 */

Expand Down
4 changes: 2 additions & 2 deletions modules/rmf/dependency/RMF/src/hdf5_wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion modules/rmf/dependency/RMF/test/test_associations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Copyright 2007-2022 IMP Inventors. All rights reserved.
*
*/
#include <assert.h>
#include <cassert>
#include <memory>
#include <stdio.h>
#include <exception>
Expand Down
2 changes: 1 addition & 1 deletion modules/rmf/dependency/RMF/test/test_avro2_low_level.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <assert.h>
#include <cassert>
#include <avrocpp/api/Compiler.hh>
#include <avrocpp/api/DataFile.hh>
#include <backend/avro/raw_frame.h>
Expand Down
8 changes: 4 additions & 4 deletions modules/rmf/dependency/RMF/test/test_avro2_validate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion modules/rmf/dependency/RMF/test/test_buffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Copyright 2007-2022 IMP Inventors. All rights reserved.
*
*/
#include <assert.h>
#include <cassert>

#include "RMF/BufferHandle.h"
#include "RMF/FileConstHandle.h"
Expand Down
7 changes: 4 additions & 3 deletions modules/rmf/dependency/RMF/test/test_fill.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include <H5Spublic.h>
#include <H5Tpublic.h>
#include <H5public.h>
#include <stddef.h>
#include <cstddef>
#include <iostream>

#define HDF5_CALL(x) \
Expand Down Expand Up @@ -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));
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <assert.h>
#include <cassert>
#include <avrocpp/api/Compiler.hh>
#include <avrocpp/api/Decoder.hh>
#include <avrocpp/api/Encoder.hh>
Expand Down
2 changes: 1 addition & 1 deletion modules/rmf/dependency/RMF/test/test_ranges.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <assert.h>
#include <cassert>
#include <boost/iterator/iterator_facade.hpp>
#include <boost/range/distance.hpp>
#include <string>
Expand Down

0 comments on commit 0311700

Please sign in to comment.