CppCommon  1.0.4.1
C++ Common Library
Classes | Public Member Functions | Friends | List of all members
CppCommon::StackTrace Class Reference

Stack trace snapshot provider. More...

#include <stack_trace.h>

Classes

struct  Frame
 Stack trace frame. More...
 

Public Member Functions

 StackTrace (int skip=0)
 Capture the current stack trace snapshot. More...
 
 StackTrace (const StackTrace &)=default
 
 StackTrace (StackTrace &&) noexcept=default
 
 ~StackTrace ()=default
 
StackTraceoperator= (const StackTrace &)=default
 
StackTraceoperator= (StackTrace &&) noexcept=default
 
const std::vector< Frame > & frames () const noexcept
 Get stack trace frames. More...
 
std::string string () const
 Get string from the current stack trace snapshot. More...
 

Friends

std::ostream & operator<< (std::ostream &os, const StackTrace &stack_trace)
 Output stack trace into the given output stream. More...
 

Detailed Description

Stack trace snapshot provider.

Capture the current stack trace snapshot with easy-to-use interface.

Thread-safe.

Definition at line 32 of file stack_trace.h.

Constructor & Destructor Documentation

◆ StackTrace() [1/3]

CppCommon::StackTrace::StackTrace ( int  skip = 0)
explicit

Capture the current stack trace snapshot.

Parameters
skip- Skip frames count (default is 0)

Definition at line 63 of file stack_trace.cpp.

◆ StackTrace() [2/3]

CppCommon::StackTrace::StackTrace ( const StackTrace )
default

◆ StackTrace() [3/3]

CppCommon::StackTrace::StackTrace ( StackTrace &&  )
defaultnoexcept

◆ ~StackTrace()

CppCommon::StackTrace::~StackTrace ( )
default

Member Function Documentation

◆ frames()

const std::vector<Frame>& CppCommon::StackTrace::frames ( ) const
inlinenoexcept

Get stack trace frames.

Definition at line 66 of file stack_trace.h.

◆ operator=() [1/2]

StackTrace& CppCommon::StackTrace::operator= ( const StackTrace )
default

◆ operator=() [2/2]

StackTrace& CppCommon::StackTrace::operator= ( StackTrace &&  )
defaultnoexcept

◆ string()

std::string CppCommon::StackTrace::string ( ) const
inline

Get string from the current stack trace snapshot.

Definition at line 69 of file stack_trace.h.

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  os,
const StackTrace stack_trace 
)
friend

Output stack trace into the given output stream.

Definition at line 262 of file stack_trace.cpp.


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