Skip to content

Commit 99edc6b

Browse files
src/lc_extrap.cpp: moving the report_histogram function to common
1 parent ce52e2b commit 99edc6b

File tree

1 file changed

+4
-18
lines changed

1 file changed

+4
-18
lines changed

src/lc_extrap.cpp

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -53,20 +53,6 @@ using std::vector;
5353

5454
namespace fs = std::filesystem;
5555

56-
template <typename H>
57-
static void
58-
report_histogram(const string &outfile, const H &h) {
59-
std::ofstream of;
60-
if (!outfile.empty())
61-
of.open(outfile);
62-
std::ostream o(outfile.empty() ? std::cerr.rdbuf() : of.rdbuf());
63-
o << "OBSERVED COUNTS (" << std::size(h) << ")" << std::endl;
64-
for (auto i = 0u; i < std::size(h); ++i)
65-
if (h[i] > 0)
66-
o << i << '\t' << static_cast<uint32_t>(h[i]) << std::endl;
67-
o << std::endl;
68-
}
69-
7056
int
7157
lc_extrap_main(const int argc, const char **argv) {
7258
try {
@@ -100,7 +86,7 @@ lc_extrap_main(const int argc, const char **argv) {
10086
uint32_t n_threads{1};
10187
#endif
10288

103-
string description =
89+
const string description =
10490
R"(
10591
Extrapolate the complexity of a library. This is the approach
10692
described in Daley & Smith (2013). The method applies rational
@@ -145,7 +131,8 @@ method has been used for many different purposes since then.
145131
opt_parse.add_opt("hist", 'H',
146132
"input is a text file containing the observed histogram",
147133
false, HIST_INPUT);
148-
opt_parse.add_opt("hist-out", '\0', "output counts histogram to this file",
134+
opt_parse.add_opt("hist-out", '\0',
135+
"output histogram to this file (for non-hist input)",
149136
false, histogram_outfile);
150137
opt_parse.add_opt("quick", 'Q',
151138
"quick mode (no bootstraps) for confidence intervals",
@@ -156,7 +143,6 @@ method has been used for many different purposes since then.
156143
seed);
157144
opt_parse.set_show_defaults();
158145
vector<string> leftover_args;
159-
// ADS: suspect bug below; "-about" isn't working.
160146
opt_parse.parse(argc - 1, argv + 1, leftover_args);
161147
if (argc == 2 || opt_parse.help_requested()) {
162148
cerr << opt_parse.help_message() << endl;
@@ -308,7 +294,7 @@ method has been used for many different purposes since then.
308294
yield_upper_ci_lognorm);
309295
}
310296
}
311-
catch (std::exception &e) {
297+
catch (const std::exception &e) {
312298
cerr << e.what() << endl;
313299
return EXIT_FAILURE;
314300
}

0 commit comments

Comments
 (0)