Other

nxLibTranslateReturnCode

static char const *nxLibTranslateReturnCode(int32_t returnCode)

Retrieves a string description for an API return code .

Parameters

returnCode – The return code to convert to a text string

Returns

A pointer to a string description of the return code or nullptr, if an invalid return code was specified.

nxLibWriteDebugMessage

void nxLibWriteDebugMessage(int32_t *result, const char *message)

Inserts a user defined debug message into the NxLib debug stream. The message will be output as specified under the Debug node.

Parameters
  • result – A pointer to a variable for the return code of the operation. The following return codes can occur:

    • NxLibOperationSucceeded - The operation completed successfully. No error occurred.

    • NxLibInvalidParameters - One, multiple, or a combination of parameters are invalid.

    • NxLibInternalError - An unknown internal error occurred.

  • message – The message to be written.

static void nxLibWriteDebugMessage(std::string const &message)

See

nxLibWriteDebugMessage(int32_t*, const char*)

Note

C++ only This function is an overload accessible only in C++. Instead of returning the result code as an output parameter like its C counterpart, it throws an NxLibException in case of an error.

nxLibGetDebugMessages

const char *nxLibGetDebugMessages(int32_t *result)

Retrieves debug messages.

Note

By calling this function the debug buffer will be fully cleared and the debug information can no longer be retrieved with nxLibGetDebugBuffer().

Note

Calling this function will temporarily lock all debug ring buffers and thus block all NxLib threads which are trying to push debug information onto their buffer. The user should therefore choose a point in time when NxLib is not performing time critical computations for his application to retrieve debug information.

Parameters

result – A pointer to a variable for the return code of the operation. The following return codes can occur:

  • NxLibOperationSucceeded - The operation completed successfully. No error occurred.

  • NxLibNoDebugData - The message buffer is empty.

  • NxLibDebugMessageOverflow - The message buffer has overflown and older messages had to be dropped. In that case the returned string will contain only the newest debug messages that could fit into the buffer.

  • NxLibInternalError - An unknown internal error occurred.

Returns

The debug messages from all threads separated by the newline character (\n). Please refer to the string type description for information about usage restrictions applying to the returned pointer.

nxLibGetDebugBuffer

int32_t nxLibGetDebugBuffer(int32_t *result, void *destinationBuffer, int32_t bufferSize, int32_t *bytesRemaining, int32_t clearRead)

Retrieves debug information in a binary format which can be read by NxProfiler.

Note

Calling this function will temporarily lock all debug ring buffers and thus block all NxLib threads which are trying to push debug information onto their buffer. The user should therefore choose a point in time when NxLib is not performing time critical computations for his application to retrieve debug information.

Parameters
  • result – A pointer to a variable for the return code of the operation. The following return codes can occur:

    • NxLibOperationSucceeded - The operation completed successfully. No error occurred.

    • NxLibInvalidParameters - One, multiple, or a combination of parameters are invalid.

    • NxLibDebugMessageOverflow - The message buffer has overflown and older messages had to be dropped.

    • NxLibInternalError - An unknown internal error occurred.

  • destinationBuffer – Pointer to an allocated memory block.

  • bufferSize – Size of the destination buffer.

  • bytesRemaining – Pointer to an integer. Will be set to the number of remaining bytes in the debug buffer after the read operation.

  • clearRead – When set to true the operation will also remove the retrieved content from the debug buffer.

template<typename T>
static void nxLibGetDebugBuffer(std::vector<T> &data, bool clearRead = true, bool *overflow = 0)

See

nxLibGetDebugBuffer(int32_t*, void*, int32_t, int32_t*, int32_t)

Note

C++ only This function is an overload accessible only in C++. Instead of returning the result code as an output parameter like its C counterpart, it throws an NxLibException in case of an error.

Template Parameters

T – Element type of the std::vector.

Parameters
  • data – Vector to hold the retrieved debug information. The size of the vector is automatically adjusted to hold all the available debug information.

  • clearRead – If set to true, the operation will also remove the retrieved content from the debug buffer.

  • overflow – Indicates if the buffer has overflowed since the last read operation and older debug information has been lost. This boolean indicates a result equal to NxLibDebugMessageOverflow, in which case no exception is thrown.