Nymph  v1.5.2
Flow-Based Data Processing Framework
KTException.hh
Go to the documentation of this file.
1 /*
2  * KTException.hh
3  *
4  * Created on: Feb 25, 2014
5  * Author: nsoblath
6  */
7 
8 
9 #ifndef KTEXCEPTION_HH_
10 #define KTEXCEPTION_HH_
11 
12 #include <exception>
13 #include <sstream>
14 #include <string>
15 
16 namespace Nymph
17 {
18 
19  class KTException :
20  public std::exception
21  {
22  public:
23  KTException();
24  KTException( const KTException& );
25  ~KTException() throw ();
26 
27  template< class XStreamable >
28  KTException& operator<<( XStreamable a_fragment );
29  KTException& operator<<( const std::string& a_fragment );
30  KTException& operator<<( const char* a_fragment );
31 
32  virtual const char* what() const throw();
33 
34  private:
35  std::string fException;
36  };
37 
38  template< class XStreamable >
39  KTException& KTException::operator<<( XStreamable a_fragment )
40  {
41  std::stringstream stream;
42  stream << a_fragment;
43  stream >> fException;
44  return *this;
45  }
46 
47  inline KTException& KTException::operator<<( const std::string& a_fragment )
48  {
49  fException += a_fragment;
50  return *this;
51  }
52 
53  inline KTException& KTException::operator<<( const char* a_fragment )
54  {
55  fException += std::string( a_fragment );
56  return *this;
57  }
58 
59 }
60 
61 #endif /* KTEXCEPTION_HH_ */
std::string fException
Definition: KTException.hh:35
virtual const char * what() const
Definition: KTException.cc:28
KTException & operator<<(XStreamable a_fragment)
Definition: KTException.hh:39