DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
exceptions.hpp
Go to the documentation of this file.
1// DUNE DAQ modification notice:
2// This file has been modified from the original ATLAS oks source for the DUNE DAQ project.
3// Fork baseline commit: oks-08-03-04 (2022-04-14).
4// Renamed since fork: yes (from oks/exceptions.h to include/oks/exceptions.hpp).
5
6#ifndef OKS_EXCEPTIONS_H
7#define OKS_EXCEPTIONS_H
8
9#include <exception>
10#include <iostream>
11#include <string>
12
13namespace dunedaq {
14namespace oks {
15
17
18class exception : public std::exception
19{
20
21private:
22 std::string p_what;
24
25public:
26 exception(const std::string& what_arg, int level_arg) noexcept;
27
28 virtual ~exception() noexcept {}
29
31
32 int level() const noexcept { return p_level; }
33
35
36 virtual const char* what() const noexcept { return p_what.c_str(); }
37};
38
39inline std::ostream&
40operator<<(std::ostream& s, const oks::exception& ex)
41{
42 s << ex.what();
43 return s;
44}
45
46void
47throw_validate_not_empty(const char* name);
48
50
51inline void
52validate_not_empty(const std::string& value, const char* name)
53{
54 if (value.empty())
56}
57} // namespace oks
58} // namespace dunedaq
59
60#endif
virtual ~exception() noexcept
virtual const char * what() const noexcept
int level() const noexcept
exception(const std::string &what_arg, int level_arg) noexcept
Definition xml.cpp:41
void validate_not_empty(const std::string &value, const char *name)
std::ostream & operator<<(std::ostream &s, const oks::exception &ex)
void throw_validate_not_empty(const char *name)
Definition xml.cpp:50
The DUNE-DAQ namespace.