GslSvc.h
Go to the documentation of this file.
1 #ifndef GAUDIGSL_GSLSVC_H
2 #define GAUDIGSL_GSLSVC_H 1
3 // Include files
4 // STD & STL
5 #include <string>
6 #include <vector>
7 // GaudiKernel
8 #include "GaudiKernel/Service.h"
9 // Include files
10 // GaudiGSL
11 #include "GaudiGSL/GslError.h"
12 #include "GaudiGSL/IGslSvc.h"
13 
14 // forward declarations
15 class IGslErrorHandler; // from GaudiGSL
16 
83 class GslSvc : public extends<Service, IGslSvc>
84 {
85 public:
91  StatusCode handle( const GslError& error ) const override;
92 
97  GslErrorHandler handler() const override;
98 
104  GslErrorHandler setHandler( GslErrorHandler handler ) const override;
105 
111  StatusCode status( const int error ) const override;
112 
119  StatusCode initialize() override;
120 
127  StatusCode finalize() override;
128 
129  using extends::extends;
130 
132  ~GslSvc() override = default;
133 
134 private:
136  GslSvc();
138  GslSvc( const GslSvc& );
140  GslSvc& operator=( const GslSvc& );
141 
142 private:
143  Gaudi::Property<std::string> m_errorPolicy{this, "ErrorPolicy", "GSL", ""};
145  Gaudi::Property<std::vector<int>> m_ignore{this, "IgnoreCodes", {}, "codes to be ignored"};
146 
148  Handlers m_handlers;
149 };
150 
151 // ============================================================================
152 // The END
153 // ============================================================================
154 #endif // GAUDIGSL_GSLSVC_H
155 // ============================================================================
The abstract interface for arbitrary GSL error handler.
Gaudi::Property< std::string > m_errorPolicy
Definition: GslSvc.h:143
Gaudi::Property< std::vector< std::string > > m_handlersTypeNames
Definition: GslSvc.h:144
Helper class to represent GSL errors.
Definition: GslError.h:15
Implementation of property with value of concrete type.
Definition: Property.h:314
Gaudi::Property< std::vector< int > > m_ignore
Definition: GslSvc.h:145
StatusCode finalize() override
standard service finalization
Definition: GslSvc.cpp:120
GslErrorHandler setHandler(GslErrorHandler handler) const override
set new GSL error handler
Definition: GslSvc.cpp:152
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
StatusCode initialize() override
standard service initialization
Definition: GslSvc.cpp:37
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
GslSvc & operator=(const GslSvc &)
assignment operator is private
Handlers m_handlers
Definition: GslSvc.h:148
The implementation of IGslSvc interface.
Definition: GslSvc.h:83
std::vector< IGslErrorHandler * > Handlers
Definition: GslSvc.h:147
StatusCode handle(const GslError &error) const override
handle the GSL error
Definition: GslSvc.cpp:186
Base class used to extend a class implementing other interfaces.
Definition: extends.h:10
~GslSvc() override=default
destructor, virtual and protected
GslErrorHandler handler() const override
retrieve the current GSL error handler
Definition: GslSvc.cpp:137
GslSvc()
default constructor is private
StatusCode status(const int error) const override
transform GSL error code to Gaudi status code
Definition: GslSvc.cpp:170