refactor function names; consolidate readCount() functions;

remove templated types as much as possible for type safety;
add more comments;
clean up code, add const if possible;
This commit is contained in:
Huyen Chau Nguyen
2016-10-21 15:24:55 -07:00
parent fe94977c9b
commit cf35bbeb50
8 changed files with 169 additions and 198 deletions
+2 -2
View File
@@ -331,7 +331,7 @@ void EdgeBasedGraphFactory::GenerateEdgeExpandedEdges(
}
// Writes a dummy value at the front that is updated later with the total length
const unsigned length_prefix_empty_space{0};
const std::uint64_t length_prefix_empty_space{0};
edge_data_file.write(reinterpret_cast<const char *>(&length_prefix_empty_space),
sizeof(length_prefix_empty_space));
@@ -598,7 +598,7 @@ void EdgeBasedGraphFactory::GenerateEdgeExpandedEdges(
// Finally jump back to the empty space at the beginning and write length prefix
edge_data_file.seekp(std::ios::beg);
const auto length_prefix = boost::numeric_cast<unsigned>(original_edges_counter);
const auto length_prefix = boost::numeric_cast<std::uint64_t>(original_edges_counter);
static_assert(sizeof(length_prefix_empty_space) == sizeof(length_prefix), "type mismatch");
edge_data_file.write(reinterpret_cast<const char *>(&length_prefix), sizeof(length_prefix));
+3 -4
View File
@@ -112,8 +112,7 @@ int Extractor::run(ScriptingEnvironment &scripting_environment)
TIMER_START(extracting);
const unsigned recommended_num_threads = tbb::task_scheduler_init::default_num_threads();
const auto number_of_threads =
std::min(recommended_num_threads, config.requested_num_threads);
const auto number_of_threads = std::min(recommended_num_threads, config.requested_num_threads);
tbb::task_scheduler_init init(number_of_threads);
{
@@ -527,8 +526,8 @@ Extractor::BuildEdgeExpandedGraph(ScriptingEnvironment &scripting_environment,
void Extractor::WriteNodeMapping(const std::vector<QueryNode> &internal_to_external_node_map)
{
boost::filesystem::ofstream node_stream(config.node_output_path, std::ios::binary);
const unsigned size_of_mapping = internal_to_external_node_map.size();
node_stream.write((char *)&size_of_mapping, sizeof(unsigned));
const std::uint64_t size_of_mapping = internal_to_external_node_map.size();
node_stream.write((char *)&size_of_mapping, sizeof(std::uint64_t));
if (size_of_mapping > 0)
{
node_stream.write((char *)internal_to_external_node_map.data(),