Destructor should fail hard if an exception is raised.

This commit is contained in:
Daniel Patterson
2016-11-14 14:34:50 -08:00
parent be496eb4e3
commit 2f9b5788d0
5 changed files with 127 additions and 154 deletions
+6 -6
View File
@@ -57,12 +57,12 @@ template <typename simple_type>
bool deserializeVector(const std::string &filename, std::vector<simple_type> &data)
{
storage::io::File file(filename, true);
storage::io::FileReader file(filename, true);
const auto count = file.readElementCount64();
const auto count = file.ReadElementCount64();
data.resize(count);
if (count)
file.readInto(data.data(), count);
file.ReadInto(data.data(), count);
return true;
}
@@ -186,9 +186,9 @@ inline bool serializeFlags(const boost::filesystem::path &path, const std::vecto
inline bool deserializeFlags(const boost::filesystem::path &path, std::vector<bool> &flags)
{
SimpleLogger().Write() << "Reading flags from " << path;
storage::io::File flag_file(path, true);
storage::io::FileReader flag_file(path, true);
const auto number_of_bits = flag_file.readOne<std::uint32_t>();
const auto number_of_bits = flag_file.ReadOne<std::uint32_t>();
flags.resize(number_of_bits);
// putting bits in ints
std::uint32_t chunks = (number_of_bits + 31) / 32;
@@ -196,7 +196,7 @@ inline bool deserializeFlags(const boost::filesystem::path &path, std::vector<bo
std::uint32_t chunk;
for (std::size_t chunk_id = 0; chunk_id < chunks; ++chunk_id)
{
flag_file.readInto(chunk);
flag_file.ReadInto(chunk);
std::bitset<32> chunk_bits(chunk);
for (std::size_t bit = 0; bit < 32 && bit_position < number_of_bits; ++bit, ++bit_position)
flags[bit_position] = chunk_bits[bit];
+3 -3
View File
@@ -346,12 +346,12 @@ class StaticRTree
const CoordinateListT &coordinate_list)
: m_coordinate_list(coordinate_list)
{
storage::io::File tree_node_file(node_file);
storage::io::FileReader tree_node_file(node_file);
const auto tree_size = tree_node_file.readElementCount64();
const auto tree_size = tree_node_file.ReadElementCount64();
m_search_tree.resize(tree_size);
storage::io::readRamIndex(tree_node_file, &m_search_tree[0], tree_size);
tree_node_file.ReadInto(&m_search_tree[0], tree_size);
MapLeafNodesFile(leaf_file);
}