Jpp 19.3.0-rc.2
the software that should make you happy
Loading...
Searching...
No Matches
JDAQException.hh
Go to the documentation of this file.
1#ifndef __JDAQEXCEPTION__
2#define __JDAQEXCEPTION__
3
4#include <exception>
5#include <ostream>
6
7
8/**
9 * \author mdejong
10 */
11
12namespace KM3NETDAQ {
13
14
15 /**
16 * General exception
17 */
18 class JDAQException : public std::exception {
19 public:
20 /**
21 * Constructor.
22 *
23 * \param error error message
24 */
25 JDAQException(const std::string& error) :
26 std::exception(),
27 buffer(error)
28 {}
29
30
31 /**
32 * Destructor.
33 */
35 {}
36
37
38 /**
39 * Get error message.
40 *
41 * \return error message
42 */
43 virtual const char* what() const throw()
44 {
45 return buffer.c_str();
46 }
47
48
49 /**
50 * Print error message of JDAQException.
51 *
52 * \param out output stream
53 * \param exception exception
54 */
55 friend inline std::ostream& operator<<(std::ostream& out, const JDAQException& exception)
56 {
57 return out << exception.what();
58 }
59
60 private:
61 const std::string buffer;
62 };
63}
64
65#endif
General exception.
friend std::ostream & operator<<(std::ostream &out, const JDAQException &exception)
Print error message of JDAQException.
JDAQException(const std::string &error)
Constructor.
const std::string buffer
virtual const char * what() const
Get error message.
KM3NeT DAQ data structures and auxiliaries.
Definition DataQueue.cc:39