2 #include "boost/algorithm/string.hpp" 5 #include "cetlib/container_algorithms.h" 6 #include "range/v3/view.hpp" 15 assert(not history.
empty());
16 return std::accumulate(
19 history.
begin()->processName(),
22 result += config.processName();
44 collapsed_histories(std::vector<std::string>
const& all_process_names)
46 assert(not
empty(all_process_names));
48 std::vector<std::string> result;
49 auto candidate =
cbegin(all_process_names);
50 auto const end =
cend(all_process_names);
51 for (
auto test = candidate + 1; test !=
end; ++test, ++candidate) {
52 if (test->find(*candidate) != 0) {
53 result.push_back(*candidate);
56 result.push_back(*candidate);
61 transform_to_final_result(std::vector<std::string>
const& collapsed)
63 std::vector<std::vector<std::string>> result;
64 for (
auto const& process_names_str : collapsed) {
65 std::vector<std::string> process_names;
66 boost::split(process_names, process_names_str, boost::is_any_of(
"\n"));
67 result.push_back(std::move(process_names));
73 std::vector<std::vector<std::string>>
76 std::vector<std::string> all_process_names;
77 all_process_names.reserve(histories.size());
79 all_process_names.push_back(stringified_process_names(history));
81 cet::sort_all(all_process_names);
85 auto const e =
end(all_process_names);
86 auto const new_end = std::unique(
begin(all_process_names),
e);
87 all_process_names.erase(new_end,
e);
89 auto const collapsed = collapsed_histories(all_process_names);
90 return transform_to_final_result(collapsed);
const_iterator end() const
decltype(auto) constexpr cend(T &&obj)
ADL-aware version of std::cend.
const_iterator begin() const
std::vector< std::vector< std::string > > orderedProcessNamesCollection(ProcessHistoryMap const &pHistMap)
decltype(auto) constexpr end(T &&obj)
ADL-aware version of std::end.
decltype(auto) values(Coll &&coll)
Range-for loop helper iterating across the values of the specified collection.
decltype(auto) constexpr cbegin(T &&obj)
ADL-aware version of std::cbegin.
std::map< ProcessHistoryID const, ProcessHistory > ProcessHistoryMap
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
decltype(auto) constexpr empty(T &&obj)
ADL-aware version of std::empty.