TBTK
Need a break? Support the development by playing Polarity Puzzles
TBTKMacros.h File Reference

Precompiler macros. More...

#include "TBTK/Streams.h"
#include <chrono>
#include <cstring>
#include <ctime>
#include <sstream>
#include <string>

Go to the source code of this file.

Macros

#define TBTK_VERSION_STRING
 
#define TBTK_ABOUT_STRING
 
#define TBTK_RUNTIME_CONTEXT_STRING
 
#define TBTKAssert(expression, function, message, hint)
 
#define TBTKExceptionAssert(expression, exception)
 
#define TBTKExit(function, message, hint)
 
#define TBTKNotYetImplemented(function)
 
#define TBTKReadableCodeBlock(code)   ;
 
#define TBTKWhere   std::string(__FILE__) + ", " + std::to_string(__LINE__)
 

Functions

std::string TBTK_GET_CURRENT_TIME_STRING ()
 

Detailed Description

Precompiler macros.

Author
Kristofer Björnson

Macro Definition Documentation

◆ TBTK_ABOUT_STRING

#define TBTK_ABOUT_STRING
Value:
"TBTK\n" \
"Version:\t" + TBTK_VERSION_STRING + "\n" \
"Git hash:\t" TBTK_VERSION_GIT_HASH

◆ TBTK_RUNTIME_CONTEXT_STRING

#define TBTK_RUNTIME_CONTEXT_STRING
Value:
TBTK_ABOUT_STRING + "\n" \
+ "Date:\t" + TBTK_GET_CURRENT_TIME_STRING()

◆ TBTK_VERSION_STRING

#define TBTK_VERSION_STRING
Value:
std::to_string(TBTK_VERSION_MAJOR) + "." \
+ std::to_string(TBTK_VERSION_MINOR) + "." \
+ std::to_string(TBTK_VERSION_PATCH)

◆ TBTKAssert

#define TBTKAssert (   expression,
  function,
  message,
  hint 
)
Value:
if(!(expression)){ \
TBTK::Streams::err << "Error in " << function << "\n"; \
TBTK::Streams::err << "\t" << message << "\n"; \
std::stringstream hintStream; \
hintStream << hint; \
if(std::strcmp(hintStream.str().c_str(), "") != 0) \
TBTK::Streams::err << "\tHint: " << hint << "\n"; \
TBTK::Streams::err << "\tWhere: " << __FILE__ << ", " << __LINE__ << "\n"; \
exit(1); \
}

◆ TBTKExceptionAssert

#define TBTKExceptionAssert (   expression,
  exception 
)
Value:
if(!(expression)) \
throw exception;

◆ TBTKExit

#define TBTKExit (   function,
  message,
  hint 
)
Value:
TBTK::Streams::err << "Error in " << function << "\n"; \
TBTK::Streams::err << "\t" << message << "\n"; \
std::stringstream hintStream; \
hintStream << hint; \
if(std::strcmp(hintStream.str().c_str(), "") != 0) \
TBTK::Streams::err << "\tHint: " << hint << "\n"; \
TBTK::Streams::err << "\tWhere: " << __FILE__ << ", " << __LINE__ << "\n"; \
exit(1);

◆ TBTKNotYetImplemented

#define TBTKNotYetImplemented (   function)
Value:
TBTK::Streams::err << "Error in " << function << "\n"; \
TBTK::Streams::err << "\tNot yet implemented.\n"; \
TBTK::Streams::err << "\tWhere: " << __FILE__ << ", " << __LINE__ << "\n"; \
exit(1);
TBTK::Streams::err
static std::ostream err
Definition: Streams.h:76
TBTK::Streams::closeLog
static void closeLog()
TBTK::Streams::logIsOpen
static bool logIsOpen()