src/iguana/algorithms/Algorithm.cc
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #include "Algorithm.h" | ||
| 2 | |||
| 3 | namespace iguana { | ||
| 4 | |||
| 5 | 219 | hipo::banklist::size_type tools::GetBankIndex( | |
| 6 | hipo::banklist& banks, | ||
| 7 | std::string const& bank_name, | ||
| 8 | unsigned int const& variant) noexcept(false) | ||
| 9 | { | ||
| 10 | unsigned int num_found = 0; | ||
| 11 |
1/2✓ Branch 19 → 3 taken 740 times.
✗ Branch 19 → 20 not taken.
|
1480 | for(hipo::banklist::size_type i = 0; i < banks.size(); i++) { |
| 12 | 740 | auto& bank = banks.at(i); | |
| 13 |
4/4✓ Branch 7 → 8 taken 505 times.
✓ Branch 7 → 10 taken 235 times.
✓ Branch 12 → 13 taken 226 times.
✓ Branch 12 → 16 taken 514 times.
|
1480 | if(bank.getSchema().getName() == bank_name) { |
| 14 |
2/2✓ Branch 13 → 14 taken 219 times.
✓ Branch 13 → 15 taken 7 times.
|
226 | if(num_found == variant) |
| 15 | 219 | return i; | |
| 16 | 7 | num_found++; | |
| 17 | } | ||
| 18 | } | ||
| 19 | ✗ | throw std::runtime_error("GetBankIndex failed to find bank \"" + bank_name + "\""); | |
| 20 | } | ||
| 21 | |||
| 22 | /////////////////////////////////////////////////////////////////////////////// | ||
| 23 | |||
| 24 | 104 | void Algorithm::Start(hipo::banklist& banks) | |
| 25 | { | ||
| 26 | 104 | ParseYAMLConfig(); | |
| 27 |
2/4✗ Branch 7 → 8 not taken.
✓ Branch 7 → 9 taken 104 times.
✗ Branch 10 → 11 not taken.
✓ Branch 10 → 13 taken 104 times.
|
312 | m_log->Debug(fmt::format("/{}\\", Logger::Header("ConfigHook"))); |
| 28 | 104 | ConfigHook(); | |
| 29 |
2/4✗ Branch 22 → 23 not taken.
✓ Branch 22 → 24 taken 104 times.
✗ Branch 25 → 26 not taken.
✓ Branch 25 → 28 taken 104 times.
|
312 | m_log->Debug(fmt::format("\\{:=^50}/", "")); |
| 30 |
2/4✗ Branch 34 → 35 not taken.
✓ Branch 34 → 36 taken 104 times.
✗ Branch 37 → 38 not taken.
✓ Branch 37 → 40 taken 104 times.
|
312 | m_log->Debug(fmt::format("/{}\\", Logger::Header("StartHook"))); |
| 31 | 104 | StartHook(banks); | |
| 32 |
2/4✗ Branch 49 → 50 not taken.
✓ Branch 49 → 51 taken 104 times.
✗ Branch 52 → 53 not taken.
✓ Branch 52 → 55 taken 104 times.
|
208 | m_log->Debug(fmt::format("\\{:=^50}/", "")); |
| 33 | 104 | } | |
| 34 | |||
| 35 | /////////////////////////////////////////////////////////////////////////////// | ||
| 36 | |||
| 37 | 15 | void Algorithm::Start() | |
| 38 | { | ||
| 39 |
1/2✓ Branch 2 → 3 taken 15 times.
✗ Branch 2 → 5 not taken.
|
15 | m_rows_only = true; |
| 40 | hipo::banklist no_banks = {}; | ||
| 41 |
1/2✓ Branch 2 → 3 taken 15 times.
✗ Branch 2 → 5 not taken.
|
15 | Start(no_banks); |
| 42 | 15 | } | |
| 43 | |||
| 44 | /////////////////////////////////////////////////////////////////////////////// | ||
| 45 | |||
| 46 |
1/2✗ Branch 2 → 3 not taken.
✓ Branch 2 → 4 taken 75851 times.
|
75851 | bool Algorithm::Run(hipo::banklist& banks) const |
| 47 | { | ||
| 48 |
3/6✓ Branch 5 → 6 taken 75851 times.
✗ Branch 5 → 13 not taken.
✓ Branch 6 → 7 taken 26100 times.
✓ Branch 6 → 9 taken 49751 times.
✗ Branch 13 → 14 not taken.
✗ Branch 13 → 16 not taken.
|
75851 | m_log->Trace("=========== {}::RunHook ===========", m_class_name); |
| 49 | 75851 | return RunHook(banks); | |
| 50 | } | ||
| 51 | |||
| 52 | /////////////////////////////////////////////////////////////////////////////// | ||
| 53 | |||
| 54 | 76 | void Algorithm::Stop() | |
| 55 | { | ||
| 56 |
2/4✗ Branch 6 → 7 not taken.
✓ Branch 6 → 8 taken 76 times.
✗ Branch 9 → 10 not taken.
✓ Branch 9 → 12 taken 76 times.
|
228 | m_log->Trace(fmt::format("/{}\\", Logger::Header("StopHook"))); |
| 57 | 76 | StopHook(); | |
| 58 |
2/4✗ Branch 21 → 22 not taken.
✓ Branch 21 → 23 taken 76 times.
✗ Branch 24 → 25 not taken.
✓ Branch 24 → 27 taken 76 times.
|
152 | m_log->Trace(fmt::format("\\{:=^50}/", "")); |
| 59 | 76 | } | |
| 60 | |||
| 61 | /////////////////////////////////////////////////////////////////////////////// | ||
| 62 | |||
| 63 | template <typename OPTION_TYPE> | ||
| 64 | 258 | OPTION_TYPE Algorithm::GetOptionScalar(YAMLReader::node_path_t node_path) const | |
| 65 | { | ||
| 66 | 258 | auto key = YAMLReader::NodePath2String(node_path); | |
| 67 |
3/6std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > iguana::Algorithm::GetOptionScalar<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(std::deque<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<YAML::Node (YAML::Node)> >, std::allocator<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<YAML::Node (YAML::Node)> > > >) const:
✓ Branch 3 → 4 taken 196 times.
✗ Branch 3 → 58 not taken.
double iguana::Algorithm::GetOptionScalar<double>(std::deque<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<YAML::Node (YAML::Node)> >, std::allocator<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<YAML::Node (YAML::Node)> > > >) const:
✓ Branch 3 → 4 taken 30 times.
✗ Branch 3 → 49 not taken.
int iguana::Algorithm::GetOptionScalar<int>(std::deque<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<YAML::Node (YAML::Node)> >, std::allocator<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<YAML::Node (YAML::Node)> > > >) const:
✓ Branch 3 → 4 taken 32 times.
✗ Branch 3 → 49 not taken.
|
258 | auto opt = GetCachedOption<OPTION_TYPE>(key); |
| 68 |
4/6std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > iguana::Algorithm::GetOptionScalar<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(std::deque<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<YAML::Node (YAML::Node)> >, std::allocator<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<YAML::Node (YAML::Node)> > > >) const:
✓ Branch 9 → 10 taken 194 times.
✓ Branch 9 → 16 taken 2 times.
double iguana::Algorithm::GetOptionScalar<double>(std::deque<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<YAML::Node (YAML::Node)> >, std::allocator<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<YAML::Node (YAML::Node)> > > >) const:
✓ Branch 9 → 10 taken 30 times.
✗ Branch 9 → 14 not taken.
int iguana::Algorithm::GetOptionScalar<int>(std::deque<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<YAML::Node (YAML::Node)> >, std::allocator<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<YAML::Node (YAML::Node)> > > >) const:
✓ Branch 9 → 10 taken 32 times.
✗ Branch 9 → 14 not taken.
|
258 | node_path.push_front(m_class_name); |
| 69 |
4/6std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > iguana::Algorithm::GetOptionScalar<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(std::deque<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<YAML::Node (YAML::Node)> >, std::allocator<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<YAML::Node (YAML::Node)> > > >) const:
✓ Branch 9 → 10 taken 194 times.
✓ Branch 9 → 16 taken 2 times.
double iguana::Algorithm::GetOptionScalar<double>(std::deque<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<YAML::Node (YAML::Node)> >, std::allocator<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<YAML::Node (YAML::Node)> > > >) const:
✓ Branch 9 → 10 taken 30 times.
✗ Branch 9 → 14 not taken.
int iguana::Algorithm::GetOptionScalar<int>(std::deque<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<YAML::Node (YAML::Node)> >, std::allocator<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<YAML::Node (YAML::Node)> > > >) const:
✓ Branch 9 → 10 taken 32 times.
✗ Branch 9 → 14 not taken.
|
258 | if(!opt.has_value()) { |
| 70 |
7/12std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > iguana::Algorithm::GetOptionScalar<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(std::deque<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<YAML::Node (YAML::Node)> >, std::allocator<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<YAML::Node (YAML::Node)> > > >) const:
✓ Branch 10 → 11 taken 194 times.
✗ Branch 10 → 56 not taken.
✓ Branch 11 → 12 taken 194 times.
✗ Branch 11 → 46 not taken.
double iguana::Algorithm::GetOptionScalar<double>(std::deque<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<YAML::Node (YAML::Node)> >, std::allocator<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<YAML::Node (YAML::Node)> > > >) const:
✓ Branch 10 → 11 taken 30 times.
✗ Branch 10 → 49 not taken.
✓ Branch 11 → 12 taken 30 times.
✗ Branch 11 → 39 not taken.
int iguana::Algorithm::GetOptionScalar<int>(std::deque<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<YAML::Node (YAML::Node)> >, std::allocator<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<YAML::Node (YAML::Node)> > > >) const:
✓ Branch 10 → 11 taken 32 times.
✗ Branch 10 → 49 not taken.
✓ Branch 11 → 12 taken 31 times.
✓ Branch 11 → 39 taken 1 time.
|
450 | opt = m_yaml_config->GetScalar<OPTION_TYPE>(node_path); |
| 71 | } | ||
| 72 |
5/6std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > iguana::Algorithm::GetOptionScalar<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(std::deque<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<YAML::Node (YAML::Node)> >, std::allocator<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<YAML::Node (YAML::Node)> > > >) const:
✓ Branch 16 → 17 taken 92 times.
✓ Branch 16 → 30 taken 104 times.
double iguana::Algorithm::GetOptionScalar<double>(std::deque<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<YAML::Node (YAML::Node)> >, std::allocator<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<YAML::Node (YAML::Node)> > > >) const:
✗ Branch 14 → 15 not taken.
✓ Branch 14 → 28 taken 30 times.
int iguana::Algorithm::GetOptionScalar<int>(std::deque<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<YAML::Node (YAML::Node)> >, std::allocator<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<YAML::Node (YAML::Node)> > > >) const:
✓ Branch 14 → 15 taken 2 times.
✓ Branch 14 → 28 taken 29 times.
|
257 | if(!opt.has_value()) { |
| 73 |
2/6std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > iguana::Algorithm::GetOptionScalar<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(std::deque<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<YAML::Node (YAML::Node)> >, std::allocator<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<YAML::Node (YAML::Node)> > > >) const:
✓ Branch 23 → 24 taken 92 times.
✗ Branch 23 → 48 not taken.
double iguana::Algorithm::GetOptionScalar<double>(std::deque<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<YAML::Node (YAML::Node)> >, std::allocator<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<YAML::Node (YAML::Node)> > > >) const:
✗ Branch 21 → 22 not taken.
✗ Branch 21 → 41 not taken.
int iguana::Algorithm::GetOptionScalar<int>(std::deque<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<YAML::Node (YAML::Node)> >, std::allocator<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<YAML::Node (YAML::Node)> > > >) const:
✓ Branch 21 → 22 taken 2 times.
✗ Branch 21 → 41 not taken.
|
282 | throw std::runtime_error(fmt::format("Failed to get scalar option for parameter {:?} for algorithm {:?}", key, m_class_name)); |
| 74 | } | ||
| 75 |
8/16std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > iguana::Algorithm::GetOptionScalar<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(std::deque<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<YAML::Node (YAML::Node)> >, std::allocator<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<YAML::Node (YAML::Node)> > > >) const:
✓ Branch 30 → 31 taken 104 times.
✗ Branch 30 → 56 not taken.
✓ Branch 31 → 32 taken 104 times.
✗ Branch 31 → 33 not taken.
double iguana::Algorithm::GetOptionScalar<double>(std::deque<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<YAML::Node (YAML::Node)> >, std::allocator<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<YAML::Node (YAML::Node)> > > >) const:
✓ Branch 28 → 29 taken 30 times.
✗ Branch 28 → 49 not taken.
✓ Branch 29 → 30 taken 30 times.
✗ Branch 29 → 31 not taken.
✗ Branch 49 → 50 not taken.
✗ Branch 49 → 52 not taken.
int iguana::Algorithm::GetOptionScalar<int>(std::deque<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<YAML::Node (YAML::Node)> >, std::allocator<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<YAML::Node (YAML::Node)> > > >) const:
✓ Branch 28 → 29 taken 29 times.
✗ Branch 28 → 49 not taken.
✓ Branch 29 → 30 taken 29 times.
✗ Branch 29 → 31 not taken.
✓ Branch 49 → 50 taken 2 times.
✓ Branch 49 → 52 taken 1 time.
|
258 | PrintOptionValue(key, opt.value()); |
| 76 |
4/4double iguana::Algorithm::GetOptionScalar<double>(std::deque<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<YAML::Node (YAML::Node)> >, std::allocator<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<YAML::Node (YAML::Node)> > > >) const:
✓ Branch 30 → 32 taken 11 times.
✓ Branch 30 → 34 taken 19 times.
int iguana::Algorithm::GetOptionScalar<int>(std::deque<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<YAML::Node (YAML::Node)> >, std::allocator<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<YAML::Node (YAML::Node)> > > >) const:
✓ Branch 30 → 32 taken 20 times.
✓ Branch 30 → 34 taken 9 times.
|
222 | return opt.value(); |
| 77 | } | ||
| 78 | template int Algorithm::GetOptionScalar(YAMLReader::node_path_t node_path) const; | ||
| 79 | template double Algorithm::GetOptionScalar(YAMLReader::node_path_t node_path) const; | ||
| 80 | template std::string Algorithm::GetOptionScalar(YAMLReader::node_path_t node_path) const; | ||
| 81 | |||
| 82 | /////////////////////////////////////////////////////////////////////////////// | ||
| 83 | |||
| 84 | template <typename OPTION_TYPE> | ||
| 85 | 54 | std::vector<OPTION_TYPE> Algorithm::GetOptionVector(YAMLReader::node_path_t node_path) const | |
| 86 | { | ||
| 87 | 54 | auto key = YAMLReader::NodePath2String(node_path); | |
| 88 |
3/6std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > iguana::Algorithm::GetOptionVector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(std::deque<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<YAML::Node (YAML::Node)> >, std::allocator<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<YAML::Node (YAML::Node)> > > >) const:
✓ Branch 3 → 4 taken 4 times.
✗ Branch 3 → 61 not taken.
std::vector<double, std::allocator<double> > iguana::Algorithm::GetOptionVector<double>(std::deque<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<YAML::Node (YAML::Node)> >, std::allocator<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<YAML::Node (YAML::Node)> > > >) const:
✓ Branch 3 → 4 taken 28 times.
✗ Branch 3 → 55 not taken.
std::vector<int, std::allocator<int> > iguana::Algorithm::GetOptionVector<int>(std::deque<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<YAML::Node (YAML::Node)> >, std::allocator<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<YAML::Node (YAML::Node)> > > >) const:
✓ Branch 3 → 4 taken 22 times.
✗ Branch 3 → 55 not taken.
|
54 | auto opt = GetCachedOption<std::vector<OPTION_TYPE>>(key); |
| 89 |
4/6std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > iguana::Algorithm::GetOptionVector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(std::deque<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<YAML::Node (YAML::Node)> >, std::allocator<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<YAML::Node (YAML::Node)> > > >) const:
✓ Branch 9 → 10 taken 4 times.
✗ Branch 9 → 18 not taken.
std::vector<double, std::allocator<double> > iguana::Algorithm::GetOptionVector<double>(std::deque<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<YAML::Node (YAML::Node)> >, std::allocator<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<YAML::Node (YAML::Node)> > > >) const:
✓ Branch 9 → 10 taken 28 times.
✗ Branch 9 → 16 not taken.
std::vector<int, std::allocator<int> > iguana::Algorithm::GetOptionVector<int>(std::deque<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<YAML::Node (YAML::Node)> >, std::allocator<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<YAML::Node (YAML::Node)> > > >) const:
✓ Branch 9 → 10 taken 15 times.
✓ Branch 9 → 16 taken 7 times.
|
54 | node_path.push_front(m_class_name); |
| 90 |
4/6std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > iguana::Algorithm::GetOptionVector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(std::deque<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<YAML::Node (YAML::Node)> >, std::allocator<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<YAML::Node (YAML::Node)> > > >) const:
✓ Branch 9 → 10 taken 4 times.
✗ Branch 9 → 18 not taken.
std::vector<double, std::allocator<double> > iguana::Algorithm::GetOptionVector<double>(std::deque<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<YAML::Node (YAML::Node)> >, std::allocator<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<YAML::Node (YAML::Node)> > > >) const:
✓ Branch 9 → 10 taken 28 times.
✗ Branch 9 → 16 not taken.
std::vector<int, std::allocator<int> > iguana::Algorithm::GetOptionVector<int>(std::deque<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<YAML::Node (YAML::Node)> >, std::allocator<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<YAML::Node (YAML::Node)> > > >) const:
✓ Branch 9 → 10 taken 15 times.
✓ Branch 9 → 16 taken 7 times.
|
54 | if(!opt.has_value()) { |
| 91 |
6/12std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > iguana::Algorithm::GetOptionVector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(std::deque<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<YAML::Node (YAML::Node)> >, std::allocator<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<YAML::Node (YAML::Node)> > > >) const:
✓ Branch 10 → 11 taken 4 times.
✗ Branch 10 → 57 not taken.
✓ Branch 11 → 12 taken 4 times.
✗ Branch 11 → 47 not taken.
std::vector<double, std::allocator<double> > iguana::Algorithm::GetOptionVector<double>(std::deque<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<YAML::Node (YAML::Node)> >, std::allocator<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<YAML::Node (YAML::Node)> > > >) const:
✓ Branch 10 → 11 taken 28 times.
✗ Branch 10 → 53 not taken.
✓ Branch 11 → 12 taken 28 times.
✗ Branch 11 → 43 not taken.
std::vector<int, std::allocator<int> > iguana::Algorithm::GetOptionVector<int>(std::deque<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<YAML::Node (YAML::Node)> >, std::allocator<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<YAML::Node (YAML::Node)> > > >) const:
✓ Branch 10 → 11 taken 15 times.
✗ Branch 10 → 53 not taken.
✓ Branch 11 → 12 taken 15 times.
✗ Branch 11 → 43 not taken.
|
94 | opt = m_yaml_config->GetVector<OPTION_TYPE>(node_path); |
| 92 | } | ||
| 93 |
4/6std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > iguana::Algorithm::GetOptionVector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(std::deque<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<YAML::Node (YAML::Node)> >, std::allocator<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<YAML::Node (YAML::Node)> > > >) const:
✗ Branch 18 → 19 not taken.
✓ Branch 18 → 32 taken 4 times.
std::vector<double, std::allocator<double> > iguana::Algorithm::GetOptionVector<double>(std::deque<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<YAML::Node (YAML::Node)> >, std::allocator<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<YAML::Node (YAML::Node)> > > >) const:
✗ Branch 16 → 17 not taken.
✓ Branch 16 → 30 taken 28 times.
std::vector<int, std::allocator<int> > iguana::Algorithm::GetOptionVector<int>(std::deque<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<YAML::Node (YAML::Node)> >, std::allocator<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<YAML::Node (YAML::Node)> > > >) const:
✓ Branch 16 → 17 taken 4 times.
✓ Branch 16 → 30 taken 18 times.
|
54 | if(!opt.has_value()) { |
| 94 |
1/6std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > iguana::Algorithm::GetOptionVector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(std::deque<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<YAML::Node (YAML::Node)> >, std::allocator<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<YAML::Node (YAML::Node)> > > >) const:
✗ Branch 25 → 26 not taken.
✗ Branch 25 → 49 not taken.
std::vector<double, std::allocator<double> > iguana::Algorithm::GetOptionVector<double>(std::deque<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<YAML::Node (YAML::Node)> >, std::allocator<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<YAML::Node (YAML::Node)> > > >) const:
✗ Branch 23 → 24 not taken.
✗ Branch 23 → 45 not taken.
std::vector<int, std::allocator<int> > iguana::Algorithm::GetOptionVector<int>(std::deque<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<YAML::Node (YAML::Node)> >, std::allocator<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<YAML::Node (YAML::Node)> > > >) const:
✓ Branch 23 → 24 taken 4 times.
✗ Branch 23 → 45 not taken.
|
12 | throw std::runtime_error(fmt::format("Failed to get vector option for parameter {:?} for algorithm {:?}", key, m_class_name)); |
| 95 | } | ||
| 96 |
6/14std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > iguana::Algorithm::GetOptionVector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(std::deque<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<YAML::Node (YAML::Node)> >, std::allocator<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<YAML::Node (YAML::Node)> > > >) const:
✓ Branch 32 → 33 taken 4 times.
✗ Branch 32 → 57 not taken.
✓ Branch 33 → 34 taken 4 times.
✗ Branch 33 → 35 not taken.
✗ Branch 57 → 58 not taken.
✗ Branch 57 → 60 not taken.
std::vector<double, std::allocator<double> > iguana::Algorithm::GetOptionVector<double>(std::deque<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<YAML::Node (YAML::Node)> >, std::allocator<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<YAML::Node (YAML::Node)> > > >) const:
✓ Branch 30 → 31 taken 28 times.
✗ Branch 30 → 53 not taken.
✓ Branch 31 → 32 taken 28 times.
✗ Branch 31 → 33 not taken.
std::vector<int, std::allocator<int> > iguana::Algorithm::GetOptionVector<int>(std::deque<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<YAML::Node (YAML::Node)> >, std::allocator<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<YAML::Node (YAML::Node)> > > >) const:
✓ Branch 30 → 31 taken 18 times.
✗ Branch 30 → 53 not taken.
✓ Branch 31 → 32 taken 18 times.
✗ Branch 31 → 33 not taken.
|
54 | PrintOptionValue(key, opt.value()); |
| 97 |
3/6std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > iguana::Algorithm::GetOptionVector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(std::deque<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<YAML::Node (YAML::Node)> >, std::allocator<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<YAML::Node (YAML::Node)> > > >) const:
✓ Branch 34 → 36 taken 4 times.
✗ Branch 34 → 57 not taken.
std::vector<double, std::allocator<double> > iguana::Algorithm::GetOptionVector<double>(std::deque<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<YAML::Node (YAML::Node)> >, std::allocator<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<YAML::Node (YAML::Node)> > > >) const:
✓ Branch 32 → 34 taken 28 times.
✗ Branch 32 → 53 not taken.
std::vector<int, std::allocator<int> > iguana::Algorithm::GetOptionVector<int>(std::deque<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<YAML::Node (YAML::Node)> >, std::allocator<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<YAML::Node (YAML::Node)> > > >) const:
✓ Branch 32 → 34 taken 18 times.
✗ Branch 32 → 53 not taken.
|
100 | return opt.value(); |
| 98 | } | ||
| 99 | template std::vector<int> Algorithm::GetOptionVector(YAMLReader::node_path_t node_path) const; | ||
| 100 | template std::vector<double> Algorithm::GetOptionVector(YAMLReader::node_path_t node_path) const; | ||
| 101 | template std::vector<std::string> Algorithm::GetOptionVector(YAMLReader::node_path_t node_path) const; | ||
| 102 | |||
| 103 | /////////////////////////////////////////////////////////////////////////////// | ||
| 104 | |||
| 105 | template <typename OPTION_TYPE> | ||
| 106 | 17 | std::set<OPTION_TYPE> Algorithm::GetOptionSet(YAMLReader::node_path_t node_path) const | |
| 107 | { | ||
| 108 |
3/6std::set<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > iguana::Algorithm::GetOptionSet<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(std::deque<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<YAML::Node (YAML::Node)> >, std::allocator<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<YAML::Node (YAML::Node)> > > >) const:
✓ Branch 3 → 4 taken 1 time.
✗ Branch 3 → 11 not taken.
std::set<double, std::less<double>, std::allocator<double> > iguana::Algorithm::GetOptionSet<double>(std::deque<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<YAML::Node (YAML::Node)> >, std::allocator<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<YAML::Node (YAML::Node)> > > >) const:
✗ Branch 3 → 4 not taken.
✗ Branch 3 → 13 not taken.
std::set<int, std::less<int>, std::allocator<int> > iguana::Algorithm::GetOptionSet<int>(std::deque<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<YAML::Node (YAML::Node)> >, std::allocator<std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::function<YAML::Node (YAML::Node)> > > >) const:
✓ Branch 3 → 4 taken 14 times.
✓ Branch 3 → 13 taken 2 times.
|
17 | auto val_vec = GetOptionVector<OPTION_TYPE>(node_path); |
| 109 | std::set<OPTION_TYPE> val_set; | ||
| 110 | std::copy(val_vec.begin(), val_vec.end(), std::inserter(val_set, val_set.end())); | ||
| 111 | 15 | return val_set; | |
| 112 | 1 | } | |
| 113 | template std::set<int> Algorithm::GetOptionSet(YAMLReader::node_path_t node_path) const; | ||
| 114 | template std::set<double> Algorithm::GetOptionSet(YAMLReader::node_path_t node_path) const; | ||
| 115 | template std::set<std::string> Algorithm::GetOptionSet(YAMLReader::node_path_t node_path) const; | ||
| 116 | |||
| 117 | /////////////////////////////////////////////////////////////////////////////// | ||
| 118 | |||
| 119 | 136 | void Algorithm::SetName(std::string_view name) | |
| 120 | { | ||
| 121 | 136 | Object::SetName(name); | |
| 122 |
1/2✗ Branch 3 → 4 not taken.
✓ Branch 3 → 14 taken 136 times.
|
136 | if(m_yaml_config) |
| 123 | ✗ | m_yaml_config->SetName("config|" + m_name); | |
| 124 | 136 | } | |
| 125 | |||
| 126 | /////////////////////////////////////////////////////////////////////////////// | ||
| 127 | |||
| 128 | 42 | std::unique_ptr<YAMLReader> const& Algorithm::GetConfig() const | |
| 129 | { | ||
| 130 | 42 | return m_yaml_config; | |
| 131 | } | ||
| 132 | |||
| 133 | /////////////////////////////////////////////////////////////////////////////// | ||
| 134 | |||
| 135 | ✗ | void Algorithm::SetConfig(std::unique_ptr<YAMLReader>&& yaml_config) | |
| 136 | { | ||
| 137 | m_yaml_config = std::move(yaml_config); | ||
| 138 | ✗ | } | |
| 139 | |||
| 140 | /////////////////////////////////////////////////////////////////////////////// | ||
| 141 | |||
| 142 |
1/2✗ Branch 2 → 3 not taken.
✓ Branch 2 → 4 taken 15 times.
|
15 | void Algorithm::SetConfigFile(std::string const& name) |
| 143 | { | ||
| 144 |
4/8✓ Branch 5 → 6 taken 15 times.
✗ Branch 5 → 30 not taken.
✓ Branch 6 → 7 taken 15 times.
✗ Branch 6 → 24 not taken.
✓ Branch 18 → 19 taken 3 times.
✓ Branch 18 → 21 taken 12 times.
✗ Branch 30 → 31 not taken.
✗ Branch 30 → 33 not taken.
|
30 | o_user_config_file = SetOption("config_file", name); |
| 145 | 15 | } | |
| 146 | |||
| 147 | /////////////////////////////////////////////////////////////////////////////// | ||
| 148 | |||
| 149 |
1/2✗ Branch 2 → 3 not taken.
✓ Branch 2 → 4 taken 6 times.
|
6 | void Algorithm::SetConfigDirectory(std::string const& name) |
| 150 | { | ||
| 151 |
3/8✓ Branch 5 → 6 taken 6 times.
✗ Branch 5 → 30 not taken.
✓ Branch 6 → 7 taken 6 times.
✗ Branch 6 → 24 not taken.
✗ Branch 18 → 19 not taken.
✓ Branch 18 → 21 taken 6 times.
✗ Branch 30 → 31 not taken.
✗ Branch 30 → 33 not taken.
|
12 | o_user_config_dir = SetOption("config_dir", name); |
| 152 | 6 | } | |
| 153 | |||
| 154 | /////////////////////////////////////////////////////////////////////////////// | ||
| 155 | |||
| 156 |
1/2✓ Branch 2 → 3 taken 104 times.
✗ Branch 2 → 48 not taken.
|
104 | void Algorithm::ParseYAMLConfig() |
| 157 | { | ||
| 158 | |||
| 159 | // start YAMLReader instance, if not yet started | ||
| 160 |
1/2✓ Branch 2 → 3 taken 104 times.
✗ Branch 2 → 48 not taken.
|
104 | if(!m_yaml_config) { |
| 161 | // set config files and directories specified by `::SetConfigFile`, `::SetConfigDirectory`, etc. | ||
| 162 |
2/4✓ Branch 4 → 5 taken 104 times.
✗ Branch 4 → 74 not taken.
✓ Branch 5 → 6 taken 104 times.
✗ Branch 5 → 72 not taken.
|
104 | o_user_config_file = GetCachedOption<std::string>("config_file").value_or(""); |
| 163 |
2/4✓ Branch 19 → 20 taken 104 times.
✗ Branch 19 → 82 not taken.
✓ Branch 20 → 21 taken 104 times.
✗ Branch 20 → 80 not taken.
|
208 | o_user_config_dir = GetCachedOption<std::string>("config_dir").value_or(""); |
| 164 | 104 | m_log->Debug("Instantiating `YAMLReader`"); | |
| 165 |
1/2✓ Branch 35 → 36 taken 104 times.
✗ Branch 35 → 88 not taken.
|
208 | m_yaml_config = std::make_unique<YAMLReader>("config|" + m_name); |
| 166 | 104 | m_yaml_config->SetLogLevel(m_log->GetLevel()); // synchronize log levels | |
| 167 | 104 | m_yaml_config->AddDirectory(o_user_config_dir); | |
| 168 | try { | ||
| 169 |
2/2✓ Branch 46 → 47 taken 49 times.
✓ Branch 46 → 94 taken 55 times.
|
104 | m_yaml_config->AddFile(m_default_config_file, false); |
| 170 | } | ||
| 171 |
1/2✗ Branch 94 → 95 not taken.
✓ Branch 94 → 96 taken 55 times.
|
55 | catch(std::runtime_error const& ex) { |
| 172 | 55 | m_log->Debug("this algorithm has no default configuration YAML file"); | |
| 173 | 55 | } | |
| 174 | 104 | m_yaml_config->AddFile(o_user_config_file); | |
| 175 | } | ||
| 176 | else | ||
| 177 | ✗ | m_log->Debug("`YAMLReader` already instantiated for this algorithm; using that"); | |
| 178 | |||
| 179 | // parse the files | ||
| 180 | 104 | m_yaml_config->LoadFiles(); | |
| 181 | |||
| 182 | // set log level | ||
| 183 | try { | ||
| 184 |
8/10✓ Branch 52 → 53 taken 104 times.
✗ Branch 52 → 103 not taken.
✓ Branch 53 → 54 taken 12 times.
✓ Branch 53 → 101 taken 92 times.
✓ Branch 56 → 57 taken 12 times.
✓ Branch 56 → 59 taken 12 times.
✗ Branch 59 → 60 not taken.
✓ Branch 59 → 61 taken 12 times.
✓ Branch 104 → 105 taken 92 times.
✓ Branch 104 → 107 taken 92 times.
|
300 | auto log_level = GetOptionScalar<std::string>({"log"}); |
| 185 |
1/2✓ Branch 61 → 62 taken 12 times.
✗ Branch 61 → 108 not taken.
|
12 | m_log->SetLevel(log_level); |
| 186 |
2/4✗ Branch 62 → 63 not taken.
✓ Branch 62 → 64 taken 12 times.
✓ Branch 64 → 65 taken 12 times.
✗ Branch 64 → 108 not taken.
|
12 | m_yaml_config->SetLogLevel(log_level); |
| 187 | } | ||
| 188 |
1/2✗ Branch 114 → 115 not taken.
✓ Branch 114 → 116 taken 92 times.
|
92 | catch(std::runtime_error const& ex) { |
| 189 |
4/10✓ Branch 117 → 118 taken 92 times.
✗ Branch 117 → 156 not taken.
✓ Branch 120 → 121 taken 92 times.
✗ Branch 120 → 144 not taken.
✓ Branch 121 → 122 taken 92 times.
✗ Branch 121 → 138 not taken.
✓ Branch 127 → 128 taken 92 times.
✗ Branch 127 → 130 not taken.
✗ Branch 144 → 145 not taken.
✗ Branch 144 → 147 not taken.
|
276 | PrintOptionValue("log", m_log->GetLevelName() + " (default)"); |
| 190 | 92 | } | |
| 191 | 104 | } | |
| 192 | |||
| 193 | /////////////////////////////////////////////////////////////////////////////// | ||
| 194 | |||
| 195 | 8 | void Algorithm::StartRCDBReader() | |
| 196 | { | ||
| 197 |
1/2✓ Branch 6 → 7 taken 8 times.
✗ Branch 6 → 20 not taken.
|
24 | m_rcdb = std::make_unique<RCDBReader>("RCDB|" + GetName(), m_log->GetLevel()); |
| 198 | 8 | } | |
| 199 | |||
| 200 | /////////////////////////////////////////////////////////////////////////////// | ||
| 201 | |||
| 202 | 214 | hipo::banklist::size_type Algorithm::GetBankIndex(hipo::banklist& banks, std::string const& bank_name) const | |
| 203 | { | ||
| 204 |
2/2✓ Branch 2 → 3 taken 183 times.
✓ Branch 2 → 21 taken 31 times.
|
214 | if(m_rows_only) |
| 205 | return 0; | ||
| 206 | try { | ||
| 207 | // check if this bank was created by iguana | ||
| 208 | 183 | auto created_by_iguana = AlgorithmFactory::GetCreatorAlgorithms(bank_name); | |
| 209 | // get the index | ||
| 210 | 183 | auto idx = tools::GetBankIndex( | |
| 211 | banks, | ||
| 212 | bank_name, | ||
| 213 |
4/6✓ Branch 4 → 5 taken 37 times.
✓ Branch 4 → 6 taken 146 times.
✓ Branch 6 → 7 taken 183 times.
✗ Branch 6 → 28 not taken.
✗ Branch 7 → 8 not taken.
✓ Branch 7 → 9 taken 183 times.
|
183 | created_by_iguana ? m_created_bank_variant : 0); |
| 214 |
5/10✓ Branch 11 → 12 taken 183 times.
✗ Branch 11 → 22 not taken.
✓ Branch 12 → 13 taken 110 times.
✓ Branch 12 → 15 taken 73 times.
✓ Branch 17 → 18 taken 37 times.
✓ Branch 17 → 20 taken 146 times.
✗ Branch 22 → 23 not taken.
✗ Branch 22 → 25 not taken.
✗ Branch 28 → 29 not taken.
✗ Branch 28 → 31 not taken.
|
366 | m_log->Trace("cached index of bank '{}' is {}", bank_name, idx); |
| 215 | return idx; | ||
| 216 | } | ||
| 217 | ✗ | catch(std::runtime_error const& ex) { | |
| 218 | ✗ | m_log->Error("required input bank '{}' not found; cannot `Start` algorithm '{}'", bank_name, m_class_name); | |
| 219 | ✗ | auto creators = AlgorithmFactory::GetCreatorAlgorithms(bank_name); | |
| 220 | ✗ | if(creators) | |
| 221 | ✗ | m_log->Error(" -> this bank is created by algorithm(s) [{}]; please `Start` ONE of them BEFORE this algorithm", fmt::join(creators.value(), ", ")); | |
| 222 | ✗ | throw std::runtime_error("cannot cache bank index"); | |
| 223 | ✗ | } | |
| 224 | } | ||
| 225 | |||
| 226 | /////////////////////////////////////////////////////////////////////////////// | ||
| 227 | |||
| 228 | 3 | hipo::banklist::size_type Algorithm::GetCreatedBankIndex(hipo::banklist& banks) const noexcept(false) | |
| 229 | { | ||
| 230 |
1/2✓ Branch 3 → 4 taken 3 times.
✗ Branch 3 → 10 not taken.
|
6 | return GetBankIndex(banks, GetCreatedBankName()); |
| 231 | } | ||
| 232 | |||
| 233 | /////////////////////////////////////////////////////////////////////////////// | ||
| 234 | |||
| 235 |
1/2✗ Branch 2 → 3 not taken.
✓ Branch 2 → 4 taken 33 times.
|
33 | void Algorithm::PrintOptionValue(std::string const& key, int const& val, Logger::Level const level, std::string_view prefix) const |
| 236 | { | ||
| 237 |
4/8✗ Branch 2 → 3 not taken.
✓ Branch 2 → 4 taken 33 times.
✓ Branch 5 → 6 taken 33 times.
✗ Branch 5 → 12 not taken.
✓ Branch 6 → 7 taken 24 times.
✓ Branch 6 → 9 taken 9 times.
✗ Branch 12 → 13 not taken.
✗ Branch 12 → 15 not taken.
|
66 | m_log->Print(level, "{}: {:>20} = {} [int]", prefix, key, val); |
| 238 | 33 | } | |
| 239 | |||
| 240 |
1/2✗ Branch 2 → 3 not taken.
✓ Branch 2 → 4 taken 30 times.
|
30 | void Algorithm::PrintOptionValue(std::string const& key, double const& val, Logger::Level const level, std::string_view prefix) const |
| 241 | { | ||
| 242 |
4/8✗ Branch 2 → 3 not taken.
✓ Branch 2 → 4 taken 30 times.
✓ Branch 5 → 6 taken 30 times.
✗ Branch 5 → 12 not taken.
✓ Branch 6 → 7 taken 11 times.
✓ Branch 6 → 9 taken 19 times.
✗ Branch 12 → 13 not taken.
✗ Branch 12 → 15 not taken.
|
60 | m_log->Print(level, "{}: {:>20} = {} [double]", prefix, key, val); |
| 243 | 30 | } | |
| 244 | |||
| 245 |
1/2✗ Branch 2 → 3 not taken.
✓ Branch 2 → 4 taken 196 times.
|
196 | void Algorithm::PrintOptionValue(std::string const& key, std::string const& val, Logger::Level const level, std::string_view prefix) const |
| 246 | { | ||
| 247 |
5/10✓ Branch 9 → 10 taken 196 times.
✗ Branch 9 → 21 not taken.
✓ Branch 10 → 11 taken 157 times.
✓ Branch 10 → 13 taken 39 times.
✓ Branch 15 → 16 taken 178 times.
✓ Branch 15 → 18 taken 18 times.
✗ Branch 21 → 22 not taken.
✗ Branch 21 → 24 not taken.
✗ Branch 27 → 28 not taken.
✗ Branch 27 → 30 not taken.
|
392 | m_log->Print(level, "{}: {:>20} = {:?} [string]", prefix, key, val); |
| 248 | 196 | } | |
| 249 | |||
| 250 |
1/2✗ Branch 2 → 3 not taken.
✓ Branch 2 → 4 taken 18 times.
|
18 | void Algorithm::PrintOptionValue(std::string const& key, std::vector<int> const& val, Logger::Level const level, std::string_view prefix) const |
| 251 | { | ||
| 252 |
2/6✓ Branch 6 → 7 taken 18 times.
✗ Branch 6 → 13 not taken.
✓ Branch 7 → 8 taken 18 times.
✗ Branch 7 → 10 not taken.
✗ Branch 13 → 14 not taken.
✗ Branch 13 → 16 not taken.
|
18 | m_log->Print(level, "{}: {:>20} = ({}) [std::vector<int>]", prefix, key, fmt::join(val, ", ")); |
| 253 | 18 | } | |
| 254 | |||
| 255 |
1/2✗ Branch 2 → 3 not taken.
✓ Branch 2 → 4 taken 28 times.
|
28 | void Algorithm::PrintOptionValue(std::string const& key, std::vector<double> const& val, Logger::Level const level, std::string_view prefix) const |
| 256 | { | ||
| 257 |
3/6✓ Branch 6 → 7 taken 28 times.
✗ Branch 6 → 13 not taken.
✓ Branch 7 → 8 taken 8 times.
✓ Branch 7 → 10 taken 20 times.
✗ Branch 13 → 14 not taken.
✗ Branch 13 → 16 not taken.
|
28 | m_log->Print(level, "{}: {:>20} = ({}) [std::vector<double>]", prefix, key, fmt::join(val, ", ")); |
| 258 | 28 | } | |
| 259 | |||
| 260 | 4 | void Algorithm::PrintOptionValue(std::string const& key, std::vector<std::string> const& val, Logger::Level const level, std::string_view prefix) const | |
| 261 | { | ||
| 262 | std::vector<std::string> val_quoted; | ||
| 263 |
2/2✓ Branch 13 → 3 taken 11 times.
✓ Branch 13 → 14 taken 4 times.
|
15 | for(auto const& s : val) |
| 264 |
1/2✓ Branch 6 → 7 taken 11 times.
✗ Branch 6 → 26 not taken.
|
22 | val_quoted.push_back(fmt::format("{:?}", s)); |
| 265 |
3/6✓ Branch 18 → 19 taken 4 times.
✗ Branch 18 → 32 not taken.
✓ Branch 19 → 20 taken 3 times.
✓ Branch 19 → 22 taken 1 time.
✗ Branch 32 → 33 not taken.
✗ Branch 32 → 35 not taken.
|
4 | m_log->Print(level, "{}: {:>20} = ({}) [std::vector<string>]", prefix, key, fmt::join(val_quoted, ", ")); |
| 266 | 4 | } | |
| 267 | |||
| 268 | /////////////////////////////////////////////////////////////////////////////// | ||
| 269 | |||
| 270 | 134417 | hipo::bank& Algorithm::GetBank(hipo::banklist& banks, hipo::banklist::size_type const idx, std::string const& expected_bank_name) const | |
| 271 | { | ||
| 272 |
1/2✗ Branch 2 → 3 not taken.
✓ Branch 2 → 5 taken 134417 times.
|
134417 | if(m_rows_only) { |
| 273 | ✗ | m_log->Error("algorithm is in 'rows only' mode; cannot call `Run` since banks are not cached; use action function(s) instead"); | |
| 274 | } | ||
| 275 | else { | ||
| 276 | try { | ||
| 277 |
1/2✓ Branch 5 → 6 taken 134417 times.
✗ Branch 5 → 56 not taken.
|
134417 | auto& result = banks.at(idx); |
| 278 |
4/6✓ Branch 6 → 7 taken 133535 times.
✓ Branch 6 → 19 taken 882 times.
✗ Branch 11 → 12 not taken.
✓ Branch 11 → 13 taken 133535 times.
✗ Branch 19 → 20 not taken.
✓ Branch 19 → 40 taken 134417 times.
|
401487 | if(!expected_bank_name.empty() && result.getSchema().getName() != expected_bank_name) |
| 279 | ✗ | m_log->Error("expected input bank '{}' at index={}; got bank named '{}'", expected_bank_name, idx, result.getSchema().getName()); | |
| 280 | else | ||
| 281 | 134417 | return result; | |
| 282 | } | ||
| 283 | ✗ | catch(std::out_of_range const& o) { | |
| 284 | ✗ | m_log->Error("required input bank '{}' not found; cannot `Run` algorithm '{}'", expected_bank_name, m_class_name); | |
| 285 | ✗ | auto creators = AlgorithmFactory::GetCreatorAlgorithms(expected_bank_name); | |
| 286 | ✗ | if(creators) | |
| 287 | ✗ | m_log->Error(" -> this bank is created by algorithm(s) [{}]; please `Run` ONE of them BEFORE this algorithm", fmt::join(creators.value(), ", ")); | |
| 288 | ✗ | } | |
| 289 | } | ||
| 290 | ✗ | throw std::runtime_error("GetBank failed"); | |
| 291 | } | ||
| 292 | |||
| 293 | /////////////////////////////////////////////////////////////////////////////// | ||
| 294 | |||
| 295 | 23 | std::vector<std::string> Algorithm::GetCreatedBankNames() const noexcept(false) | |
| 296 | { | ||
| 297 | 23 | auto created_banks = AlgorithmFactory::GetCreatedBanks(m_class_name); | |
| 298 |
1/2✓ Branch 3 → 4 taken 23 times.
✗ Branch 3 → 5 not taken.
|
23 | if(created_banks) |
| 299 |
1/2✓ Branch 4 → 8 taken 23 times.
✗ Branch 4 → 14 not taken.
|
46 | return created_banks.value(); |
| 300 | ✗ | throw std::runtime_error("failed to get created bank names"); | |
| 301 | } | ||
| 302 | |||
| 303 | /////////////////////////////////////////////////////////////////////////////// | ||
| 304 | |||
| 305 | 23 | std::string Algorithm::GetCreatedBankName() const noexcept(false) | |
| 306 | { | ||
| 307 | 23 | auto created_banks = GetCreatedBankNames(); | |
| 308 |
1/3✗ Branch 5 → 6 not taken.
✓ Branch 5 → 17 taken 23 times.
✗ Branch 5 → 21 not taken.
|
23 | switch(created_banks.size()) { |
| 309 | ✗ | case 0: | |
| 310 | ✗ | m_log->Error("algorithm {:?} creates no new banks", m_class_name); | |
| 311 | ✗ | break; | |
| 312 | 23 | case 1: | |
| 313 |
1/2✓ Branch 17 → 18 taken 23 times.
✗ Branch 17 → 55 not taken.
|
46 | return created_banks.at(0); |
| 314 | break; | ||
| 315 | ✗ | default: | |
| 316 | ✗ | m_log->Error("algorithm {:?} creates more than one bank; they are: [{}]", m_class_name, fmt::join(created_banks, ", ")); | |
| 317 | ✗ | m_log->Error("- if you called `GetCreatedBank` or `GetCreatedBankSchema`, please specify which bank you want"); | |
| 318 | ✗ | m_log->Error("- if you called `GetCreatedBankName`, call `GetCreatedBankNames` instead"); | |
| 319 | ✗ | break; | |
| 320 | } | ||
| 321 | ✗ | throw std::runtime_error("failed to get created bank names"); | |
| 322 | 23 | } | |
| 323 | |||
| 324 | /////////////////////////////////////////////////////////////////////////////// | ||
| 325 | |||
| 326 | 1 | hipo::bank Algorithm::GetCreatedBank(std::string const& bank_name) const noexcept(false) | |
| 327 | { | ||
| 328 |
1/2✓ Branch 3 → 4 taken 1 time.
✗ Branch 3 → 6 not taken.
|
1 | return hipo::bank(GetCreatedBankSchema(bank_name), 0); |
| 329 | } | ||
| 330 | |||
| 331 | /////////////////////////////////////////////////////////////////////////////// | ||
| 332 | |||
| 333 |
1/2✗ Branch 2 → 3 not taken.
✓ Branch 2 → 4 taken 34 times.
|
34 | hipo::schema Algorithm::GetCreatedBankSchema(std::string const& bank_name) const noexcept(false) |
| 334 | { | ||
| 335 | std::string bank_name_arg = bank_name; // copy, to permit modification | ||
| 336 | |||
| 337 | // if the user did not provide a bank name, get it from the list of banks created by the algorithm; | ||
| 338 | // this will fail if the algorithm creates more than one bank, in which case, the user must | ||
| 339 | // specify the bank name explicitly | ||
| 340 |
2/2✓ Branch 5 → 6 taken 1 time.
✓ Branch 5 → 14 taken 33 times.
|
34 | if(bank_name.empty()) |
| 341 |
1/2✓ Branch 6 → 7 taken 1 time.
✗ Branch 6 → 134 not taken.
|
2 | bank_name_arg = GetCreatedBankName(); |
| 342 | |||
| 343 | // loop over bank definitions, `BANK_DEFS`, which is generated at build-time using `src/iguana/bankdefs/iguana.json` | ||
| 344 |
1/2✓ Branch 78 → 15 taken 116 times.
✗ Branch 78 → 79 not taken.
|
116 | for(auto const& bank_def : BANK_DEFS) { |
| 345 |
2/2✓ Branch 15 → 16 taken 34 times.
✓ Branch 15 → 77 taken 82 times.
|
116 | if(bank_def.name == bank_name_arg) { |
| 346 | // make sure the new bank is in REGISTER_IGUANA_ALGORITHM | ||
| 347 |
1/2✗ Branch 20 → 21 not taken.
✓ Branch 20 → 43 taken 34 times.
|
68 | if(!AlgorithmFactory::GetCreatorAlgorithms(bank_name_arg)) { |
| 348 | ✗ | m_log->Error("algorithm {:?} creates bank {:?}, which is not registered; new banks must be included in `REGISTER_IGUANA_ALGORITHM` arguments", m_class_name, bank_name_arg); | |
| 349 | ✗ | throw std::runtime_error("CreateBank failed"); | |
| 350 | } | ||
| 351 | // create the schema format string | ||
| 352 | std::vector<std::string> schema_def; | ||
| 353 |
2/2✓ Branch 61 → 44 taken 326 times.
✓ Branch 61 → 62 taken 34 times.
|
360 | for(auto const& entry : bank_def.entries) |
| 354 |
1/2✓ Branch 44 → 45 taken 326 times.
✗ Branch 44 → 124 not taken.
|
652 | schema_def.push_back(entry.name + "/" + entry.type); |
| 355 | 34 | auto format_string = fmt::format("{}", fmt::join(schema_def, ",")); | |
| 356 | // create the new bank schema | ||
| 357 |
1/2✓ Branch 63 → 64 taken 34 times.
✗ Branch 63 → 118 not taken.
|
34 | hipo::schema bank_schema(bank_name_arg.c_str(), bank_def.group, bank_def.item); |
| 358 |
1/2✓ Branch 64 → 65 taken 34 times.
✗ Branch 64 → 116 not taken.
|
34 | bank_schema.parse(format_string); |
| 359 | 34 | return bank_schema; | |
| 360 | 34 | } | |
| 361 | } | ||
| 362 | |||
| 363 | ✗ | throw std::runtime_error(fmt::format("bank {:?} not found in 'BankDefs.h'; is this bank defined in src/iguana/bankdefs/iguana.json ?", bank_name_arg)); | |
| 364 | } | ||
| 365 | /////////////////////////////////////////////////////////////////////////////// | ||
| 366 | |||
| 367 | 12 | unsigned int Algorithm::GetCreatedBankVariant() const | |
| 368 | { | ||
| 369 | 12 | return m_created_bank_variant; | |
| 370 | } | ||
| 371 | |||
| 372 | /////////////////////////////////////////////////////////////////////////////// | ||
| 373 | |||
| 374 | ✗ | std::unique_ptr<RCDBReader>& Algorithm::GetRCDBReader() | |
| 375 | { | ||
| 376 | ✗ | return m_rcdb; | |
| 377 | } | ||
| 378 | |||
| 379 | /////////////////////////////////////////////////////////////////////////////// | ||
| 380 | |||
| 381 | 33 | hipo::schema Algorithm::CreateBank( | |
| 382 | hipo::banklist& banks, | ||
| 383 | hipo::banklist::size_type& bank_idx, | ||
| 384 | std::string const& bank_name) noexcept(false) | ||
| 385 | { | ||
| 386 | // check if this bank is already present in `banks`, and set `m_created_bank_variant` accordingly | ||
| 387 |
2/2✓ Branch 14 → 3 taken 151 times.
✓ Branch 14 → 15 taken 33 times.
|
184 | for(auto& bank : banks) { |
| 388 |
4/4✓ Branch 6 → 7 taken 96 times.
✓ Branch 6 → 9 taken 55 times.
✓ Branch 11 → 12 taken 1 time.
✓ Branch 11 → 13 taken 150 times.
|
302 | if(bank.getSchema().getName() == bank_name) |
| 389 | 1 | m_created_bank_variant++; | |
| 390 | } | ||
| 391 | // create the schema, and add the new bank to `banks` | ||
| 392 | 33 | auto bank_schema = GetCreatedBankSchema(bank_name); | |
| 393 | 33 | bank_idx = banks.size(); | |
| 394 |
1/2✓ Branch 18 → 19 taken 33 times.
✗ Branch 18 → 20 not taken.
|
33 | banks.emplace_back(bank_schema, 0); |
| 395 | 33 | return bank_schema; | |
| 396 | ✗ | } | |
| 397 | |||
| 398 | /////////////////////////////////////////////////////////////////////////////// | ||
| 399 | |||
| 400 | ✗ | void Algorithm::ShowBanks(hipo::banklist const& banks, std::string_view message, Logger::Level const level) const | |
| 401 | { | ||
| 402 | ✗ | if(m_log->GetLevel() <= level) { | |
| 403 | ✗ | if(!message.empty()) | |
| 404 | ✗ | m_log->Print(level, message); | |
| 405 | ✗ | for(auto& bank : banks) | |
| 406 | ✗ | bank.show(); | |
| 407 | } | ||
| 408 | ✗ | } | |
| 409 | |||
| 410 | /////////////////////////////////////////////////////////////////////////////// | ||
| 411 | |||
| 412 | 81128 | void Algorithm::ShowBank(hipo::bank const& bank, std::string_view message, Logger::Level const level) const | |
| 413 | { | ||
| 414 |
1/2✗ Branch 3 → 4 not taken.
✓ Branch 3 → 7 taken 81128 times.
|
81128 | if(m_log->GetLevel() <= level) { |
| 415 | ✗ | if(!message.empty()) | |
| 416 | ✗ | m_log->Print(level, message); | |
| 417 | ✗ | bank.show(); | |
| 418 | } | ||
| 419 | 81128 | } | |
| 420 | |||
| 421 | /////////////////////////////////////////////////////////////////////////////// | ||
| 422 | |||
| 423 | template <typename OPTION_TYPE> | ||
| 424 | 520 | std::optional<OPTION_TYPE> Algorithm::GetCachedOption(std::string const& key) const | |
| 425 | { | ||
| 426 |
6/12std::optional<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > iguana::Algorithm::GetCachedOption<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const:
✗ Branch 2 → 3 not taken.
✓ Branch 2 → 4 taken 404 times.
std::optional<std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > iguana::Algorithm::GetCachedOption<std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const:
✗ Branch 2 → 3 not taken.
✓ Branch 2 → 4 taken 4 times.
std::optional<std::vector<double, std::allocator<double> > > iguana::Algorithm::GetCachedOption<std::vector<double, std::allocator<double> > >(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const:
✗ Branch 2 → 3 not taken.
✓ Branch 2 → 4 taken 28 times.
std::optional<std::vector<int, std::allocator<int> > > iguana::Algorithm::GetCachedOption<std::vector<int, std::allocator<int> > >(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const:
✗ Branch 2 → 3 not taken.
✓ Branch 2 → 4 taken 22 times.
std::optional<double> iguana::Algorithm::GetCachedOption<double>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const:
✗ Branch 2 → 3 not taken.
✓ Branch 2 → 4 taken 30 times.
std::optional<int> iguana::Algorithm::GetCachedOption<int>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const:
✗ Branch 2 → 3 not taken.
✓ Branch 2 → 4 taken 32 times.
|
520 | if(key == "") |
| 427 | ✗ | return {}; | |
| 428 |
8/12std::optional<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > iguana::Algorithm::GetCachedOption<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const:
✓ Branch 7 → 8 taken 27 times.
✓ Branch 7 → 14 taken 377 times.
std::optional<std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > iguana::Algorithm::GetCachedOption<std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const:
✗ Branch 7 → 8 not taken.
✓ Branch 7 → 12 taken 4 times.
std::optional<std::vector<double, std::allocator<double> > > iguana::Algorithm::GetCachedOption<std::vector<double, std::allocator<double> > >(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const:
✗ Branch 7 → 8 not taken.
✓ Branch 7 → 12 taken 28 times.
std::optional<std::vector<int, std::allocator<int> > > iguana::Algorithm::GetCachedOption<std::vector<int, std::allocator<int> > >(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const:
✓ Branch 7 → 8 taken 7 times.
✓ Branch 7 → 12 taken 15 times.
std::optional<double> iguana::Algorithm::GetCachedOption<double>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const:
✗ Branch 7 → 8 not taken.
✓ Branch 7 → 11 taken 30 times.
std::optional<int> iguana::Algorithm::GetCachedOption<int>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const:
✗ Branch 7 → 8 not taken.
✓ Branch 7 → 11 taken 32 times.
|
520 | if(auto it{m_option_cache.find(key)}; it != m_option_cache.end()) { |
| 429 | try { // get the expected type | ||
| 430 | ✗ | return std::get<OPTION_TYPE>(it->second); | |
| 431 | } | ||
| 432 |
1/12std::optional<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > iguana::Algorithm::GetCachedOption<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const:
✗ Branch 16 → 17 not taken.
✓ Branch 16 → 18 taken 4 times.
std::optional<std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > iguana::Algorithm::GetCachedOption<std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const:
✗ Branch 14 → 15 not taken.
✗ Branch 14 → 16 not taken.
std::optional<std::vector<double, std::allocator<double> > > iguana::Algorithm::GetCachedOption<std::vector<double, std::allocator<double> > >(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const:
✗ Branch 14 → 15 not taken.
✗ Branch 14 → 16 not taken.
std::optional<std::vector<int, std::allocator<int> > > iguana::Algorithm::GetCachedOption<std::vector<int, std::allocator<int> > >(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const:
✗ Branch 14 → 15 not taken.
✗ Branch 14 → 16 not taken.
std::optional<double> iguana::Algorithm::GetCachedOption<double>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const:
✗ Branch 13 → 14 not taken.
✗ Branch 13 → 15 not taken.
std::optional<int> iguana::Algorithm::GetCachedOption<int>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const:
✗ Branch 13 → 14 not taken.
✗ Branch 13 → 15 not taken.
|
8 | catch(std::bad_variant_access const& ex) { |
| 433 | 8 | auto printer = [&key, this](auto const& v) { | |
| 434 |
3/8✗ Branch 2 → 3 not taken.
✓ Branch 2 → 4 taken 4 times.
✓ Branch 5 → 6 taken 4 times.
✗ Branch 5 → 17 not taken.
✓ Branch 6 → 7 taken 4 times.
✗ Branch 6 → 9 not taken.
✗ Branch 17 → 18 not taken.
✗ Branch 17 → 20 not taken.
|
8 | m_log->Error("wrong type used in SetOption call for option {:?}; using its default value instead", key); |
| 435 | 4 | PrintOptionValue(key, v, Logger::Level::error, " USER"); | |
| 436 |
1/2✓ Branch 13 → 14 taken 4 times.
✗ Branch 13 → 16 not taken.
|
4 | if(m_log->GetLevel() > Logger::Level::debug) |
| 437 | 4 | m_log->Error("to see the actual option values used (and their types), set the log level to 'debug' or lower"); | |
| 438 | }; | ||
| 439 |
1/12std::optional<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > iguana::Algorithm::GetCachedOption<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const:
✓ Branch 19 → 20 taken 4 times.
✗ Branch 19 → 22 not taken.
std::optional<std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > iguana::Algorithm::GetCachedOption<std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const:
✗ Branch 17 → 18 not taken.
✗ Branch 17 → 20 not taken.
std::optional<std::vector<double, std::allocator<double> > > iguana::Algorithm::GetCachedOption<std::vector<double, std::allocator<double> > >(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const:
✗ Branch 17 → 18 not taken.
✗ Branch 17 → 20 not taken.
std::optional<std::vector<int, std::allocator<int> > > iguana::Algorithm::GetCachedOption<std::vector<int, std::allocator<int> > >(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const:
✗ Branch 17 → 18 not taken.
✗ Branch 17 → 20 not taken.
std::optional<double> iguana::Algorithm::GetCachedOption<double>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const:
✗ Branch 16 → 17 not taken.
✗ Branch 16 → 19 not taken.
std::optional<int> iguana::Algorithm::GetCachedOption<int>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const:
✗ Branch 16 → 17 not taken.
✗ Branch 16 → 19 not taken.
|
4 | std::visit(printer, it->second); |
| 440 | } | ||
| 441 | } | ||
| 442 | 490 | return {}; | |
| 443 | } | ||
| 444 | template std::optional<int> Algorithm::GetCachedOption(std::string const& key) const; | ||
| 445 | template std::optional<double> Algorithm::GetCachedOption(std::string const& key) const; | ||
| 446 | template std::optional<std::string> Algorithm::GetCachedOption(std::string const& key) const; | ||
| 447 | template std::optional<std::vector<int>> Algorithm::GetCachedOption(std::string const& key) const; | ||
| 448 | template std::optional<std::vector<double>> Algorithm::GetCachedOption(std::string const& key) const; | ||
| 449 | template std::optional<std::vector<std::string>> Algorithm::GetCachedOption(std::string const& key) const; | ||
| 450 | |||
| 451 | /////////////////////////////////////////////////////////////////////////////// | ||
| 452 | |||
| 453 | ✗ | void Algorithm::ThrowSinceRenamed(std::string const& new_name, std::string const& version) const noexcept(false) | |
| 454 | { | ||
| 455 | std::string new_path = new_name; | ||
| 456 | std::string::size_type it = 0; | ||
| 457 | ✗ | while((it = new_path.find("::", it)) != std::string::npos) | |
| 458 | ✗ | new_path.replace(it, 2, "/"); | |
| 459 | ✗ | m_log->Error("As of Iguana version {}, the algorithm {:?} has been renamed:", version, m_class_name); | |
| 460 | ✗ | m_log->Error("- the new name is: {:?}", new_name); | |
| 461 | ✗ | m_log->Error("- the new C++ header is: \"iguana/algorithms/{}/Algorithm.h\"", new_path); | |
| 462 | ✗ | m_log->Error("- please update your code (and custom configuration YAML, if you have one)"); | |
| 463 | ✗ | m_log->Error("- sorry for the inconvenience!"); | |
| 464 | ✗ | throw std::runtime_error("algorithm has been renamed"); | |
| 465 | } | ||
| 466 | |||
| 467 | } | ||
| 468 |