CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
triton_utils.cc
Go to the documentation of this file.
5 
6 #include <sstream>
7 #include <experimental/iterator>
8 
9 namespace triton_utils {
10 
11  template <typename C>
12  std::string printColl(const C& coll, const std::string& delim) {
13  if (coll.empty())
14  return "";
15  std::stringstream msg;
16  //avoid trailing delim
17  std::copy(std::begin(coll), std::end(coll), std::experimental::make_ostream_joiner(msg, delim));
18  return msg.str();
19  }
20 
21  void throwIfError(const Error& err, std::string_view msg) {
22  if (!err.IsOk())
23  throw TritonException("TritonFailure") << msg << (err.Message().empty() ? "" : ": " + err.Message());
24  }
25 } // namespace triton_utils
26 
27 template std::string triton_utils::printColl(const edm::Span<std::vector<int64_t>::const_iterator>& coll,
28  const std::string& delim);
29 template std::string triton_utils::printColl(const std::vector<uint8_t>& coll, const std::string& delim);
30 template std::string triton_utils::printColl(const std::vector<float>& coll, const std::string& delim);
31 template std::string triton_utils::printColl(const std::unordered_set<std::string>& coll, const std::string& delim);
void throwIfError(const Error &err, std::string_view msg)
Definition: triton_utils.cc:21
triton::client::Error Error
Definition: triton_utils.h:15
tuple msg
Definition: mps_check.py:285
Definition: Span.h:16
string end
Definition: dataset.py:937
std::string printColl(const C &coll, const std::string &delim=", ")
Definition: triton_utils.cc:12