Doxygen
Loading...
Searching...
No Matches
debug.cpp File Reference
#include <stdarg.h>
#include <algorithm>
#include <stdio.h>
#include <map>
#include <string>
#include <chrono>
#include "debug.h"
#include "message.h"
#include "dstring.h"
Include dependency graph for debug.cpp:

Go to the source code of this file.

Classes

class  Timer

Functions

static char asciiToLower (char in)
static uint64_t labelToEnumValue (const DString &l)

Variables

static std::map< std::string, Debug::DebugMasks_labels
static FILE * g_debugFile = stdout
static Timer g_runningTime

Function Documentation

◆ asciiToLower()

char asciiToLower ( char in)
static

Definition at line 90 of file debug.cpp.

90 {
91 if (in <= 'Z' && in >= 'A')
92 return in - 'A' + 'a';
93 return in;
94}

Referenced by labelToEnumValue().

◆ labelToEnumValue()

uint64_t labelToEnumValue ( const DString & l)
static

Definition at line 96 of file debug.cpp.

97{
98 std::string s = l.str();
99 std::transform(s.begin(),s.end(),s.begin(),asciiToLower);
100 auto it = s_labels.find(s);
101 return (it!=s_labels.end()) ? it->second : Debug::DebugMask::Quiet;
102}
const std::string & str() const
Definition dstring.h:649
@ Quiet
Definition debug.h:30
static std::map< std::string, Debug::DebugMask > s_labels
Definition debug.cpp:29
static char asciiToLower(char in)
Definition debug.cpp:90

References asciiToLower(), Debug::Quiet, s_labels, and DString::str().

Referenced by Debug::setFlagStr().

Variable Documentation

◆ g_debugFile

FILE* g_debugFile = stdout
static

Definition at line 77 of file debug.cpp.

Referenced by Debug::print_(), and Debug::setFlagStr().

◆ g_runningTime

Timer g_runningTime
static

Definition at line 194 of file debug.cpp.

Referenced by Debug::elapsedTime(), and Debug::startTimer().

◆ s_labels

std::map< std::string, Debug::DebugMask > s_labels
static

Definition at line 29 of file debug.cpp.

Referenced by labelToEnumValue(), and Debug::printFlags().