Compute Library
 22.11
Printer Class Referenceabstract

Abstract printer class used by the Framework to present output. More...

#include <Printer.h>

Public Member Functions

 Printer ()=default
 Default constructor. More...
 
 Printer (std::ostream &stream)
 Construct printer with given output stream. More...
 
 Printer (const Printer &)=delete
 Prevent instances of this class from being copy constructed. More...
 
Printeroperator= (const Printer &)=delete
 Prevent instances of this class from being copied. More...
 
 Printer (Printer &&)=default
 Allow instances of this class to be move constructed. More...
 
Printeroperator= (Printer &&)=default
 Allow instances of this class to be moved. More...
 
virtual ~Printer ()=default
 Default destructor. More...
 
void print (const std::string &str)
 Print given string. More...
 
virtual void print_entry (const std::string &name, const std::string &value)=0
 Print an entry consisting of a (name, value) pair. More...
 
virtual void print_global_header ()=0
 Print global header. More...
 
virtual void print_global_footer ()=0
 Print global footer. More...
 
virtual void print_run_header ()=0
 Print header before running all tests. More...
 
virtual void print_run_footer ()=0
 Print footer after running all tests. More...
 
virtual void print_test_header (const TestInfo &info)=0
 Print header before a test. More...
 
virtual void print_test_footer ()=0
 Print footer after a test. More...
 
virtual void print_errors_header ()=0
 Print header before errors. More...
 
virtual void print_errors_footer ()=0
 Print footer after errors. More...
 
virtual void print_list_tests (const std::vector< TestInfo > &infos)=0
 Print the list of all the tests. More...
 
virtual void print_error (const std::exception &error, bool expected)=0
 Print test error. More...
 
virtual void print_info (const std::string &info)=0
 Print test log info. More...
 
virtual void print_profiler_header (const std::string &header_data)=0
 Print header data. More...
 
virtual void print_measurements (const Profiler::MeasurementsMap &measurements)=0
 Print measurements for a test. More...
 
void set_stream (std::ostream &stream)
 Set the output stream. More...
 

Detailed Description

Abstract printer class used by the Framework to present output.

Definition at line 43 of file Printer.h.

Constructor & Destructor Documentation

◆ Printer() [1/4]

Printer ( )
default

Default constructor.

Prints values to std::cout.

◆ Printer() [2/4]

Printer ( std::ostream &  stream)

Construct printer with given output stream.

Parameters
[out]streamOutput stream.

Definition at line 32 of file Printer.cpp.

33  : _stream{ &stream }
34 {
35 }

◆ Printer() [3/4]

Printer ( const Printer )
delete

Prevent instances of this class from being copy constructed.

◆ Printer() [4/4]

Printer ( Printer &&  )
default

Allow instances of this class to be move constructed.

◆ ~Printer()

virtual ~Printer ( )
virtualdefault

Default destructor.

Member Function Documentation

◆ operator=() [1/2]

Printer& operator= ( const Printer )
delete

Prevent instances of this class from being copied.

◆ operator=() [2/2]

Printer& operator= ( Printer &&  )
default

Allow instances of this class to be moved.

◆ print()

void print ( const std::string &  str)

Print given string.

Parameters
[in]strString.

Definition at line 37 of file Printer.cpp.

References caffe_mnist_image_extractor::str.

38 {
39  *_stream << str;
40 }

◆ print_entry()

virtual void print_entry ( const std::string &  name,
const std::string &  value 
)
pure virtual

Print an entry consisting of a (name, value) pair.

Parameters
[in]nameDescription of the value.
[in]valueValue.

Implemented in PrettyPrinter, and JSONPrinter.

◆ print_error()

virtual void print_error ( const std::exception &  error,
bool  expected 
)
pure virtual

Print test error.

Parameters
[in]errorDescription of the error.
[in]expectedWhether the error was expected or not.

Implemented in PrettyPrinter, and JSONPrinter.

Referenced by Framework::error_on_missing_assets(), and Framework::log_failed_expectation().

◆ print_errors_footer()

virtual void print_errors_footer ( )
pure virtual

Print footer after errors.

Implemented in PrettyPrinter, and JSONPrinter.

Referenced by Framework::error_on_missing_assets().

◆ print_errors_header()

virtual void print_errors_header ( )
pure virtual

Print header before errors.

Implemented in PrettyPrinter, and JSONPrinter.

Referenced by Framework::error_on_missing_assets().

◆ print_global_footer()

virtual void print_global_footer ( )
pure virtual

Print global footer.

Implemented in PrettyPrinter, and JSONPrinter.

◆ print_global_header()

virtual void print_global_header ( )
pure virtual

Print global header.

Implemented in PrettyPrinter, and JSONPrinter.

◆ print_info()

virtual void print_info ( const std::string &  info)
pure virtual

Print test log info.

Parameters
[in]infoDescription of the log.

Implemented in PrettyPrinter, and JSONPrinter.

Referenced by Framework::error_on_missing_assets(), and Framework::log_info().

◆ print_list_tests()

virtual void print_list_tests ( const std::vector< TestInfo > &  infos)
pure virtual

Print the list of all the tests.

Parameters
[in]infosList of tests to print

Implemented in PrettyPrinter, and JSONPrinter.

◆ print_measurements()

virtual void print_measurements ( const Profiler::MeasurementsMap measurements)
pure virtual

Print measurements for a test.

Parameters
[in]measurementsMeasurements as collected by a Profiler.

Implemented in PrettyPrinter, and JSONPrinter.

Referenced by Framework::log_test_end(), and Framework::print_test_results().

◆ print_profiler_header()

virtual void print_profiler_header ( const std::string &  header_data)
pure virtual

Print header data.

Parameters
[in]header_dataJSON formmated header data.

Implemented in PrettyPrinter, and JSONPrinter.

Referenced by Framework::log_test_end(), and Framework::print_test_results().

◆ print_run_footer()

virtual void print_run_footer ( )
pure virtual

Print footer after running all tests.

Implemented in PrettyPrinter, and JSONPrinter.

Referenced by Framework::print_test_results(), and Framework::run().

◆ print_run_header()

virtual void print_run_header ( )
pure virtual

Print header before running all tests.

Implemented in PrettyPrinter, and JSONPrinter.

Referenced by Framework::print_test_results(), and Framework::run().

◆ print_test_footer()

virtual void print_test_footer ( )
pure virtual

Print footer after a test.

Implemented in PrettyPrinter, and JSONPrinter.

Referenced by Framework::log_test_end(), and Framework::print_test_results().

◆ print_test_header()

virtual void print_test_header ( const TestInfo info)
pure virtual

Print header before a test.

Parameters
[in]infoTest info.

Implemented in PrettyPrinter, and JSONPrinter.

Referenced by Framework::log_test_start(), and Framework::print_test_results().

◆ set_stream()

void set_stream ( std::ostream &  stream)

Set the output stream.

Parameters
[out]streamOutput stream.

Definition at line 42 of file Printer.cpp.

43 {
44  _stream = &stream;
45 }

The documentation for this class was generated from the following files: