|  | Elementa v8.0.0
    Minimalistic library for any C++ application (C++11 and up) | 
Functionality to debug/trace source code.
This system allows the programmer to insert traces inside portions of code (routines, methods, etc.) locally, i.e., activating/deactivating it independently in each portion. Also, all traces inside a given file can be deactivated globally if desired.
Usage:
.cpp, before including this header or any other that needs debugging, write: std::cout.Example:
  \code
  "something.cpp":
  ...
  // This define has no effect in production mode:
  #define ELE_PRE_TRACED
  ...
  void afunction(void)
  {
  ELE_CODE_TRACE_ON; // This statement does not insert code here.
      // This trace may insert extra code even if ELE_CODE_TRACE_OFF:
      ELE_CODE_TRACE({RTTextWith::kTime},
                     "beginning with var = " << myvar);
      std::cout << "This routine is being traced..." << std::endl;
      // This particular trace has been deactivated, and does not
      // generate any code.
      ELE_CODE_UNTRACE({RTTextWith::kTime, RTTextWith::kThread},
                       "an old trace");
  }
  ...
  \endcode
 .cpp with ELE_PRE_TRACED defined will ignore those ELE_PRE_TRACED and will contain no tracing code at all..cpp, but setting ELE_CODE_TRACE_OFF locally may produce some code (e.g., previously to C++17; see the ELE_CODE_TRACE documentation). Anyway, ELE_CODE_UNTRACE never generates code, and the code enclosed in ELE_CODE_TRACE_IF / ENDIF will always be there although it may not execute, unless the compiler get rid of code guarded by an if (false).{}.std::chrono::steady_clock as a clock and always shows time in microseconds.
