ML Reference
|
This class manages a list and a stack of pointers to permanent strings. More...
#include <mlTrace.h>
Public Member Functions | |
TraceBuffer () | |
Initializing constructor. | |
void | add (const char *const traceInString) |
Adds an element. | |
void | remove () |
Destructor. | |
INDEXTYPE | getTraceStackTop () const |
Returns index into trace stack buffer. | |
INDEXTYPE | getTraceListEnd () const |
Returns index into trace list buffer. | |
const char *const | getTraceStack () const |
Returns the pointer to the first element of the trace stack. | |
const char *const | getTraceList () const |
Returns the pointer to the first element of the trace list. |
This class manages a list and a stack of pointers to permanent strings.
The constructor initializes the buffers to empty pointers. It will be used by the Trace class called by ML_TRACE_IN macros on function entries to track the call stack and call list. Overflows especially of the list will occur and are included in class design; so the buffers have exactly of a size identical with index range of the stack pointer and the list pointer. Accepting overflows limits the stack size and the number of list entries; however, no checks for overflow etc. are necessary which permits maximum tracing performance.
INDEXTYPE | specifies the data type and indirectly the size of the stack and the list. Normally it should be MLuint8 or MLuint16 which then will result in 256 or 65536 stack and list entries. Other types are supported. WARNING: Tracing is currently not thread-safe for performance reasons. This means that it only works properly to use ML_TRACE_IN macros from the main thread. When calling functions that use ML_TRACE_IN macros from a different thread, this will mix-up the trace stack and list and the resulting stack and list may miss individual tracing items. It would be possible to support per-thread tracing by using thread local storage (TLS) in the future, but this involves a performance penalty. |
ml::TraceBuffer< INDEXTYPE >::TraceBuffer | ( | ) | [inline] |
void ml::TraceBuffer< INDEXTYPE >::add | ( | const char *const | traceInString | ) | [inline] |
Adds an element.
It appends the passed string reference to the trace buffer and to the top of the trace stack. Then it increases trace index and stack pointer. traceInString
may be NULL. If not NULL, it must point to any null-terminated permanent string. VERY TIME CRITICAL!
Definition at line 76 of file mlTrace.h.
Referenced by ml::Trace< INDEXTYPE >::Trace().
const char* const ml::TraceBuffer< INDEXTYPE >::getTraceList | ( | ) | const [inline] |
INDEXTYPE ml::TraceBuffer< INDEXTYPE >::getTraceListEnd | ( | ) | const [inline] |
const char* const ml::TraceBuffer< INDEXTYPE >::getTraceStack | ( | ) | const [inline] |
INDEXTYPE ml::TraceBuffer< INDEXTYPE >::getTraceStackTop | ( | ) | const [inline] |
void ml::TraceBuffer< INDEXTYPE >::remove | ( | ) | [inline] |