TBTK
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

#define TBTK_ABOUT_STRING
Value:
"TBTK\n" \
"Version:\t" + TBTK_VERSION_STRING + "\n" \
"Git hash:\t" TBTK_VERSION_GIT_HASH
#define TBTK_RUNTIME_CONTEXT_STRING
Value:
TBTK_ABOUT_STRING + "\n" \
+ "Date:\t" + TBTK_GET_CURRENT_TIME_STRING()
#define TBTK_VERSION_STRING
Value:
std::to_string(TBTK_VERSION_MAJOR) + "." \
+ std::to_string(TBTK_VERSION_MINOR) + "." \
+ std::to_string(TBTK_VERSION_PATCH)
#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); \
}
static bool logIsOpen()
static void closeLog()
static std::ostream err
Definition: Streams.h:42
#define TBTKExceptionAssert (   expression,
  exception 
)
Value:
if(!(expression)) \
throw exception;
#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);
static bool logIsOpen()
static void closeLog()
static std::ostream err
Definition: Streams.h:42
#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);
static bool logIsOpen()
static void closeLog()
static std::ostream err
Definition: Streams.h:42