Skip to content

callstack.hpp

mhahnFr edited this page Oct 15, 2022 · 13 revisions

In this header the wrapper class for the C++ support can be found.
Its not necessary to include this header on its own, this is automatically done by callstack.h.

namespace lcs

The namespace used to separate the wrapper class from the struct callstack, declared in callstack.h.

class callstack

The actual wrapper class, consisting of all necessary operators and constructors for seemlessly integration into C++ code.

Typedefs

typedef ::callstack struct_callstack

A typedef to improve the readability of the code.

Variables

struct_callstack self

A private variable containing the underlying struct callstack.

Note: The struct is part of this class.

Constructors

callstack::callstack(bool emplace = true)

The default constructor. Creates a new backtrace unless emplace is set to false. In either case, the underlying struct callstack is properly initialized.
Throws a runtime_error or a system_error if compiled using C++11 or newer if the backtrace could not be created.

callstack::callstack(void * address)

Initializes the underlying struct callstack creating a backtrace of the calling function, ignoring all frmes after the given address.
Throws a runtime_error or a system_error if compiled using C++11 or newer if the backtrace could not be created.

callstack::callstack(void ** trace, int length)

Constructs the underlying struct callstack using the given trace.
Throws a runtime_error or a system_error if compiled using C++11 or newer if the length of the trace is smaller than zero.

callstack::callstack(const callstack & other)

Trivial copy constructor.

explicit callstack::callstack(const struct_callstack * other)

Constructs a callstack object using the given struct callstack.

callstack::callstack(callstack && other)

Trivial move constructor. Only available when compiled using a compiler supporting C++11 or newer.

Destructor

callstack::~callstack()

Trivial destructor.

Operators

callstack & operator=(const callstack & other)

Trivial copy assignation operator.

callstack & operator=(callstack && other)

Trivial move assignation operator. Only available when compiled using a compiler supporting C++11 or newer.

operator struct_callstack * ()

Implicit casting operator. Returns a pointer to the underlying struct callstack.

operator const struct_callstack * () const

Implicit casting operator. Returns a pointer to the underlying struct callstack.

Methods

void error()

Prvate helper function used to throw either a system_error if compiled using C++11 or newer or to throw a runtime_error otherwise.

Clone this wiki locally