Open Inventor Reference
SoTraceBuffer< INDEXTYPE > Class Template 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.
 

Detailed Description

template<typename INDEXTYPE>
class SoTraceBuffer< INDEXTYPE >

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.

Definition at line 57 of file SoTrace.h.

Constructor & Destructor Documentation

◆ SoTraceBuffer()

template<typename INDEXTYPE >
SoTraceBuffer< INDEXTYPE >::SoTraceBuffer ( )
inline

It resets the stack and list buffer and also listEnd and stackTop indices.

Definition at line 63 of file SoTrace.h.

Member Function Documentation

◆ add()

template<typename INDEXTYPE >
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 73 of file SoTrace.h.

Referenced by SoTrace< INDEXTYPE >::SoTrace().

◆ getMaxNumTraceListDumps()

template<typename INDEXTYPE >
SoGlobalTraceBufferType SoTraceBuffer< INDEXTYPE >::getMaxNumTraceListDumps ( ) const
inline

Definition at line 131 of file SoTrace.h.

◆ getMaxNumTraceStackDumps()

template<typename INDEXTYPE >
SoGlobalTraceBufferType SoTraceBuffer< INDEXTYPE >::getMaxNumTraceStackDumps ( ) const
inline

Definition at line 141 of file SoTrace.h.

◆ getTraceDumpString()

template<typename INDEXTYPE >
SbString SoTraceBuffer< INDEXTYPE >::getTraceDumpString

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 214 of file SoTrace.h.

References SoGlobalTraceBuffer.

◆ getTraceList()

template<typename INDEXTYPE >
const char *const * SoTraceBuffer< INDEXTYPE >::getTraceList ( ) const
inline

Definition at line 126 of file SoTrace.h.

◆ getTraceListEnd()

template<typename INDEXTYPE >
INDEXTYPE SoTraceBuffer< INDEXTYPE >::getTraceListEnd ( ) const
inline

It addresses the entry to be written on next append.

Definition at line 116 of file SoTrace.h.

◆ getTraceStack()

template<typename INDEXTYPE >
const char *const * SoTraceBuffer< INDEXTYPE >::getTraceStack ( ) const
inline

Definition at line 121 of file SoTrace.h.

◆ getTraceStackTop()

template<typename INDEXTYPE >
INDEXTYPE SoTraceBuffer< INDEXTYPE >::getTraceStackTop ( ) const
inline

It addresses the entry to be written on next push.

Definition at line 110 of file SoTrace.h.

◆ remove()

template<typename INDEXTYPE >
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.

Definition at line 93 of file SoTrace.h.

◆ setMaxNumTraceListDumps()

template<typename INDEXTYPE >
void SoTraceBuffer< INDEXTYPE >::setMaxNumTraceListDumps ( SoGlobalTraceBufferType  num)
inline

Definition at line 136 of file SoTrace.h.

◆ setMaxNumTraceStackDumps()

template<typename INDEXTYPE >
void SoTraceBuffer< INDEXTYPE >::setMaxNumTraceStackDumps ( SoGlobalTraceBufferType  num)
inline

Definition at line 146 of file SoTrace.h.


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