Skip to content
Snippets Groups Projects
Commit 0474bc99 authored by Frank Winklmeier's avatar Frank Winklmeier Committed by Marco Clemencic
Browse files

Remove IssueSeverity support from StatusCode and release

parent 23ac55b4
No related branches found
No related tags found
No related merge requests found
Showing
with 16 additions and 494 deletions
......@@ -47,7 +47,6 @@ set(GaudiExamples_srcs
src/ColorMsg/ColorMsgAlg.cpp
src/History/History.cpp
src/THist/*.cpp
src/ErrorLog/ErrorLogTest.cpp
src/Maps/*.cpp
src/MultipleLogStreams/*.cpp
src/GaudiCommonTests/*.cpp
......
//##############################################################
// Job options file
//==============================================================
AuditorSvc.Auditors = { "ChronoAuditor" };
//--------------------------------------------------------------
//--------------------------------------------------------------
// Private Application Configuration options
//--------------------------------------------------------------
ApplicationMgr.TopAlg = { "ErrorLogTest" };
// Set output level threshold (2=DEBUG, 3=INFO, 4=WARNING, 5=ERROR, 6=FATAL )
MessageSvc.OutputLevel = 3;
MessageSvc.UseColors = true;
THistSvc.OutputLevel = 2;
ApplicationMgr.OutputLevel = 1;
ServiceManager.OutputLevel = 2;
// HistorySvc.Dump= true;
StatusCodeSvc.OutputLevel = 1;
// ApplicationMgr.CreateSvc = {"StatusCodeSvc", "THistSvc"};
//THistSvc.Output = {"new DATAFILE='tuple1.rt' TYP='ROOT' OPT='NEW'"};
IssueLogger.OutputLevel = 1;
IssueLogger.ReportLevel = "VERBOSE";
IssueLogger.TraceBackLevel = "FATAL";
IssueLogger.ShowTime = true;
IssueLogger.Output = {"DEBUG='MsgSvc'"};
IssueLogger.Output += {"WARNING='test.out'"};
IssueLogger.Output += {"ERROR='STDERR'"};
//--------------------------------------------------------------
// Event related parameters
//--------------------------------------------------------------
ApplicationMgr.EvtMax = 20;
ApplicationMgr.EvtSel = "NONE";
//--------------------------------------------------------------
// Other Service Options
//--------------------------------------------------------------
//ApplicationMgr.HistogramPersistency = "HBOOK";
//ApplicationMgr.HistogramPersistency = "ROOT";
//RootHistSvc.OutputFile = "histo.root";
//HbookHistSvc.OutputFile = "histo.hbook";
// Include files
#include "ErrorLogTest.h"
#include "GaudiKernel/MsgStream.h"
#include "GaudiKernel/RndmGenerators.h"
#include "GaudiKernel/IssueSeverity.h"
DECLARE_COMPONENT( ErrorLogTest )
//------------------------------------------------------------------------------
ErrorLogTest::ErrorLogTest( const std::string& name, ISvcLocator* pSvcLocator ) : Algorithm( name, pSvcLocator )
//------------------------------------------------------------------------------
{
}
//------------------------------------------------------------------------------
StatusCode ErrorLogTest::initialize()
//------------------------------------------------------------------------------
{
// if (service("THistSvc",m_ths).isFailure()) {
// error() << "Couldn't get THistSvc" << endmsg;
// return StatusCode::FAILURE;
// }
IssueSeverity err0 = ISSUE( IssueSeverity::ERROR, "ERROR level ErrObj" );
IssueSeverity war = ISSUE( IssueSeverity::WARNING, "this is a warning" );
IssueSeverity fat = ISSUE( IssueSeverity::FATAL, "this is a fatal" );
// StatusCode sc(StatusCode::SUCCESS, ISSUE(IssueSeverity::DEBUG,"debug3 ErrObj"));
StatusCode sc = STATUSCODE( StatusCode::SUCCESS, IssueSeverity::DEBUG, "debug" );
StatusCode sc2( ISSUE( IssueSeverity::INFO, "info ErrObj" ) );
return sc2;
}
//------------------------------------------------------------------------------
StatusCode ErrorLogTest::execute()
//------------------------------------------------------------------------------
{
ISSUE( IssueSeverity::WARNING, "warning level ErrObj in execute" );
return StatusCode::SUCCESS;
}
//------------------------------------------------------------------------------
StatusCode ErrorLogTest::finalize()
//------------------------------------------------------------------------------
{
warning() << "Finalizing..." << endmsg;
return StatusCode::SUCCESS;
}
#ifndef GAUDIEXAMPLE_ERRORLOGTEST_H
#define GAUDIEXAMPLE_ERRORLOGTEST_H 1
// Include files
#include "GaudiKernel/Algorithm.h"
class ErrorLogTest : public Algorithm
{
public:
// Constructor of this form must be provided
ErrorLogTest( const std::string& name, ISvcLocator* pSvcLocator );
// Three mandatory member functions of any algorithm
StatusCode initialize() override;
StatusCode execute() override;
StatusCode finalize() override;
private:
};
#endif //
<?xml version="1.0" ?><!DOCTYPE extension PUBLIC '-//QM/2.3/Extension//EN' 'http://www.codesourcery.com/qm/dtds/2.3/-//qm/2.3/extension//en.dtd'>
<extension class="GaudiTest.GaudiExeTest" kind="test">
<argument name="args"><set><text>$GAUDIEXAMPLESROOT/options/ErrorLog.opts</text></set></argument>
<argument name="use_temp_dir"><enumeral>true</enumeral></argument>
<argument name="reference"><text>refs/ErrorLog.ref</text></argument>
<argument name="error_reference"><text>refs/ErrorLog_err.ref</text></argument>
<argument name="validator"><text>
# Normalize the filename in the output of the test
preproc = (normalizeExamples +
LineSkipper(["0 local"],
regexps=[r"0x[0-9a-fA-F#]+ *(Algorithm::sysI|ErrorLogTest::i)nitialize\(\) *\[",
r"0x[0-9a-fA-F#]+ *void std::(call_once|__once_call_impl)&lt;",
r"0x[0-9a-fA-F#]* *(__gxx_personality_v0|pthread_once|_start|main) *\["]) +
RegexpReplacer(r"(?&lt;=\s)\S+ErrorLogTest\.cpp:", "ErrorLogTest.cpp:", "ErrorLogTest.cpp:") +
RegexpReplacer(r"\[.*/([^/]*.*)\]", r"[\1]", r"^#[0-9]+ +0x########") + # normalize paths to libraries
RegexpReplacer(r"^#[0-9]+ +", r"#N ", "^#[0-9]+ +0x########") # normalize stack levels count
)
validateWithReference(preproc = preproc)
</text></argument>
</extension>
JobOptionsSvc INFO # =======> Gaudi/GaudiExamples/options/ErrorLog.opts
JobOptionsSvc INFO # (5,1): AuditorSvc.Auditors = ["ChronoAuditor"]
JobOptionsSvc INFO # (12,1): ApplicationMgr.TopAlg = ["ErrorLogTest"]
JobOptionsSvc INFO # (15,1): MessageSvc.OutputLevel = 3
JobOptionsSvc INFO # (16,1): MessageSvc.UseColors = 1
JobOptionsSvc INFO # (17,1): THistSvc.OutputLevel = 2
JobOptionsSvc INFO # (18,1): ApplicationMgr.OutputLevel = 1
JobOptionsSvc INFO # (19,1): ServiceManager.OutputLevel = 2
JobOptionsSvc INFO # (21,1): StatusCodeSvc.OutputLevel = 1
JobOptionsSvc INFO # (30,1): IssueLogger.OutputLevel = 1
JobOptionsSvc INFO # (31,1): IssueLogger.ReportLevel = "VERBOSE"
JobOptionsSvc INFO # (32,1): IssueLogger.TraceBackLevel = "FATAL"
JobOptionsSvc INFO # (33,1): IssueLogger.ShowTime = 1
JobOptionsSvc INFO # (35,1): IssueLogger.Output = ["DEBUG='MsgSvc'"]
JobOptionsSvc INFO # (36,1): IssueLogger.Output += ["WARNING='test.out'"]
JobOptionsSvc INFO # (37,1): IssueLogger.Output += ["ERROR='STDERR'"]
JobOptionsSvc INFO # (43,1): ApplicationMgr.EvtMax = 20
JobOptionsSvc INFO # (44,1): ApplicationMgr.EvtSel = "NONE"
JobOptionsSvc INFO Job options successfully read in from Gaudi/GaudiExamples/options/ErrorLog.opts
ApplicationMgr SUCCESS
====================================================================================================================================
Welcome to ApplicationMgr (GaudiCoreSvc v28r1)
running on pclhcb117 on Mon Dec 19 17:34:53 2016
====================================================================================================================================
ApplicationMgr VERBOSE declareMultiSvcType: declared service EvtDataSvc/EventDataSvc
ApplicationMgr VERBOSE declareMultiSvcType: declared service DetDataSvc/DetectorDataSvc
ApplicationMgr VERBOSE declareMultiSvcType: declared service HistogramSvc/HistogramDataSvc
ApplicationMgr VERBOSE declareMultiSvcType: declared service HbookCnv::PersSvc/HbookHistSvc
ApplicationMgr VERBOSE declareMultiSvcType: declared service RootHistCnv::PersSvc/RootHistSvc
ApplicationMgr VERBOSE declareMultiSvcType: declared service EvtPersistencySvc/EventPersistencySvc
ApplicationMgr VERBOSE declareMultiSvcType: declared service DetPersistencySvc/DetectorPersistencySvc
ApplicationMgr VERBOSE declareMultiSvcType: declared service HistogramPersistencySvc/HistogramPersistencySvc
ApplicationMgr DEBUG Loading declared DLL's
ApplicationMgr VERBOSE addMultiSvc: added service EventLoopMgr/EventLoopMgr
ApplicationMgr INFO Application Manager Configured successfully
IssueLogger DEBUG Property update for OutputLevel : new value = 1
IssueLogger DEBUG Service base class initialized successfully
IssueLogger DEBUG Writing VERBOSE issues to MsgStream
IssueLogger DEBUG Writing DEBUG1 issues to MsgStream
IssueLogger DEBUG Writing DEBUG2 issues to MsgStream
IssueLogger DEBUG Writing DEBUG3 issues to MsgStream
IssueLogger DEBUG Writing INFO issues to MsgStream
IssueLogger DEBUG Writing RECOVERABLE issues to MsgStream
IssueLogger DEBUG Writing FATAL issues to MsgStream
IssueLogger DEBUG Writing ALWAYS issues to MsgStream
IssueLogger FATAL FATAL ErrorLogTest.cpp:29 "this is a fatal" [17:34:53 2016/12/19 CET]
#1 0x7fa2c8cb6260 MinimalEventLoopMgr::initialize() [libGaudiKernel.so]
#2 0x7fa2c4695980 EventLoopMgr::initialize() [libGaudiCoreSvc.so]
#3 0x7fa2c8c32500 Service::sysInitialize_imp() [libGaudiKernel.so]
#4 0 local [/lib/x86_64-linux-gnu/libpthread.so.0]
#5 0x7fa2c8c2f910 Service::sysInitialize() [libGaudiKernel.so]
#6 0x7fa2c469e100 ServiceManager::initialize() [libGaudiCoreSvc.so]
#7 0x7fa2c465f290 ApplicationMgr::initialize() [libGaudiCoreSvc.so]
#8 0x7fa2c465b790 ApplicationMgr::GoToState(Gaudi::StateMachine::State, bool) [libGaudiCoreSvc.so]
#9 0x7fa2c465b790 ApplicationMgr::GoToState(Gaudi::StateMachine::State, bool) [libGaudiCoreSvc.so]
#10 0x7fa2c465c970 ApplicationMgr::run() [libGaudiCoreSvc.so]
#11 0x7fa2c8b5e8f0 GaudiMain [libGaudiKernel.so]
#12 0x7fa2c8524740 __libc_start_main [libc.so.6]
#13 0x400800 _start [Gaudi.exe]

