Open Inventor Reference
|
This class manages a list and a stack of pointers to permanent strings. More...
#include <Inventor/SoTrace.h>
Public Member Functions | |
SoTraceBuffer () | |
Initializing constructor. | |
void | add (const char *const traceInString) |
Add trace description. | |
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. | |
SoGlobalTraceBufferType | getMaxNumTraceListDumps () const |
Maximum number of trace list entries to be shown on fatal error outputs. | |
void | setMaxNumTraceListDumps (SoGlobalTraceBufferType num) |
Sets the maximum number of trace list entries to be shown on fatal error outputs. | |
SoGlobalTraceBufferType | getMaxNumTraceStackDumps () const |
Maximum number of trace stack entries to be shown on fatal error outputs. | |
void | setMaxNumTraceStackDumps (SoGlobalTraceBufferType num) |
Sets the maximum number of trace stack entries to be shown on fatal error outputs. | |
SbString | getTraceDumpString () const |
Returns an SbString which returns a dump of trace list and trace dump entries for debugging purposes. |
The constructor initializes the buffers to empty pointers. It will be used by the Trace class called by SO_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, so 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 uint16_t which then will result in 65536 stack and list entries. Other types are not supported.
SoTraceBuffer< INDEXTYPE >::SoTraceBuffer | ( | ) | [inline] |
void SoTraceBuffer< INDEXTYPE >::add | ( | const char *const | traceInString | ) | [inline] |
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!
Push string address onto the stack. Be sure that _stackTop is incremented after storing pointer to make memory access and incrementation of index independent. So the CPU can execute both statements parallel. Also be sure to increment index NOT within "[" and "]" to avoid that indexing works on 32bit integers which would access areas outside buffers.
Append string address to end of trace list. For optimizing performance also see _traceStack push above.
Definition at line 120 of file SoTrace.h.
Referenced by SoTrace< INDEXTYPE >::SoTrace().
SoGlobalTraceBufferType SoTraceBuffer< INDEXTYPE >::getMaxNumTraceListDumps | ( | ) | const [inline] |
SoGlobalTraceBufferType SoTraceBuffer< INDEXTYPE >::getMaxNumTraceStackDumps | ( | ) | const [inline] |
SbString SoTraceBuffer< INDEXTYPE >::getTraceDumpString | ( | ) | const |
A buffer to string number into it.
Scan all trace list in global tracing instance. Start with the newest entry and increment it until it reaches the current one. Note that it is a ring buffer.
Create trace stack string.
Create a number string from indexCounter.
Get entry. Note that it might be empty or NULL.
Go to previous entry.
Create a number string from indexCounter.
Get entry. Note that it might be empty or NULL.
Go to previous entry.
Return composed list.
Definition at line 261 of file SoTrace.h.
References SoGlobalTraceBuffer.
const char* const SoTraceBuffer< INDEXTYPE >::getTraceList | ( | ) | const [inline] |
INDEXTYPE SoTraceBuffer< INDEXTYPE >::getTraceListEnd | ( | ) | const [inline] |
const char* const SoTraceBuffer< INDEXTYPE >::getTraceStack | ( | ) | const [inline] |
INDEXTYPE SoTraceBuffer< INDEXTYPE >::getTraceStackTop | ( | ) | const [inline] |
void SoTraceBuffer< INDEXTYPE >::remove | ( | ) | [inline] |
It decreases stack pointer and resets last stored string pointer to VERY TIME CRITICAL!
Decrement trace stack top. Be sure that integer index is really limited to size of INDEXTYPE since passing decremented _traceStackTop without masking it could lead to usage of 32 bit index in index "[" "]" and accesses outside buffers. Note that mask calculation is constant and probably will be evaluated on compile time.
Reset stack entry. So unused entries do not use invalid information.
void SoTraceBuffer< INDEXTYPE >::setMaxNumTraceListDumps | ( | SoGlobalTraceBufferType | num | ) | [inline] |
void SoTraceBuffer< INDEXTYPE >::setMaxNumTraceStackDumps | ( | SoGlobalTraceBufferType | num | ) | [inline] |