ATLAS Offline Software
Public Member Functions | Public Attributes | List of all members
RCU::Message Struct Reference

#include <Message.h>

Collaboration diagram for RCU::Message:

Public Member Functions

 Message ()
 effects: standard constructor guarantee: no-fail More...
 
void send () const
 effects: print the given message guarantee: basic failures: i/o errors More...
 

Public Attributes

const char * package
 description: the location where the message was send More...
 
const char * file
 
unsigned line
 
MessageType type
 description: the type of this message More...
 
const char * message
 description: the actual message we are sending or 0 if there isn't one More...
 

Detailed Description

Definition at line 25 of file PhysicsAnalysis/D3PDTools/RootCoreUtils/RootCoreUtils/Message.h.

Constructor & Destructor Documentation

◆ Message()

RCU::Message::Message ( )

effects: standard constructor guarantee: no-fail

Definition at line 30 of file Message.cxx.

32  : package (0), file (0), line (0), type (MESSAGE_UNSPECIFIED),
33  message (0)
34  {
35  }

Member Function Documentation

◆ send()

void RCU::Message::send ( ) const

effects: print the given message guarantee: basic failures: i/o errors

Definition at line 39 of file Message.cxx.

41  {
42  MessageType mytype = type;
43  if (mytype < 0 || mytype > MESSAGE_UNSPECIFIED)
44  mytype = MESSAGE_UNSPECIFIED;
45 
46  std::ostringstream str;
47 
48  if (package != 0)
49  {
50  str << package << ":";
51  }
52  if (file != 0)
53  {
54  if (strncmp (file, "../", 3) == 0)
55  str << (file+3) << ":";
56  else
57  str << file << ":";
58  }
59  if (line != 0)
60  str << line << ":";
61 
62  if (mytype != MESSAGE_UNSPECIFIED)
63  {
64  static const char * const type_names[MESSAGE_UNSPECIFIED] =
65  {"message", "warning", "error", "exception", "abort"};
66  str << type_names[mytype] << ":";
67  }
68 
69  if (!str.str().empty())
70  str << " ";
71  if (message != 0)
72  str << message;
73  else
74  str << "(null)";
75 
76  const char *envname = 0;
77  if (mytype == MESSAGE_ABORT)
78  envname = "ROOTCOREUTILS_ABORT";
79  else if (mytype == MESSAGE_EXCEPTION)
80  envname = "ROOTCOREUTILS_EXCEPTION";
81  if (envname)
82  {
83  const char *abort_type = getenv (envname);
84  const MessageType def_type = MESSAGE_EXCEPTION;
85 
86  if (abort_type == 0)
87  {
88  mytype = def_type;
89  } else if (strcmp (abort_type, "abort") == 0)
90  {
91  mytype = MESSAGE_ABORT;
92  } else if (strcmp (abort_type, "exception") == 0)
93  {
94  mytype = MESSAGE_EXCEPTION;
95  } else
96  {
97  mytype = def_type;
98 
99  RCU_WARN_MSG (std::string ("unknown value for ROOTCOREUTILS_ABORT ") + abort_type);
100  }
101  }
102 
103  std::cout << str.str() << std::endl;
104  if (mytype == MESSAGE_EXCEPTION)
105  throw ExceptionMsg (file, line, str.str());
106  if (mytype == MESSAGE_ABORT)
107  std::abort ();
108  }

Member Data Documentation

◆ file

const char* RCU::Message::file

◆ line

unsigned RCU::Message::line

◆ message

const char* RCU::Message::message

description: the actual message we are sending or 0 if there isn't one

Definition at line 46 of file PhysicsAnalysis/D3PDTools/RootCoreUtils/RootCoreUtils/Message.h.

◆ package

const char* RCU::Message::package

description: the location where the message was send

Definition at line 33 of file PhysicsAnalysis/D3PDTools/RootCoreUtils/RootCoreUtils/Message.h.

◆ type

MessageType RCU::Message::type

description: the type of this message

Definition at line 41 of file PhysicsAnalysis/D3PDTools/RootCoreUtils/RootCoreUtils/Message.h.


The documentation for this struct was generated from the following files:
RCU::Message::line
unsigned line
Definition: PhysicsAnalysis/D3PDTools/RootCoreUtils/RootCoreUtils/Message.h:37
RCU::MESSAGE_UNSPECIFIED
@ MESSAGE_UNSPECIFIED
description: unspecified message type
Definition: MessageType.h:41
RCU_WARN_MSG
#define RCU_WARN_MSG(message)
Definition: PrintMsg.h:52
RunTileMonitoring.type_names
type_names
Definition: RunTileMonitoring.py:293
RCU::MESSAGE_EXCEPTION
@ MESSAGE_EXCEPTION
description: send out an exception
Definition: MessageType.h:35
RCU::Message::type
MessageType type
description: the type of this message
Definition: PhysicsAnalysis/D3PDTools/RootCoreUtils/RootCoreUtils/Message.h:41
RCU::Message::file
const char * file
Definition: PhysicsAnalysis/D3PDTools/RootCoreUtils/RootCoreUtils/Message.h:35
RCU::Message::package
const char * package
description: the location where the message was send
Definition: PhysicsAnalysis/D3PDTools/RootCoreUtils/RootCoreUtils/Message.h:33
RCU::MessageType
MessageType
Definition: MessageType.h:24
SCT_ConditionsAlgorithms::CoveritySafe::getenv
std::string getenv(const std::string &variableName)
get an environment variable
Definition: SCT_ConditionsUtilities.cxx:17
python.CaloScaleNoiseConfig.str
str
Definition: CaloScaleNoiseConfig.py:78
RCU::MESSAGE_ABORT
@ MESSAGE_ABORT
description: print and abort
Definition: MessageType.h:38
RCU::Message::message
const char * message
description: the actual message we are sending or 0 if there isn't one
Definition: PhysicsAnalysis/D3PDTools/RootCoreUtils/RootCoreUtils/Message.h:46
str
Definition: BTagTrackIpAccessor.cxx:11