Skip to content

Latest commit

 

History

History
70 lines (56 loc) · 1.87 KB

File metadata and controls

70 lines (56 loc) · 1.87 KB

About the Report utilities

The report utilities are intended to simplify SystemC reporting and provide more flexibility, while keeping the implementation lightweight.

Foremost are the streaming macros that all steaming syntax to be combined with SC_REPORT_* macros.

Syntax

  • ASSERT(expression, message_stream)
  • REPORT(message_type, message_stream);
  • INFO(verbosity_level, message_stream);
  • MESSAGE(message_stream);
  • MEND(verbosity_level);
  • RULER(char);
  • TODO(message_stream);
  • NOT_YET_IMPLEMENTED();

Message types are: FATAL, ERROR, WARNING, and INFO

Verbosity levels are: ALWAYS, LOW, MEDIUM, HIGH, DEBUG

The MESSAGE macro doesn't output anything, but rather builds up a message to be emitted by REPORT, INFO or MEND.

Assumes you define in every implementation file (i.e. .cpp):

#include "report/report.hpp"
namespace {
  char const * const MSGID{ "/Company/Group/Project/Module" };
}

For header files leave off the name space and put in the function or define a static constexpr char const * const class member. Must not allow to escape the header. So a #define is inappropriate. Here is an example:

class Xyz {
 ...
private:
 static char const * const MSGID { "/Company/Group/Project/Module" };
};

Usage Example

#include "report/report.hpp"
ASSERT( n > -2, "Value of n may only be positive or -1. Currently " << n );
namespace { char const * const MSGID{ "/Doulos/Example/Report" }; }
REPORT(ERROR,"Data " << data << " doesn't match expected " << expected);
INFO(DEBUG,"Packet contains " << packet);
TODO("Fix report handler to remove blank line after REPORT_INFO");
NOT_YET_IMPLEMENTED();
MESSAGE( "Map contents:\n" );
for( const auto& v : my_map ) {
 MESSAGE( "  " << v.first << ": " << v.second << "\n" );
}
MEND( HIGH ); // or REPORT( WARNING, "" );

The end