| UTILITIES FOR SOURCE CODE INSPECTION IN RUN-TIME | |
| constexpr char | elementa::base::kHiddenPlaceMsg [] = "place hidden in production" | 
| Constant text hiding runtime place when the program is in production.  More... | |
| elementa::base::ELE_CLASS_ENUM (RTTextWith, kTime, kThread) | |
| Flags for selecting what to include in runtime text in addition to the place.  More... | |
| std::string | elementa::base::runtime_src_place (const std::string &place, const RTTextWithEnum::Combination &flags={}, const std::string &placepreff="Place:", const std::string &timepreff="Time:", const std::string &threadpreff="Thread:") | 
| Return a string with info about a place, time and thread during execution.  More... | |
| #define | ELE_PRE_FILELONGNAME std::string{__FILE__} | 
| Long name of the current source file, as a std::string.  More... | |
| #define | ELE_PRE_FILEBASENAME | 
| Base name of current src file (computed in runtime), as a std::string.  More... | |
| #define | ELE_CODE_PLACE | 
| Produces a std::stringwith the place of source where the macro is placed.  More... | |
| #define | ELE_CODE_LONGPLACE | 
| Produces a string with the place of source code where the macro is placed.  More... | |
| TRACING SYSTEM | |
| #define | ELE_CODE_TRACE_ON | 
| Place this inside local scope (e.g., routine) to activate traces there.  More... | |
| #define | ELE_CODE_TRACE_OFF | 
| Place this inside local scope (e.g., routine) to deactivate traces there.  More... | |
| #define | ELE_CODE_TRACE_IF if (false) { | 
| Place this before a part of code that should be executed in debug only.  More... | |
| #define | ELE_CODE_TRACE_ELSE } else { | 
| Place this between if and endif.  More... | |
| #define | ELE_CODE_TRACE_ENDIF } | 
| Place this after a part of code that should be executed in debug only.  More... | |
| #define | ELE_PRE_TRACE_PREFFIX "--- TR : " | 
| Preffix added to any trace.  More... | |
| #define | ELE_CODE_TRACE(flags, ...) {} | 
| #define | ELE_CODE_TRACEPOINT {} | 
| #define | ELE_CODE_TRACENUDE(...) {} | 
| #define | ELE_CODE_PAUSE(flags, ...) {} | 
| #define | ELE_CODE_UNTRACE(flags, ...) | 
| Macro to use instead of an existing ELE_CODE_TRACE to deactivate that trace.  More... | |
| #define | ELE_CODE_UNTRACEPOINT | 
| Macro to use instead of an existing ELE_CODE_TRACEPOINT to deactivate it.  More... | |
| #define | ELE_CODE_UNPAUSE(flags, ...) | 
| Macro to use instead of an existing ELE_CODE_PAUSE to deactivate that trace.  More... | |
| #define | ELE_CODE_UNTRACE_IF if (false) { | 
| Macro to use instead of an existing ELE_CODE_TRACE_IF to deactivate it.  More... | |
| #define | ELE_CODE_UNTRACE_ELSE } else { | 
| Macro to use instead of an existing ELE_CODE_TRACE_ELSE to deactivate it.  More... | |
| #define | ELE_CODE_UNTRACE_ENDIF } | 
| Macro to use instead of an existing ELE_CODE_TRACE_ENDIF to deactivate it.  More... | |
| #define ELE_PRE_FILELONGNAME std::string{__FILE__} | 
#include <elementa/base/debugging.h>
Long name of the current source file, as a std::string. 
Definition at line 171 of file debugging.h.
| #define ELE_PRE_FILEBASENAME | 
#include <elementa/base/debugging.h>
Base name of current src file (computed in runtime), as a std::string. 
Definition at line 174 of file debugging.h.
| #define ELE_CODE_PLACE | 
#include <elementa/base/debugging.h>
Produces a std::string with the place of source where the macro is placed. 
This is the short version, producing just the basename of the file.
.cpp where this macro is used must have a #define ELE_PRE_TRACED at the beginning.Definition at line 194 of file debugging.h.
| #define ELE_CODE_LONGPLACE | 
#include <elementa/base/debugging.h>
Produces a string with the place of source code where the macro is placed.
This is the long-text version, producing the entire path of the file.
Definition at line 199 of file debugging.h.
| #define ELE_CODE_TRACE_ON | 
#include <elementa/base/debugging.h>
Place this inside local scope (e.g., routine) to activate traces there.
This does not occupy room in memory; it is absorbed during compilation
Definition at line 279 of file debugging.h.
| #define ELE_CODE_TRACE_OFF | 
#include <elementa/base/debugging.h>
Place this inside local scope (e.g., routine) to deactivate traces there.
This does not occupy room in memory; it is absorbed during compilation
Definition at line 283 of file debugging.h.
| #define ELE_CODE_TRACE_IF if (false) { | 
#include <elementa/base/debugging.h>
Place this before a part of code that should be executed in debug only.
When ELE_CODE_TRACE_OFF is set in the scope of this, the code between ELE_CODE_TRACE_IF and ELE_CODE_TRACE_ENDIF will still be there, but never executed.
Definition at line 289 of file debugging.h.
| #define ELE_CODE_TRACE_ELSE } else { | 
#include <elementa/base/debugging.h>
Place this between if and endif.
Definition at line 292 of file debugging.h.
| #define ELE_CODE_TRACE_ENDIF } | 
#include <elementa/base/debugging.h>
Place this after a part of code that should be executed in debug only.
Definition at line 295 of file debugging.h.
| #define ELE_PRE_TRACE_PREFFIX "--- TR : " | 
#include <elementa/base/debugging.h>
Preffix added to any trace.
Definition at line 307 of file debugging.h.
| #define ELE_CODE_TRACE | ( | flags, | |
| ... | |||
| ) | {} | 
#include <elementa/base/debugging.h>
Definition at line 426 of file debugging.h.
| #define ELE_CODE_TRACEPOINT {} | 
#include <elementa/base/debugging.h>
Definition at line 428 of file debugging.h.
| #define ELE_CODE_TRACENUDE | ( | ... | ) | {} | 
#include <elementa/base/debugging.h>
Definition at line 430 of file debugging.h.
| #define ELE_CODE_PAUSE | ( | flags, | |
| ... | |||
| ) | {} | 
#include <elementa/base/debugging.h>
Definition at line 432 of file debugging.h.
| #define ELE_CODE_UNTRACE | ( | flags, | |
| ... | |||
| ) | 
#include <elementa/base/debugging.h>
Macro to use instead of an existing ELE_CODE_TRACE to deactivate that trace.
Definition at line 437 of file debugging.h.
| #define ELE_CODE_UNTRACEPOINT | 
#include <elementa/base/debugging.h>
Macro to use instead of an existing ELE_CODE_TRACEPOINT to deactivate it.
Definition at line 440 of file debugging.h.
| #define ELE_CODE_UNPAUSE | ( | flags, | |
| ... | |||
| ) | 
#include <elementa/base/debugging.h>
Macro to use instead of an existing ELE_CODE_PAUSE to deactivate that trace.
Definition at line 443 of file debugging.h.
| #define ELE_CODE_UNTRACE_IF if (false) { | 
#include <elementa/base/debugging.h>
Macro to use instead of an existing ELE_CODE_TRACE_IF to deactivate it.
The associated ELE_CODE_TRACE_ELSE and ELE_CODE_TRACE_ENDIF must not be modified.
Definition at line 448 of file debugging.h.
| #define ELE_CODE_UNTRACE_ELSE } else { | 
#include <elementa/base/debugging.h>
Macro to use instead of an existing ELE_CODE_TRACE_ELSE to deactivate it.
Definition at line 451 of file debugging.h.
| #define ELE_CODE_UNTRACE_ENDIF } | 
#include <elementa/base/debugging.h>
Macro to use instead of an existing ELE_CODE_TRACE_ENDIF to deactivate it.
Definition at line 454 of file debugging.h.
| elementa::base::ELE_CLASS_ENUM | ( | RTTextWith | , | 
| kTime | , | ||
| kThread | |||
| ) | 
#include <elementa/base/debugging.h>
Flags for selecting what to include in runtime text in addition to the place.
| std::string elementa::base::runtime_src_place | ( | const std::string & | place, | 
| const RTTextWithEnum::Combination & | flags = {}, | ||
| const std::string & | placepreff = "Place:", | ||
| const std::string & | timepreff = "Time:", | ||
| const std::string & | threadpreff = "Thread:" | ||
| ) | 
#include <elementa/base/debugging.h>
Return a string with info about a place, time and thread during execution.
It fills with nothing those parts that are given empty. Usage:
    \code
    runtime_src_place("plc" (use here ELE_CODE_PLACE, ELE_CODE_LONGPLACE or
                             any location string you wish),
                      {...flags of info to include...},
                      [  "Preffix of the place part of the result",
                         "Preffix of the time part of the result",
                         "Preffix of the thread part of the result" ]
                     );
    \endcode
 
| 
 | constexpr | 
#include <elementa/base/debugging.h>
Constant text hiding runtime place when the program is in production.
Definition at line 158 of file debugging.h.