Zero  0.1.0
Classes | Macros | Functions
trace.h File Reference

Tracing module. More...

#include <cstdarg>
#include <cstdint>
#include "util/compat.h"
#include "trace_types.h"

Go to the source code of this file.

Classes

struct  tracer
 

Macros

#define TRACE   tracer(__FILE__, __LINE__, __FUNCTION__)
 Other modules in our program use this macro for reporting. We can use preprocessor macros like FILE and LINE to provide more information in the output messages. We can also remove all messages at compile time by changing the definition. More...
 
#define TRACE_SET(types)   trace_set(types)
 Macro wrapper for trace_set() More...
 
#define TRACE_GET()   trace_get()
 Macro wrapper for trace_get() More...
 

Functions

void trace_ (unsigned int trace_type, const char *filename, int line_num, const char *function_name, char const *format,...)
 
void trace_set (unsigned int trace_type_mask)
 Specify the set of trace types that are currently enabled. More...
 
unsigned int trace_get ()
 Get the set of trace types that are currently enabled. More...
 

Detailed Description

Tracing module.

Note
See trace.cpp.

Macro Definition Documentation

§ TRACE

#define TRACE   tracer(__FILE__, __LINE__, __FUNCTION__)

Other modules in our program use this macro for reporting. We can use preprocessor macros like FILE and LINE to provide more information in the output messages. We can also remove all messages at compile time by changing the definition.

Parameters
typeThe type of the message. This is really a bit vector of all times when this message should be printed. If the current debug setting contains any one of these bits, we print the message.
formatThe format string for the printing. Format follows that of printf(3).
restOptional arguments that can printed (see printf(3) definition for more details).
Returns
void

§ TRACE_GET

#define TRACE_GET ( )    trace_get()

Macro wrapper for trace_get()

Returns
unsigned int

§ TRACE_SET

#define TRACE_SET (   types)    trace_set(types)

Macro wrapper for trace_set()

Parameters
typesPassed through as trace_type_mask parameter of trace_set().
Returns
void

Function Documentation

§ trace_()

void trace_ ( unsigned int  trace_type,
const char *  filename,
int  line_num,
const char *  function_name,
char const *  format,
  ... 
)

§ trace_get()

unsigned int trace_get ( )

Get the set of trace types that are currently enabled.

§ trace_set()

void trace_set ( unsigned int  trace_type_mask)

Specify the set of trace types that are currently enabled.

Parameters
trace_type_maskBitmask used to specify the current set of trace types.