Monarch  v3.8.2
Project 8 Data File Format Library
M2Exception.hh
Go to the documentation of this file.
1 #ifndef M2EXCEPTION_HH_
2 #define M2EXCEPTION_HH_
3 
4 #include <exception>
5 #include <sstream>
6 
7 namespace monarch2
8 {
9 
10  class M2Exception : public std::exception
11  {
12  public:
13  M2Exception();
14  M2Exception( const M2Exception& aCopy );
15  virtual ~M2Exception() throw();
16 
17  public:
18  virtual const char* what() const throw();
19 
20  template< class XType >
21  M2Exception& operator<< ( const XType& aReference )
22  {
23  std::stringstream tStream;
24  tStream << aReference;
25  fMessage += tStream.str();
26  return *this;
27  }
28 
29  private:
30  std::string fMessage;
31  };
32 
33 }
34 
35 #endif
virtual const char * what() const
Definition: M2Exception.cc:20
M2Exception & operator<<(const XType &aReference)
Definition: M2Exception.hh:21
std::string fMessage
Definition: M2Exception.hh:30