GENIEGenerator
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
InteractionException.h
Go to the documentation of this file.
1 //____________________________________________________________________________
2 /*!
3 
4 \class genie::exceptions::InteractionException
5 
6 \brief Exception used inside Interaction classes.
7 
8 \author Jeremy Wolcott <jwolcott \at fnal.gov>
9  Tufts University
10 
11 \created July 15, 2016
12 
13 \cpright Copyright (c) 2003-2024, The GENIE Collaboration
14  For the full text of the license visit http://copyright.genie-mc.org
15 */
16 //____________________________________________________________________________
17 
18 #ifndef INTERACTIONEXCEPTION_H_
19 #define INTERACTIONEXCEPTION_H_
20 
21 #include <exception>
22 #include <iostream>
23 #include <string>
24 
25 namespace genie
26 {
27  namespace exceptions
28  {
29  class InteractionException : public std::exception
30  {
31  public:
33  InteractionException (const std::string & reason);
34  ~InteractionException() throw() {};
35 
36  void Print (std::ostream & stream) const;
37  const std::string & ShowReason () const { return fReason; }
38 
39  // from std::exception
40  const char * what () const throw() { return this->fReason.c_str(); };
41 
42  friend std::ostream & operator << (std::ostream & stream, const InteractionException & exception);
43 
44  private:
45  std::string fReason;
46  }; /* class InteractionException */
47 
48  } /* namespace exceptions */
49 } /* namespace genie */
50 
51 std::ostream & operator<< (std::ostream& stream, const genie::exceptions::InteractionException & exc);
52 
53 #endif /* INTERACTIONEXCEPTION_H_ */
const std::string & ShowReason() const
Exception used inside Interaction classes.
ostream & operator<<(ostream &stream, const TClonesArray *particle_list)
Definition: gtestDecay.cxx:223
friend std::ostream & operator<<(std::ostream &stream, const InteractionException &exception)
void Print(std::ostream &stream) const