LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
check_nargs_for_bounded_sequences.cc
Go to the documentation of this file.
3 
4 #include <cstddef>
5 #include <string>
6 
7 void
9  std::size_t const expected,
10  std::size_t const nargs)
11 {
12  auto maybe_plural = [](std::size_t const nargs) {
13  return nargs == 1ull ? "" : "s";
14  };
15  auto has_or_have = [](std::size_t const nargs) {
16  return nargs == 1ull ? "has" : "have";
17  };
18  if (nargs != expected) {
19  std::ostringstream oss;
20  oss << '\n'
21  << nargs << " value" << maybe_plural(nargs) << ' ' << has_or_have(nargs)
22  << " been provided for the parameter with key:\n"
23  << " " << key << '\n'
24  << "which expects " << expected << " value" << maybe_plural(expected)
25  << '.';
26  throw detail::validationException{oss.str().c_str()};
27  }
28 }
void check_nargs_for_bounded_sequences(std::string const &key, std::size_t expected, std::size_t provided)