MCPcopy Create free account
hub / github.com/comaps/comaps / Dump

Method Dump

generator/wiki_url_dumper.cpp:26–56  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

24{}
25
26void WikiUrlDumper::Dump(size_t cpuCount) const
27{
28 CHECK_GREATER(cpuCount, 0, ());
29
30 base::ComputationalThreadPool threadPool(cpuCount);
31 std::vector<std::future<std::string>> futures;
32 futures.reserve(m_dataFiles.size());
33
34 auto const fn = [](std::string const & filename)
35 {
36 std::stringstream stringStream;
37 DumpOne(filename, stringStream);
38 return stringStream.str();
39 };
40
41 for (auto const & path : m_dataFiles)
42 {
43 auto result = threadPool.Submit(fn, path);
44 futures.emplace_back(std::move(result));
45 }
46
47 std::ofstream stream;
48 stream.exceptions(std::fstream::failbit | std::fstream::badbit);
49 stream.open(m_path);
50 stream << "MwmPath\tosmId\twikipediaUrl\n";
51 for (auto & f : futures)
52 {
53 auto lines = f.get();
54 stream << lines;
55 }
56}
57
58// static
59void WikiUrlDumper::DumpOne(std::string const & path, std::ostream & stream)

Callers

nothing calls this directly

Calls 6

SubmitMethod · 0.80
openMethod · 0.80
getMethod · 0.65
reserveMethod · 0.45
sizeMethod · 0.45
emplace_backMethod · 0.45

Tested by

no test coverage detected