28ML_UTILS_START_NAMESPACE
62 std::memset(_traceStack, 0, _numBufBytes);
63 std::memset(_traceList, 0, _numBufBytes);
78 inline void add(
const char*
const traceInString){
86 _traceStack[_traceStackTop] = traceInString;
94 _traceList[_traceListEnd] = traceInString;
114 _traceStackTop =
static_cast<INDEXTYPE
>((_traceStackTop - 1) & _bufferIndexMask);
118 _traceStack[_traceStackTop] = NULL;
149 enum { _numBufEntries = (1L << (
sizeof(INDEXTYPE) << 3)) ,
150 _numBufBytes = _numBufEntries *
sizeof(
const char *),
151 _bufferIndexMask = _numBufEntries - 1
155 INDEXTYPE _traceStackTop;
158 INDEXTYPE _traceListEnd;
161 const char *_traceStack[_numBufEntries];
164 const char *_traceList[_numBufEntries];
181 template <
typename INDEXTYPE>
class Trace {
200 traceBuf.
add(traceInString);
226 inline Trace(
const Trace &trace) : _traceBuf(trace._traceBuf){ }
231 inline Trace<INDEXTYPE> &operator=(
const Trace & ){
return *
this; }
248ML_UTILS_END_NAMESPACE
This class manages a list and a stack of pointers to permanent strings.
TraceBuffer()
Initializing constructor.
const char *const * getTraceList() const
Returns the pointer to the first element of the trace list.
INDEXTYPE getTraceListEnd() const
Returns index into trace list buffer.
void add(const char *const traceInString)
Adds an element.
INDEXTYPE getTraceStackTop() const
Returns index into trace stack buffer.
const char *const * getTraceStack() const
Returns the pointer to the first element of the trace stack.
This class simply implements a constructor and a destructor.
Trace(const char *const traceInString, TraceBuffer< INDEXTYPE > &traceBuf)
Constructor.
#define ML_UTILS_EXPORT
Defines platform dependent DLL export macro for mlUtils.
ML_UTILS_EXPORT TraceBuffer< MLGlobalTraceBufferType > MLGlobalTraceBuffer
This is a global singleton of the TraceBuffer class.
MLuint16 MLGlobalTraceBufferType
The type used in the MLGlobalTraceBuffer.