Flow123d
Public Member Functions | Static Public Member Functions | Static Private Attributes | List of all members
flow::Trace Class Reference

This class provides function call stack. More...

#include <sys_function_stack.hh>

Collaboration diagram for flow::Trace:
Collaboration graph
[legend]

Public Member Functions

 Trace (const char *const trace_str, const char *const trace_str2, const char *const trace_str3)
 
 ~Trace ()
 

Static Public Member Functions

static void stack_print (FILE *fw)
 
static void stack_print (std::ostream *os)
 

Static Private Attributes

static int stack_depth = -1
 
static std::vector
< Trace_helper > * 
program_stack
 definition of global variables for stacktrace storage More...
 

Detailed Description

This class provides function call stack.

Then the backtrace of the called functions can be reported in the case of an error. Operations with the stack should be only through F_ENTRY and F_STACK_SHOW(stream). To include a function in the call stack just use macro F_ENTRY at the very beginning of the function. F_ENTRY macro is nonempty only for the debugging version. For the release version, i.e. when Flow123d_NODEBUG is defined, F_ENTRY is empty and produce no run-time overhead.

Definition at line 89 of file sys_function_stack.hh.

Constructor & Destructor Documentation

flow::Trace::Trace ( const char *const  trace_str,
const char *const  trace_str2,
const char *const  trace_str3 
)
inlineexplicit

Constructor, takes source filename and func_name of a function, and line number line_no of the call of F_ENTRY. Forms a message string and put it onto stack.

Definition at line 96 of file sys_function_stack.hh.

flow::Trace::~Trace ( )
inline

Destructor, automatically called on the function exit. Pop out the stack message of that function.

Definition at line 111 of file sys_function_stack.hh.

Member Function Documentation

static void flow::Trace::stack_print ( FILE *  fw)
inlinestatic

Prints the stack into a given file.

Definition at line 119 of file sys_function_stack.hh.

static void flow::Trace::stack_print ( std::ostream *  os)
inlinestatic

As previous, but output into C++ output stream.

Definition at line 129 of file sys_function_stack.hh.

Member Data Documentation

std::vector< Trace_helper > * flow::Trace::program_stack
staticprivate

definition of global variables for stacktrace storage

Definition at line 140 of file sys_function_stack.hh.

int flow::Trace::stack_depth = -1
staticprivate

Static stack of trace messages.

Definition at line 139 of file sys_function_stack.hh.


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