ATLAS Offline Software
Loading...
Searching...
No Matches
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
14class 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
25public:
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
48private:
49 std::string m_src;
50};
51
53std::ostream& operator<< ( std::ostream& os , const IOVCallbackError& ge ) {
54 return ge.printOut( os );
55}
56std::ostream& operator<< ( std::ostream& os , const IOVCallbackError* pge )
57{ return (0 == pge) ?
58 ( os << " IOVCallbackError* points to NULL!" ) : ( os << *pge ); }
59
61MsgStream& operator<< ( MsgStream& os , const IOVCallbackError& ge ) {
62 return ge.printOut( os );
63}
64
65MsgStream& operator<< ( MsgStream& os , const IOVCallbackError* pge ) {
66 return (0 == pge) ?
67 ( os << " IOVCallbackError* points to NULL!" ) : ( os << *pge );
68}
69
70#endif
std::ostream & operator<<(std::ostream &os, const IOVCallbackError &ge)
overloaded printout to std::ostream
virtual ~IOVCallbackError()
virtual const std::string & source() const
friend std::ostream & operator<<(std::ostream &os, const IOVCallbackError &ge)
overloaded printout to std::ostream
virtual std::ostream & printOut(std::ostream &os=std::cerr) const
virtual const char * what() const
method from std::exception
virtual MsgStream & printOut(MsgStream &os) const
IOVCallbackError(const std::string &source)