Monarch  v3.8.2
Project 8 Data File Format Library
M3Exception.hh
Go to the documentation of this file.
1 /*
2  * M3Exception.hh
3  *
4  * Created on: Dec 4, 2014
5  * Author: nsoblath
6  */
7 
8 #ifndef M3EXCEPTION_HH_
9 #define M3EXCEPTION_HH_
10 
11 #include "M3Constants.hh"
12 
13 #include <exception>
14 #include <string>
15 #include <sstream>
16 
17 namespace monarch3
18 {
19 
28  class M3_API M3Exception : public std::exception
29  {
30  public:
31  M3Exception();
32  M3Exception( const M3Exception& aCopy );
33  virtual ~M3Exception() throw();
34 
35  public:
36  virtual const char* what() const throw();
37 
38  template< class XType >
39  M3Exception& operator<< ( const XType& aReference )
40  {
41  std::stringstream tStream;
42  tStream << aReference;
43  fMessage += tStream.str();
44  return *this;
45  }
46 
47  private:
48  std::string fMessage;
49  };
50 
51 }
52 
53 #endif /* M3EXCEPTION_HH_ */
std::ostream & operator<<(std::ostream &out, const monarch3::M3StreamHeader &hdr)
Definition: M3Header.cc:695
Specialized exception class for Monarch3.
Definition: M3Exception.hh:28
std::string fMessage
Definition: M3Exception.hh:48
#define M3_API
Definition: M3Constants.hh:21