Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
LUPI::StatusMessageReporting Class Reference

#include <LUPI.hpp>

Public Types

enum class  Status { ok , info , warning , error }

Public Member Functions

 StatusMessageReporting ()
 ~StatusMessageReporting ()
statusMessageReportingsmr ()
bool isOk ()
bool isInfo ()
bool isWarning ()
bool isError ()
void clear ()
std::string constructMessage (std::string a_prefix, int a_reports=1, bool a_clear=false)
std::string constructFullMessage (std::string const &a_prefix, int a_reports=1, bool a_clear=false)

Detailed Description

Definition at line 100 of file LUPI.hpp.

Member Enumeration Documentation

◆ Status

Enumerator
ok 
info 
warning 
error 

Definition at line 103 of file LUPI.hpp.

103{ ok, info, warning, error };

Constructor & Destructor Documentation

◆ StatusMessageReporting()

LUPI::StatusMessageReporting::StatusMessageReporting ( )

Constructor for a StatusMessageReporting instance.

Definition at line 25 of file LUPI_statusMessageReporting.cc.

25 {
26
27 int status = smr_initialize( &m_smr, smr_status_Ok );
28
29 if( status != 0 ) throw( "StatusMessageReporting::StatusMessageReporting: Oops." ); // Currently, this should never happend.
30}
int smr_initialize(statusMessageReporting *smr, enum smr_status verbosity)

◆ ~StatusMessageReporting()

LUPI::StatusMessageReporting::~StatusMessageReporting ( )

Destructor for a StatusMessageReporting instance.

Definition at line 36 of file LUPI_statusMessageReporting.cc.

36 {
37
38 smr_release( &m_smr );
39}
void smr_release(statusMessageReporting *smr)

Member Function Documentation

◆ clear()

void LUPI::StatusMessageReporting::clear ( )
inline

Definition at line 117 of file LUPI.hpp.

117{ smr_release( &m_smr ); }

Referenced by constructFullMessage(), and constructMessage().

◆ constructFullMessage()

std::string LUPI::StatusMessageReporting::constructFullMessage ( std::string const & a_prefix,
int a_reports = 1,
bool a_clear = false )

Returns the first a_reports reports from m_smr with a_prefix appended to the beginning of the returned string.

Parameters
a_prefix[in] A string added to the beginning of the message.
a_report[in] The maximum number of reports to include in the message.
a_clear[in] If true, calls the clear() method after the message is constructed.

Definition at line 81 of file LUPI_statusMessageReporting.cc.

81 {
82
83 std::string message( a_prefix );
84 statusMessageReport const *report;
85
86 for( report = smr_firstReport( &m_smr ); report != NULL; report = smr_nextReport( report ), --a_reports ) {
87 if( a_reports == 0 ) break;
88
89 char *reportMessage = smr_copyFullMessage( report );
90 if( reportMessage != nullptr ) {
91 message += '\n';
92 message += reportMessage;
93 free( reportMessage );
94 }
95 }
96 if( a_clear ) clear( );
97
98 return( message );
99}
void free(voidpf ptr)
statusMessageReport const * smr_firstReport(statusMessageReporting const *smr)
struct statusMessageReport statusMessageReport
statusMessageReport const * smr_nextReport(statusMessageReport const *report)
char * smr_copyFullMessage(statusMessageReport const *report)

◆ constructMessage()

std::string LUPI::StatusMessageReporting::constructMessage ( std::string a_prefix,
int a_reports = 1,
bool a_clear = false )

Returns the first a_reports reports from m_smr with a_prefix appended to the beginning of the returned string.

Parameters
a_prefix[in] A string added to the beginning of the message.
a_report[in] The maximum number of reports to include in the message.
a_clear[in] If true, calls the clear() method after the message is constructed.

Definition at line 49 of file LUPI_statusMessageReporting.cc.

49 {
50
51 std::string sep( "" );
52 std::string message( a_prefix );
53 statusMessageReport const *report;
54
55 if( a_prefix == "" ) sep = "\n";
56
57 for( report = smr_firstReport( &m_smr ); report != NULL; report = smr_nextReport( report ), --a_reports ) {
58 if( a_reports == 0 ) break;
59
60 char *reportMessage = smr_copyMessage( report );
61 if( reportMessage != nullptr ) {
62 message += sep;
63 message += reportMessage;
64 free( reportMessage );
65 sep = "\n";
66 }
67 }
68 if( a_clear ) clear( );
69
70 return( message );
71}
char * smr_copyMessage(statusMessageReport const *report)

Referenced by GIDI::Functions::XYs1d::domainSlice(), GIDI::Functions::XYs1d::integrate(), GIDI::Functions::XYs1d::mapToXsAndAdd(), GIDI::Functions::XYs1d::normalize(), GIDI::Functions::XYs1d::operator*=(), GIDI::Functions::XYs1d::operator*=(), GIDI::Functions::XYs1d::operator+=(), GIDI::Functions::XYs1d::operator-=(), GIDI::Functions::XYs1d::operator=(), and GIDI::Functions::XYs1d::toXs_pdf_cdf1d().

◆ isError()

bool LUPI::StatusMessageReporting::isError ( )
inline

Definition at line 116 of file LUPI.hpp.

116{ return( smr_isError( &m_smr ) ); }
int smr_isError(statusMessageReporting const *smr)

◆ isInfo()

bool LUPI::StatusMessageReporting::isInfo ( )
inline

Definition at line 114 of file LUPI.hpp.

114{ return( smr_isInfo( &m_smr ) ); }
int smr_isInfo(statusMessageReporting const *smr)

◆ isOk()

bool LUPI::StatusMessageReporting::isOk ( )
inline

Definition at line 113 of file LUPI.hpp.

113{ return( smr_isOk( &m_smr ) ); }
int smr_isOk(statusMessageReporting const *smr)

◆ isWarning()

bool LUPI::StatusMessageReporting::isWarning ( )
inline

Definition at line 115 of file LUPI.hpp.

115{ return( smr_isWarning( &m_smr ) ); }
int smr_isWarning(statusMessageReporting const *smr)

◆ smr()


The documentation for this class was generated from the following files: