gem5  v22.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__
virtual ~sc_report()
Definition: sc_report.cc:75
const char * _msg
Definition: sc_report.hh:104
virtual const char * what() const
Definition: sc_report.cc:82
sc_severity _severity
Definition: sc_report.hh:102
const char * get_process_name() const
Definition: sc_report.hh:75
sc_report(const sc_report &)
Definition: sc_report.cc:53
const char * get_msg_type() const
Definition: sc_report.hh:68
int get_line_number() const
Definition: sc_report.hh:72
static void register_id(int id, const char *msg)
Definition: sc_report.cc:118
static const char * get_message(int id)
Definition: sc_report.cc:88
static void make_warnings_errors(bool)
Definition: sc_report.cc:112
int get_id() const
Definition: sc_report.hh:87
const char * _msgType
Definition: sc_report.hh:103
const char * get_file_name() const
Definition: sc_report.hh:71
const char * _processName
Definition: sc_report.hh:109
static bool is_suppressed(int id)
Definition: sc_report.cc:98
sc_report & operator=(const sc_report &)
Definition: sc_report.cc:59
static void suppress_id(int id, bool)
Definition: sc_report.cc:138
const sc_time & get_time() const
Definition: sc_report.hh:74
static void suppress_infos(bool)
Definition: sc_report.cc:158
sc_severity get_severity() const
Definition: sc_report.hh:67
const char * get_msg() const
Definition: sc_report.hh:69
static void suppress_warnings(bool)
Definition: sc_report.cc:167
std::string _what
Definition: sc_report.hh:111
const char * _fileName
Definition: sc_report.hh:106
int get_verbosity() const
Definition: sc_report.hh:70
void sc_abort()
Definition: sc_report.cc:178
sc_verbosity
Definition: sc_report.hh:49
@ SC_MEDIUM
Definition: sc_report.hh:52
@ SC_NONE
Definition: sc_report.hh:50
@ SC_HIGH
Definition: sc_report.hh:53
@ SC_LOW
Definition: sc_report.hh:51
@ SC_DEBUG
Definition: sc_report.hh:55
@ SC_FULL
Definition: sc_report.hh:54
@ SC_MAX_SEVERITY
Definition: sc_report.hh:45
@ SC_ERROR
Definition: sc_report.hh:43
@ SC_FATAL
Definition: sc_report.hh:44
@ SC_INFO
Definition: sc_report.hh:41
@ SC_WARNING
Definition: sc_report.hh:42

Generated on Wed Dec 21 2022 10:22:42 for gem5 by doxygen 1.9.1