stub_analytics_plugin
1.6
Network Optix Video Analytics SDK
|
#include <iostream>
#include <cstdint>
#include <functional>
#include <sstream>
#include <memory>
#include <nx/kit/utils.h>
Go to the source code of this file.
Classes | |
class | nx::kit::debug::detail::Timer |
class | nx::kit::debug::detail::Fps |
Macros | |
#define | NX_KIT_API /*empty*/ |
#define | NX_DEBUG_INI ini(). |
#define | NX_DEBUG_ENABLE_OUTPUT NX_DEBUG_INI enableOutput |
#define | NX_PRINT_PREFIX nx::kit::debug::detail::printPrefix(__FILE__) |
#define | NX_DEBUG_STREAM *nx::kit::debug::stream() |
#define | NX_DEBUG_ENDL << std::endl |
#define | NX_PRINT |
#define | NX_OUTPUT |
#define | NX_KIT_ASSERT(...) |
#define | LL |
#define | NX_PRINT_VALUE(VALUE) NX_PRINT << "####### " #VALUE ": " << nx::kit::utils::toString((VALUE)) |
#define | NX_PRINT_HEX_DUMP(CAPTION, BYTES, SIZE) |
#define | NX_DEBUG_ENABLE_TIME NX_DEBUG_INI enableTime |
#define | NX_TIME_BEGIN(TAG) |
#define | NX_TIME_MARK(TAG, MARK) |
#define | NX_TIME_END(TAG) |
#define | NX_DEBUG_ENABLE_FPS NX_DEBUG_INI enableFps |
#define | NX_FPS(TAG, ...) |
#define | NX_KIT_DEBUG_DETAIL_MSVC_EXPAND(ARG) ARG |
#define | NX_KIT_DEBUG_DETAIL_GET_3RD_ARG(ARG1, ARG2, ARG3, ...) ARG3 |
#define | NX_KIT_DEBUG_DETAIL_ASSERT1(CONDITION) NX_KIT_DEBUG_DETAIL_ASSERT(CONDITION, "") |
#define | NX_KIT_DEBUG_DETAIL_ASSERT2(CONDITION, MESSAGE) NX_KIT_DEBUG_DETAIL_ASSERT(CONDITION, MESSAGE) |
#define | NX_KIT_DEBUG_DETAIL_ASSERT(CONDITION, MESSAGE) |
#define | NX_KIT_DEBUG_DETAIL_CONCAT(X, Y) NX_KIT_DEBUG_DETAIL_CONCAT2(X, Y) |
#define | NX_KIT_DEBUG_DETAIL_CONCAT2(X, Y) X##Y |
#define | NX_KIT_DEBUG_DETAIL_PRINT_FUNC [&](const char* message) { NX_PRINT << message; } |
#define | NX_KIT_DEBUG_DETAIL_THREAD_ID() "" |
Typedefs | |
typedef std::function< void(const char *)> | nx::kit::debug::detail::PrintFunc |
Utilities for debugging: measuring execution time and FPS, working with strings, logging values and messages.
This unit can be compiled in the context of any C++ project.
#define LL |
#define NX_DEBUG_ENABLE_FPS NX_DEBUG_INI enableFps |
Redefine if needed. Will be suffixed with Fps TAG values.
#define NX_DEBUG_ENABLE_OUTPUT NX_DEBUG_INI enableOutput |
Redefine if needed.
#define NX_DEBUG_ENABLE_TIME NX_DEBUG_INI enableTime |
Redefine if needed.
#define NX_DEBUG_ENDL << std::endl |
Redefine if needed; used after NX_DEBUG_STREAM by other macros.
#define NX_DEBUG_INI ini(). |
Define if needed to redirect NX_PRINT... to qDebug(). If needed, redefine to form a prefix for NX_DEBUG_ENABLE... macros.
#define NX_DEBUG_STREAM *nx::kit::debug::stream() |
Redefine if needed; used for all output by other macros.
#define NX_FPS | ( | TAG, | |
... | |||
) |
Measure and print with NX_PRINT each period between executions of the point of call; do nothing if !NX_DEBUG_ENABLE_FPS##TAG.
#define NX_KIT_ASSERT | ( | ... | ) |
If the condition is false, log the failure with NX_PRINT, and in debug build (i.e. NDEBUG is not defined), crash the process to let a dump/core be generated.
ATTENTION: Unlike std library assert(), the condition is checked even in Release build to log the failure.
#define NX_KIT_DEBUG_DETAIL_ASSERT | ( | CONDITION, | |
MESSAGE | |||
) |
#define NX_KIT_DEBUG_DETAIL_GET_3RD_ARG | ( | ARG1, | |
ARG2, | |||
ARG3, | |||
... | |||
) | ARG3 |
Needed to make an "overloaded" macro which can accept either one or two args.
#define NX_KIT_DEBUG_DETAIL_MSVC_EXPAND | ( | ARG | ) | ARG |
Needed as a workaround for an MSVC issue: if VA_ARGS is used as an argument to another macro, it forms a single macro argument even if contains commas.
#define NX_OUTPUT |
Print the args like NX_PRINT; do nothing if !NX_DEBUG_ENABLE_OUTPUT.
#define NX_PRINT |
Print the args to NX_DEBUG_STREAM, starting with NX_PRINT_PREFIX and ending with NX_DEBUG_ENDL. Redefine if needed.
#define NX_PRINT_HEX_DUMP | ( | CAPTION, | |
BYTES, | |||
SIZE | |||
) |
Hex-dump binary data using NX_PRINT.
#define NX_PRINT_PREFIX nx::kit::debug::detail::printPrefix(__FILE__) |
Redefine if needed; used as the first item in NX_PRINT and NX_OUTPUT.
#define NX_PRINT_VALUE | ( | VALUE | ) | NX_PRINT << "####### " #VALUE ": " << nx::kit::utils::toString((VALUE)) |
Print the expression text and its value via toString().
#define NX_TIME_BEGIN | ( | TAG | ) |
Start measuring time - save current time in a variable; do nothing if !NX_DEBUG_ENABLE_TIME.
#define NX_TIME_END | ( | TAG | ) |
Print the totals of this time measurement with NX_PRINT; do nothing if !NX_DEBUG_ENABLE_TIME.
#define NX_TIME_MARK | ( | TAG, | |
MARK | |||
) |
Measure the time in the intermediate point, to be printed at the end; do nothing if !NX_DEBUG_ENABLE_TIME. If called at least once, forces "ms" instead of "us" for the totals.
NX_KIT_API char nx::kit::debug::pathSeparator | ( | ) |
NX_KIT_API std::string nx::kit::debug::detail::printPrefix | ( | const char * | file | ) |
file | Supply FILE. |
NX_KIT_API const char * nx::kit::debug::relativeSrcFilename | ( | const char * | file | ) |
Extract part of the source code filename which follows the uninteresting common part.
NX_KIT_API std::ostream *& nx::kit::debug::stream | ( | ) |
Allows to override the stream used by NX_PRINT via NX_DEBUG_STREAM, initially std::cerr.