ATLAS Offline Software
IOVCallbackError.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef IOVSVC_IOVCALLBACKERROR_H
6 #define IOVSVC_IOVCALLBACKERROR_H 1
7 
8 #include "GaudiKernel/MsgStream.h"
9 
10 #include <exception>
11 #include <string>
12 #include <iostream>
13 
14 class IOVCallbackError: virtual public std::exception {
15 
16  friend inline std::ostream& operator<< ( std::ostream& os ,
17  const IOVCallbackError& ge ) ;
18  friend inline std::ostream& operator<< ( std::ostream& os ,
19  const IOVCallbackError* pge ) ;
20  friend inline MsgStream& operator<< ( MsgStream& os ,
21  const IOVCallbackError& ge ) ;
22  friend inline MsgStream& operator<< ( MsgStream& os ,
23  const IOVCallbackError* pge ) ;
24 
25 public:
26  IOVCallbackError(const std::string& source):
27  m_src(source) { }
28 
29  virtual ~IOVCallbackError() throw() {}
30 
31  virtual const std::string& source() const {
32  return m_src;
33  }
34 
35  virtual std::ostream& printOut( std::ostream& os = std::cerr ) const {
36  os << "IOVCallbackError generated by " << source();
37  return os;
38  }
39 
40  virtual MsgStream& printOut( MsgStream& os ) const {
41  os << "IOVCallbackError generated by " << source();
42  return os;
43  }
44 
46  virtual const char* what () const throw() { return source().c_str() ; }
47 
48 private:
49  std::string m_src;
50 };
51 
53 std::ostream& operator<< ( std::ostream& os , const IOVCallbackError& ge ) {
54  return ge.printOut( os );
55 }
56 std::ostream& operator<< ( std::ostream& os , const IOVCallbackError* pge )
57 { return (0 == pge) ?
58  ( os << " IOVCallbackError* points to NULL!" ) : ( os << *pge ); }
59 
61 MsgStream& operator<< ( MsgStream& os , const IOVCallbackError& ge ) {
62  return ge.printOut( os );
63 }
65 MsgStream& operator<< ( MsgStream& os , const IOVCallbackError* pge ) {
66  return (0 == pge) ?
67  ( os << " IOVCallbackError* points to NULL!" ) : ( os << *pge );
68 }
69 
70 #endif
IOVCallbackError::printOut
virtual MsgStream & printOut(MsgStream &os) const
Definition: IOVCallbackError.h:40
operator<<
std::ostream & operator<<(std::ostream &os, const IOVCallbackError &ge)
overloaded printout to std::ostream
Definition: IOVCallbackError.h:53
IOVCallbackError::what
virtual const char * what() const
method from std::exception
Definition: IOVCallbackError.h:46
IOVCallbackError::operator<<
friend std::ostream & operator<<(std::ostream &os, const IOVCallbackError &ge)
overloaded printout to std::ostream
Definition: IOVCallbackError.h:53
calibdata.exception
exception
Definition: calibdata.py:496
ReadFromCoolCompare.os
os
Definition: ReadFromCoolCompare.py:231
IOVCallbackError::IOVCallbackError
IOVCallbackError(const std::string &source)
Definition: IOVCallbackError.h:26
IOVCallbackError
Definition: IOVCallbackError.h:14
IOVCallbackError::m_src
std::string m_src
Definition: IOVCallbackError.h:49
IOVCallbackError::printOut
virtual std::ostream & printOut(std::ostream &os=std::cerr) const
Definition: IOVCallbackError.h:35
IOVCallbackError::~IOVCallbackError
virtual ~IOVCallbackError()
Definition: IOVCallbackError.h:29
IOVCallbackError::source
virtual const std::string & source() const
Definition: IOVCallbackError.h:31