LCIO  "2.7.4"
 All Classes Namespaces Functions Variables Typedefs Friends Pages
Exceptions.h
1 #ifndef LCIO_EXCEPTION_H
2 #define LCIO_EXCEPTION_H 1
3 
4 #include <string>
5 #include <exception>
6 #include <stdexcept>
7 
8 // define some exceptions similar to the ones used in hep.lcd.io
9 // the exceptions should be part of the corresponding namespace
10 // even though they are not defined in the package (subdirectory)
11 // as these hold interfaces (abstract base classes) only ....
12 // hmmmm - does this make sence ?
13 
14 namespace EVENT {
15 
21  class Exception : public std::exception {
22 
23 
24  protected:
25  std::string message ;
26 
27  Exception(){ /*no_op*/ ; }
28 
29  public:
30  virtual ~Exception() throw() { /*no_op*/; }
31 
32  Exception( const std::string& text ){
33  message = "lcio::Exception: " + text ;
34  }
35 
36  virtual const char* what() const throw() { return message.c_str() ; }
37 
38  };
39 
44  class EventException : public Exception{
45 
46  protected:
47  EventException() { /*no_op*/ ; }
48  public:
49  virtual ~EventException() throw() { /*no_op*/; }
50 
51  EventException( std::string text ){
52  message = "lcio::EventException: " + text ;
53  }
54  };
55 
61 
62  public:
63  virtual ~DataNotAvailableException() throw() { /*no_op*/; }
64 
65  DataNotAvailableException( std::string text ) {
66  message = "lcio::DataNotAvailableException: " + text ;
67  }
68  };
69 
75 
76  public:
77  virtual ~ReadOnlyException() throw() { /*no_op*/; }
78 
79  ReadOnlyException( std::string text ){
80  message = "lcio::ReadOnlyException: " + text ;
81  }
82  };
83 
84 } // namespace
85 
86 namespace IO {
87 
92  class IOException : public EVENT::Exception{
93 
94  protected:
95  IOException() { /* no_op */ } ;
96 
97  public:
98  IOException( std::string text ){
99  message = "lcio::IOException: " + text ;
100  }
101  };
102 
103  // --- used only internally - switched back to null pointer at EOF ------
109  public:
110  virtual ~EndOfDataException() throw() { /*no_op*/; }
111 
112  EndOfDataException( std::string text ){
113  message = "lcio::EndOfDataException: " + text ;
114  }
115  };
116 
117 } // namespace
118 #endif /* ifndef LCIO_EXCEPTION_H */
Base exception class for LCIO - all other exceptions extend this.
Definition: Exceptions.h:21
EventException used for errors accessing the event data.
Definition: Exceptions.h:44
IOException used for reading/writing errors.
Definition: Exceptions.h:92
EventException used for data not available.
Definition: Exceptions.h:60
EndOfDataException for signaling the end of a data stream.
Definition: Exceptions.h:108
EventException used for signaling a 'read only exception'.
Definition: Exceptions.h:74