Example #1
0
void sc_report_handler::default_handler(const sc_report& rep,
                                        const sc_actions& actions)
{
    if ( actions & SC_DISPLAY )
        ::std::cout << ::std::endl << sc_report_compose_message(rep) <<
                    ::std::endl;

    if ( (actions & SC_LOG) && get_log_file_name() )
    {
        if ( !log_stream )
            log_stream = new ::std::ofstream(get_log_file_name()); // ios::trunc

        *log_stream << rep.get_time() << ": "
                    << sc_report_compose_message(rep) << ::std::endl;
    }
    if ( actions & SC_STOP )
    {
        sc_stop_here(rep.get_msg_type(), rep.get_severity());
        sc_stop();
    }
    if ( actions & SC_INTERRUPT )
        sc_interrupt_here(rep.get_msg_type(), rep.get_severity());

    if ( actions & SC_ABORT )
        abort();

    if ( actions & SC_THROW )
        throw rep;
}
Example #2
0
sc_report::sc_report(sc_severity severity_,
                     const sc_msg_def* md_,
                     const char* msg_,
                     const char* file_,
                     int line_)
        : severity(severity_),
        md(md_),
        msg(empty_dup(msg_)),
        file(empty_dup(file_)),
        line(line_),
        timestamp(new sc_time(sc_time_stamp())),
        process(sc_get_current_process_b()),
        m_what(strdup(sc_report_compose_message(*this).c_str()))
{
}