IssueLogger INFO INFO ErrorLogTest.cpp:35 "info ErrObj" [17:34:53 2016/12/19 CET]
EventLoopMgr WARNING Unable to locate service "EventSelector" 
EventLoopMgr WARNING No events will be processed from external input.
HistogramPersis...WARNING Histograms saving not required.
ApplicationMgr INFO Application Manager Initialized successfully
ApplicationMgr INFO Application Manager Started successfully
ApplicationMgr INFO Application Manager Stopped successfully
ErrorLogTest WARNING Finalizing...
EventLoopMgr INFO Histograms converted successfully according to request.
IssueLogger DEBUG IssueLogger::finalize
ApplicationMgr INFO Application Manager Finalized successfully
ApplicationMgr INFO Application Manager Terminated successfully
JobOptionsSvc INFO # =======> D:/Profiles/clemenci/cmtuser/Gaudi/GaudiExamples/options/ErrorLog.opts)
JobOptionsSvc INFO # (5,1): AuditorSvc.Auditors = ["ChronoAuditor"]
JobOptionsSvc INFO # (12,1): ApplicationMgr.TopAlg = ["ErrorLogTest"]
JobOptionsSvc INFO # (15,1): MessageSvc.OutputLevel = 3
JobOptionsSvc INFO # (16,1): MessageSvc.UseColors = 1
JobOptionsSvc INFO # (17,1): THistSvc.OutputLevel = 2
JobOptionsSvc INFO # (18,1): ApplicationMgr.OutputLevel = 1
JobOptionsSvc INFO # (19,1): ServiceManager.OutputLevel = 2
JobOptionsSvc INFO # (21,1): StatusCodeSvc.OutputLevel = 1
JobOptionsSvc INFO # (30,1): IssueLogger.OutputLevel = 1
JobOptionsSvc INFO # (31,1): IssueLogger.ReportLevel = "VERBOSE"
JobOptionsSvc INFO # (32,1): IssueLogger.TraceBackLevel = "FATAL"
JobOptionsSvc INFO # (33,1): IssueLogger.ShowTime = 1
JobOptionsSvc INFO # (35,1): IssueLogger.Output = ["DEBUG='MsgSvc'"]
JobOptionsSvc INFO # (36,1): IssueLogger.Output += ["WARNING='test.out'"]
JobOptionsSvc INFO # (37,1): IssueLogger.Output += ["ERROR='STDERR'"]
JobOptionsSvc INFO # (43,1): ApplicationMgr.EvtMax = 20
JobOptionsSvc INFO # (44,1): ApplicationMgr.EvtSel = "NONE"
JobOptionsSvc INFO Job options successfully read in from D:\Profiles\clemenci\cmtuser\Gaudi\GaudiExamples\options\ErrorLog.opts
ApplicationMgr SUCCESS
====================================================================================================================================
Welcome to ApplicationMgr $Revision: 1.77 $
running on CERNTSLHCB05 on 08/16/11 13:57:26
====================================================================================================================================
ApplicationMgr VERBOSE declareMultiSvcType: declared service EvtDataSvc/EventDataSvc
ApplicationMgr VERBOSE declareMultiSvcType: declared service DetDataSvc/DetectorDataSvc
ApplicationMgr VERBOSE declareMultiSvcType: declared service HistogramSvc/HistogramDataSvc
ApplicationMgr VERBOSE declareMultiSvcType: declared service HbookCnv::PersSvc/HbookHistSvc
ApplicationMgr VERBOSE declareMultiSvcType: declared service RootHistCnv::PersSvc/RootHistSvc
ApplicationMgr VERBOSE declareMultiSvcType: declared service EvtPersistencySvc/EventPersistencySvc
ApplicationMgr VERBOSE declareMultiSvcType: declared service DetPersistencySvc/DetectorPersistencySvc
ApplicationMgr VERBOSE declareMultiSvcType: declared service HistogramPersistencySvc/HistogramPersistencySvc
ApplicationMgr DEBUG Loading declared DLL's
ApplicationMgr VERBOSE addMultiSvc: added service EventLoopMgr/EventLoopMgr
ApplicationMgr INFO Application Manager Configured successfully
IssueLogger DEBUG Service base class initialized successfully
IssueLogger DEBUG Writing VERBOSE issues to MsgStream
IssueLogger DEBUG Writing DEBUG1 issues to MsgStream
IssueLogger DEBUG Writing DEBUG2 issues to MsgStream
IssueLogger DEBUG Writing DEBUG3 issues to MsgStream
IssueLogger DEBUG Writing INFO issues to MsgStream
IssueLogger DEBUG Writing RECOVERABLE issues to MsgStream
IssueLogger DEBUG Writing FATAL issues to MsgStream
IssueLogger DEBUG Writing ALWAYS issues to MsgStream
IssueLogger FATAL FATAL ..\src\ErrorLog\ErrorLogTest.cpp:38 "this is a fatal" [13:57:26 2011/08/16 W. Europe Daylight Time]
IssueLogger INFO INFO ..\src\ErrorLog\ErrorLogTest.cpp:44 "info ErrObj" [13:57:26 2011/08/16 W. Europe Daylight Time]
EventLoopMgr WARNING Unable to locate service "EventSelector"
EventLoopMgr WARNING No events will be processed from external input.
HistogramPersis...WARNING Histograms saving not required.
ApplicationMgr INFO Application Manager Initialized successfully
ApplicationMgr INFO Application Manager Started successfully
ApplicationMgr INFO Application Manager Stopped successfully
ErrorLogTest WARNING Finalizing...
EventLoopMgr INFO Histograms converted successfully according to request.
IssueLogger DEBUG IssueLogger::finalize
ApplicationMgr INFO Application Manager Finalized successfully
ApplicationMgr INFO Application Manager Terminated successfully
ERROR ../src/ErrorLog/ErrorLogTest.cpp:27 "ERROR level ErrObj" [00:00:00 1970-01-01 CEST]
ERROR ..\src\ErrorLog\ErrorLogTest.cpp:36 "ERROR level ErrObj" [14:38:30 2011/08/16 W. Europe Daylight Time]
......@@ -12,6 +12,8 @@
#include "CLHEP/GenericFunctions/AbsFunction.hh"
// ============================================================================
#include <memory>
#if defined( __clang__ ) || defined( __CLING__ )
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winconsistent-missing-override"
......
......@@ -145,7 +145,7 @@ gaudi_add_unit_test(test_PropertyHolder tests/src/test_PropertyHolder.cpp
gaudi_add_unit_test(test_Property tests/src/test_Property.cpp
LINK_LIBRARIES GaudiKernel
TYPE Boost)
gaudi_add_unit_test(test_IssueSeverity tests/src/test_IssueSeverity.cpp
gaudi_add_unit_test(test_StatusCode tests/src/test_StatusCode.cpp
LINK_LIBRARIES GaudiKernel
TYPE Boost)
gaudi_add_unit_test(test_SystemTypeinfoName tests/src/test_SystemTypeinfoName.cpp
......
......@@ -7,6 +7,7 @@
class AlgTool;
class JobHistory;
#include <memory>
#include <string>
#include <vector>
......
......@@ -6,6 +6,7 @@
#include "GaudiKernel/StatusCode.h"
// STL includes
#include <memory>
#include <ostream>
#include <string>
......
#ifndef GAUDIKERNEL_IISSUELOGGER_H
#define GAUDIKERNEL_IISSUELOGGER_H
#include "GaudiKernel/IService.h"
#include "GaudiKernel/IssueSeverity.h"
#include <string>
class GAUDI_API IIssueLogger : virtual public IService
{
public:
/// InterfaceID
DeclareInterfaceID( IIssueLogger, 2, 0 );
virtual void report( IssueSeverity::Level level, const std::string& msg, const std::string& origin ) = 0;
virtual void report( const IssueSeverity& err ) = 0;
};
#endif
#ifndef GAUDIKERNEL_ISSUESEVERITY_H
#define GAUDIKERNEL_ISSUESEVERITY_H 1
class StatusCode;
#include <iostream>
#include <map>
#include <string>
#include "GaudiKernel/Kernel.h"
#define ISSUE( x, y ) IssueSeverity( x, __LINE__, __FILE__, y )
#define STATUSCODE( z, x, y ) StatusCode( z, ISSUE( x, y ) )
class IIssueLogger;
#ifdef _WIN32
#ifdef ERROR
#undef ERROR
#endif
#endif
class GAUDI_API IssueSeverity final
{
public:
enum Level {
NIL = 0,
VERBOSE,
DEBUG,
DEBUG1,
DEBUG2,
DEBUG3,
INFO,
WARNING,
RECOVERABLE,
ERROR,
FATAL,
ALWAYS,
NUM_LEVELS
};
IssueSeverity() {}
IssueSeverity( IssueSeverity::Level level, int line, std::string file, std::string msg = "" );
IssueSeverity( IssueSeverity::Level level, std::string msg = "" );
IssueSeverity( const IssueSeverity& ) = delete;
IssueSeverity& operator=( const IssueSeverity& ) = delete;
IssueSeverity( IssueSeverity&& ) noexcept;
IssueSeverity& operator=( IssueSeverity&& ) noexcept;
~IssueSeverity();
void setLevel( const IssueSeverity::Level& l ) { m_level = l; }
void setMsg( std::string m ) { m_msg = std::move( m ); }
IssueSeverity::Level getLevel() const { return m_level; }
std::string getMsg() const { return m_msg; }
std::string getOrigin() const;
void report();
friend inline std::ostream& operator<<( std::ostream&, const IssueSeverity& );
private:
std::string m_file;
std::string m_msg;
int m_line = 0;
IssueSeverity::Level m_level = IssueSeverity::NIL;
bool m_reported = true;
static bool m_init;
static IIssueLogger* m_ers;
};
inline IssueSeverity::IssueSeverity( IssueSeverity::Level level, int line, std::string file, std::string msg )
: m_file( std::move( file ) ), m_msg( std::move( msg ) ), m_line( line ), m_level( level ), m_reported( false )
{
report();
}
inline IssueSeverity::IssueSeverity( IssueSeverity::Level level, std::string msg )
: IssueSeverity( std::move( level ), 0, "??", std::move( msg ) )
{
}
inline IssueSeverity::IssueSeverity( IssueSeverity&& rhs ) noexcept
{
m_file = std::move( rhs.m_file );
m_msg = std::move( rhs.m_msg );
m_line = rhs.m_line;
m_level = rhs.m_level;
m_reported = std::exchange( rhs.m_reported, true );
}
inline IssueSeverity& IssueSeverity::operator=( IssueSeverity&& rhs ) noexcept
{
m_file = std::move( rhs.m_file );
m_msg = std::move( rhs.m_msg );
m_line = rhs.m_line;
m_level = rhs.m_level;
m_reported = std::exchange( rhs.m_reported, true );
return *this;
}
std::ostream& operator<<( std::ostream& os, const IssueSeverity& rhs )
{
os << "ISSUE: level " << rhs.getLevel() << " from: " << rhs.getOrigin() << " msg: " << rhs.getMsg();
return os;
}
#endif
......@@ -2,12 +2,10 @@
#define GAUDIKERNEL_STATUSCODE_H
#include <ostream>
#include <utility>
#include "GaudiKernel/IssueSeverity.h"
#include "GaudiKernel/Kernel.h"
#include <memory>
/**
* @class StatusCode StatusCode.h GaudiKernel/StatusCode.h
*
......@@ -33,35 +31,12 @@ public:
/// Constructor.
StatusCode() = default;
StatusCode( unsigned long code, IssueSeverity&& sev ) : d_code( code )
{
try { // ensure that we do not throw even if we cannot move the severity
m_severity = std::make_shared<const IssueSeverity>( std::move( sev ) );
} catch ( ... ) {
}
}
StatusCode( IssueSeverity&& is )
: StatusCode( is.getLevel() == IssueSeverity::RECOVERABLE
? StatusCode::RECOVERABLE
: ( is.getLevel() < IssueSeverity::ERROR ? StatusCode::SUCCESS : StatusCode::FAILURE ),
std::move( is ) )
{
}
StatusCode( unsigned long code, bool checked = false ) : d_code( code ), m_checked( checked ) {}
StatusCode( const StatusCode& rhs ) : d_code( rhs.d_code ), m_checked( rhs.m_checked ), m_severity( rhs.m_severity )
{
rhs.m_checked = true;
}
StatusCode( const StatusCode& rhs ) : d_code( rhs.d_code ), m_checked( rhs.m_checked ) { rhs.m_checked = true; }
/// Move constructor.
StatusCode( StatusCode&& rhs ) noexcept
: d_code( rhs.d_code ), m_checked( rhs.m_checked ), m_severity( std::move( rhs.m_severity ) )
{
rhs.m_checked = true;
}
StatusCode( StatusCode&& rhs ) noexcept : d_code( rhs.d_code ), m_checked( rhs.m_checked ) { rhs.m_checked = true; }
/// Destructor.
~StatusCode()
......@@ -108,12 +83,12 @@ public:
void setChecked() const { m_checked = true; }
void ignore() const { setChecked(); }
/// Has the StatusCode been checked?
bool checked() const { return m_checked; }
/// Cast operator.
operator unsigned long() const { return getCode(); }
/// Severity
GAUDI_API const IssueSeverity& severity() const;
/// Assignment operator.
StatusCode& operator=( unsigned long value )
{
......@@ -122,11 +97,8 @@ public:
}
StatusCode& operator=( const StatusCode& rhs )
{
if ( this == &rhs ) return *this; // Protection against self-assignment
d_code = rhs.d_code;
m_checked = rhs.m_checked;
rhs.m_checked = true;
m_severity = rhs.m_severity;
d_code = rhs.d_code;
m_checked = std::exchange( rhs.m_checked, true );
return *this;
}
......@@ -179,9 +151,8 @@ public:
protected:
/// The status code.
unsigned long d_code = SUCCESS; ///< The status code
mutable bool m_checked = false; ///< If the Status code has been checked
std::shared_ptr<const IssueSeverity> m_severity; ///< Pointer to a IssueSeverity
unsigned long d_code = SUCCESS; ///< The status code
mutable bool m_checked = false; ///< If the Status code has been checked
static bool s_checking; ///< Global flag to control if StatusCode need to be checked
......
......@@ -64,7 +64,6 @@
#include "GaudiKernel/IInspectable.h"
#include "GaudiKernel/IInspector.h"
#include "GaudiKernel/IInterface.h"
#include "GaudiKernel/IIssueLogger.h"
#include "GaudiKernel/IJobOptionsSvc.h"
#include "GaudiKernel/IMagneticFieldSvc.h"
#include "GaudiKernel/IMessageSvc.h"
......
......@@ -4,7 +4,6 @@
<class pattern="DataObjectHandle*"/>
<!-- Base classes in GaudiKernel -->
<class name="IssueSeverity"/>
<class name="StatusCode"/>
<class name="Gaudi::Details::PropertyBase">
<field name="m_typeinfo" transient="true"/>
......@@ -72,7 +71,6 @@
<class name="IInspector"/>
<class name="IInterface"/>
<class name="InterfaceID"/>
<class name="IIssueLogger"/>
<class name="IJobOptionsSvc"/>
<class name="IMagneticFieldSvc"/>
<class name="IMessageSvc"/>
......
......@@ -2,6 +2,7 @@
#include "GaudiKernel/DataHandle.h"
#include "GaudiKernel/DataObjID.h"
#include "GaudiKernel/IDataHandleHolder.h"
#include <functional>
#include <tuple>
#include <typeinfo>
......
#define GAUDIKERNEL_ISSUESEVERITY_CPP 1
#include "GaudiKernel/IssueSeverity.h"
#include "GaudiKernel/Bootstrap.h"
#include "GaudiKernel/IIssueLogger.h"
#include "GaudiKernel/ISvcLocator.h"
#include "GaudiKernel/StatusCode.h"
#include "GaudiKernel/System.h"
#include <sstream>
bool IssueSeverity::m_init( false );
IIssueLogger* IssueSeverity::m_ers( nullptr );
IssueSeverity::~IssueSeverity()
{
if ( !m_reported ) {
report();
}
}
void IssueSeverity::report()
{
if ( !m_init ) {
m_init = true;
m_ers = Gaudi::svcLocator()->service<IIssueLogger>( "IssueLogger" ).get();
}
if ( m_ers ) {
m_ers->report( *this );
} else {
std::cerr << *this << std::endl;
}
m_reported = true;
}
std::string IssueSeverity::getOrigin() const { return m_file + ":" + std::to_string( m_line ); }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment