gem5  v20.1.0.0
sc_report.hh
Go to the documentation of this file.
1 /*
2  * Copyright 2018 Google, Inc.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are
6  * met: redistributions of source code must retain the above copyright
7  * notice, this list of conditions and the following disclaimer;
8  * redistributions in binary form must reproduce the above copyright
9  * notice, this list of conditions and the following disclaimer in the
10  * documentation and/or other materials provided with the distribution;
11  * neither the name of the copyright holders nor the names of its
12  * contributors may be used to endorse or promote products derived from
13  * this software without specific prior written permission.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
18  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
19  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
21  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26  */
27 
28 #ifndef __SYSTEMC_EXT_UTIL_SC_REPORT_HH__
29 #define __SYSTEMC_EXT_UTIL_SC_REPORT_HH__
30 
31 #include <exception>
32 #include <string>
33 
34 #include "../core/sc_time.hh"
35 
36 namespace sc_core
37 {
38 
40 {
41  SC_INFO = 0,
46 };
47 
49 {
50  SC_NONE = 0,
51  SC_LOW = 100,
52  SC_MEDIUM = 200,
53  SC_HIGH = 300,
54  SC_FULL = 400,
55  SC_DEBUG = 500
56 };
57 
58 class sc_report_handler;
59 
60 class sc_report : public std::exception
61 {
62  public:
63  sc_report(const sc_report &);
65  virtual ~sc_report() throw();
66 
67  sc_severity get_severity() const { return _severity; }
68  const char *get_msg_type() const { return _msgType; }
69  const char *get_msg() const { return _msg; }
70  int get_verbosity() const { return _verbosity; }
71  const char *get_file_name() const { return _fileName; }
72  int get_line_number() const { return _lineNumber; }
73 
74  const sc_time &get_time() const { return _time; }
75  const char *get_process_name() const { return _processName; }
76 
77  virtual const char *what() const throw();
78 
79  // Deprecated
80  static const char *get_message(int id);
81  static bool is_suppressed(int id);
82  static void make_warnings_errors(bool);
83  static void register_id(int id, const char *msg);
84  static void suppress_id(int id, bool); // Only for info or warning.
85  static void suppress_infos(bool);
86  static void suppress_warnings(bool);
87  int get_id() const { return _id; }
88 
89  private:
90  friend class sc_report_handler;
91 
93  const char *_msgType,
94  const char *_msg,
95  int _verbosity,
96  const char *_fileName,
97  int _lineNumber,
98  sc_time _time,
99  const char *_processName,
100  int _id);
101 
103  const char *_msgType;
104  const char *_msg;
106  const char *_fileName;
109  const char *_processName;
110  int _id;
111  std::string _what;
112 };
113 
114 // A non-standard function the Accellera datatypes rely on.
115 [[noreturn]] void sc_abort();
116 
117 } // namespace sc_core
118 
119 #endif //__SYSTEMC_EXT_UTIL_SC_REPORT_HH__
sc_core::SC_INFO
@ SC_INFO
Definition: sc_report.hh:41
sc_core::SC_WARNING
@ SC_WARNING
Definition: sc_report.hh:42
sc_core::sc_report::~sc_report
virtual ~sc_report()
Definition: sc_report.cc:75
sc_core::sc_severity
sc_severity
Definition: sc_report.hh:39
sc_core::sc_report::_msgType
const char * _msgType
Definition: sc_report.hh:103
sc_core::sc_report::_fileName
const char * _fileName
Definition: sc_report.hh:106
sc_core::sc_report::suppress_warnings
static void suppress_warnings(bool)
Definition: sc_report.cc:167
sc_core::sc_report::_msg
const char * _msg
Definition: sc_report.hh:104
sc_core
Definition: messages.cc:31
sc_core::sc_report::get_process_name
const char * get_process_name() const
Definition: sc_report.hh:75
sc_core::SC_FULL
@ SC_FULL
Definition: sc_report.hh:54
sc_core::SC_MAX_SEVERITY
@ SC_MAX_SEVERITY
Definition: sc_report.hh:45
sc_core::SC_LOW
@ SC_LOW
Definition: sc_report.hh:51
sc_core::sc_report::get_time
const sc_time & get_time() const
Definition: sc_report.hh:74
sc_core::sc_report::get_msg
const char * get_msg() const
Definition: sc_report.hh:69
sc_core::sc_report::_processName
const char * _processName
Definition: sc_report.hh:109
sc_core::sc_report_handler
Definition: sc_report_handler.hh:64
sc_core::sc_report::is_suppressed
static bool is_suppressed(int id)
Definition: sc_report.cc:98
sc_core::sc_report::get_message
static const char * get_message(int id)
Definition: sc_report.cc:88
sc_core::sc_time
Definition: sc_time.hh:49
sc_core::sc_report::get_file_name
const char * get_file_name() const
Definition: sc_report.hh:71
sc_core::sc_report::sc_report
sc_report(const sc_report &)
Definition: sc_report.cc:53
sc_core::sc_report::register_id
static void register_id(int id, const char *msg)
Definition: sc_report.cc:118
sc_core::sc_report::get_severity
sc_severity get_severity() const
Definition: sc_report.hh:67
sc_core::sc_report
Definition: sc_report.hh:60
sc_core::sc_report::suppress_infos
static void suppress_infos(bool)
Definition: sc_report.cc:158
sc_core::sc_report::get_id
int get_id() const
Definition: sc_report.hh:87
sc_core::sc_report::_what
std::string _what
Definition: sc_report.hh:111
sc_core::sc_report::_severity
sc_severity _severity
Definition: sc_report.hh:102
sc_core::sc_report::_lineNumber
int _lineNumber
Definition: sc_report.hh:107
sc_core::SC_MEDIUM
@ SC_MEDIUM
Definition: sc_report.hh:52
sc_core::SC_FATAL
@ SC_FATAL
Definition: sc_report.hh:44
sc_core::sc_report::what
virtual const char * what() const
Definition: sc_report.cc:82
sc_core::sc_report::get_line_number
int get_line_number() const
Definition: sc_report.hh:72
sc_core::sc_abort
void sc_abort()
Definition: sc_report.cc:178
sc_core::sc_report::_verbosity
int _verbosity
Definition: sc_report.hh:105
sc_core::SC_NONE
@ SC_NONE
Definition: sc_report.hh:50
sc_core::sc_report::get_verbosity
int get_verbosity() const
Definition: sc_report.hh:70
sc_core::sc_verbosity
sc_verbosity
Definition: sc_report.hh:48
sc_core::SC_DEBUG
@ SC_DEBUG
Definition: sc_report.hh:55
sc_core::sc_report::get_msg_type
const char * get_msg_type() const
Definition: sc_report.hh:68
sc_core::sc_report::_time
sc_time _time
Definition: sc_report.hh:108
sc_core::SC_HIGH
@ SC_HIGH
Definition: sc_report.hh:53
sc_core::SC_ERROR
@ SC_ERROR
Definition: sc_report.hh:43
sc_core::sc_report::make_warnings_errors
static void make_warnings_errors(bool)
Definition: sc_report.cc:112
sc_core::sc_report::operator=
sc_report & operator=(const sc_report &)
Definition: sc_report.cc:59
sc_core::sc_report::suppress_id
static void suppress_id(int id, bool)
Definition: sc_report.cc:138
sc_core::sc_report::_id
int _id
Definition: sc_report.hh:110

Generated on Wed Sep 30 2020 14:02:16 for gem5 by doxygen 1.8.17