feisty meow concerns codebase  2.140
application::frame_tracking_instance Class Reference

a small object that represents a stack trace in progress. More...

#include <callstack_tracker.h>

Public Member Functions

 frame_tracking_instance (const char *class_name="", const char *func="", const char *file="", int line=0, bool add_frame=false)
 as an automatic variable, this can hang onto frame information. More...
 
 frame_tracking_instance (const frame_tracking_instance &to_copy)
 
 ~frame_tracking_instance ()
 releases the information and this stack frame in the tracker. More...
 
frame_tracking_instanceoperator= (const frame_tracking_instance &to_copy)
 
void assign (const char *class_name, const char *func, const char *file, int line)
 similar to assignment operator but doesn't require an object. More...
 
void clean ()
 throws out our accumulated memory and pops frame if applicable. More...
 

Public Attributes

bool _frame_involved
 has this object been added to the tracker? More...
 
char * _class
 
char * _func
 
char * _file
 newly allocated copies. More...
 
int _line
 

Detailed Description

a small object that represents a stack trace in progress.

the object will automatically be destroyed when the containing scope exits. this enables a users of the stack tracker to simply label their function name and get the frame added. if they want finer grained tracking, they should update the line number periodically through their function, especially when memory is about to be allocated or where something might go wrong.

Definition at line 145 of file callstack_tracker.h.

Constructor & Destructor Documentation

◆ frame_tracking_instance() [1/2]

application::frame_tracking_instance::frame_tracking_instance ( const char *  class_name = "",
const char *  func = "",
const char *  file = "",
int  line = 0,
bool  add_frame = false 
)

as an automatic variable, this can hang onto frame information.

if "add_frame" is true, then this actually adds the stack frame in question to the tracker. thus if you use this class at the top of your function, such as via the FUNCDEF macro, then you can forget about having to pop the frame later.

Definition at line 267 of file callstack_tracker.cpp.

References _frame_involved, application::callstack_tracker::push_frame(), and application::thread_wide_stack_trace().

◆ frame_tracking_instance() [2/2]

application::frame_tracking_instance::frame_tracking_instance ( const frame_tracking_instance to_copy)

Definition at line 282 of file callstack_tracker.cpp.

◆ ~frame_tracking_instance()

application::frame_tracking_instance::~frame_tracking_instance ( )

releases the information and this stack frame in the tracker.

Definition at line 292 of file callstack_tracker.cpp.

References clean().

Member Function Documentation

◆ assign()

void application::frame_tracking_instance::assign ( const char *  class_name,
const char *  func,
const char *  file,
int  line 
)

similar to assignment operator but doesn't require an object.

Definition at line 317 of file callstack_tracker.cpp.

References _class, _file, _frame_involved, _func, _line, clean(), and NULL_POINTER.

◆ clean()

void application::frame_tracking_instance::clean ( )

throws out our accumulated memory and pops frame if applicable.

Definition at line 294 of file callstack_tracker.cpp.

References _class, _file, _frame_involved, _func, _line, NULL_POINTER, application::callstack_tracker::pop_frame(), and application::thread_wide_stack_trace().

Referenced by assign(), and ~frame_tracking_instance().

◆ operator=()

frame_tracking_instance & application::frame_tracking_instance::operator= ( const frame_tracking_instance to_copy)

Definition at line 307 of file callstack_tracker.cpp.

Member Data Documentation

◆ _class

char* application::frame_tracking_instance::_class

Definition at line 150 of file callstack_tracker.h.

Referenced by assign(), and clean().

◆ _file

char * application::frame_tracking_instance::_file

newly allocated copies.

Definition at line 150 of file callstack_tracker.h.

Referenced by assign(), and clean().

◆ _frame_involved

bool application::frame_tracking_instance::_frame_involved

has this object been added to the tracker?

Definition at line 149 of file callstack_tracker.h.

Referenced by assign(), clean(), and frame_tracking_instance().

◆ _func

char * application::frame_tracking_instance::_func

Definition at line 150 of file callstack_tracker.h.

Referenced by assign(), and clean().

◆ _line

int application::frame_tracking_instance::_line

Definition at line 151 of file callstack_tracker.h.

Referenced by assign(), and clean().


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