OpenASIP  2.0
Classes | Macros | Variables
Application.hh File Reference
#include <cstdlib>
#include <string>
#include <iostream>
#include <vector>
#include <signal.h>
#include <map>
Include dependency graph for Application.hh:

Go to the source code of this file.

Classes

class  Application
 
class  Application::UnixSignalHandler
 

Macros

#define UNKNOWN_FUNCTION   "[?]"
 
#define __func__   UNKNOWN_FUNCTION
 
#define abortWithError(message)
 
#define assert(condition)
 
#define debugLog(text)
 
#define CATCH_ANY(XXX__)
 
#define verboseLogC(text, neededVerbosity)
 
#define verboseLog(text)   verboseLogC(text, 1)
 
#define PRINT_VAR(VARIABLE__)
 

Variables

const int DEFAULT_MAX_OUTPUT_LINES = 200
 default value of maximum amount of output lines saved from popen() output in runShellCommandAndGetOutput() More...
 
const int MAX_OUTPUT_LINE_LENGTH = 512
 maximum length of an output line saved from popen() output in runShellCommandAndGetOutput() More...
 

Detailed Description

Declaration of Application class and services of standalone applications.

Application is a class for generic services that are project-wide applicable to standalone applications or modules. These services include assertion, program exiting, debugging to a log file, catching unexpected exceptions and "control-c", SIGFPE and SIGSEGV signal handling.

Author
Atte Oksman 2003 (oksman-no.spam-cs.tut.fi)
Pekka Jääskeläinen 2005-2012 (pjaaskel-no.spam-cs.tut.fi)

Definition in file Application.hh.

Macro Definition Documentation

◆ __func__

#define __func__   UNKNOWN_FUNCTION

Definition at line 67 of file Application.hh.

◆ abortWithError

#define abortWithError (   message)
Value:

Definition at line 72 of file Application.hh.

◆ assert

#define assert (   condition)
Value:
if (!(condition)) { \
abortWithError("Assertion failed: " #condition); \
}

Definition at line 86 of file Application.hh.

◆ CATCH_ANY

#define CATCH_ANY (   XXX__)
Value:
try { XXX__; } \
catch (const Exception& e) { \
debugLog(e.errorMessage() + " in " + \
e.fileName() + ":" + \
e.procedureName() + ":" + \
catch ( ... ) { debugLog("Unknown exception"); }

Definition at line 100 of file Application.hh.

◆ debugLog

#define debugLog (   text)
Value:
Application::writeToErrorLog(__FILE__, __LINE__, __func__, \
std::string("DEBUG: ") + std::string(text))

Definition at line 95 of file Application.hh.

◆ PRINT_VAR

#define PRINT_VAR (   VARIABLE__)
Value:
Application::logStream() << #VARIABLE__ << " == " \
<< VARIABLE__ << std::endl

Definition at line 118 of file Application.hh.

◆ UNKNOWN_FUNCTION

#define UNKNOWN_FUNCTION   "[?]"

Definition at line 58 of file Application.hh.

◆ verboseLog

#define verboseLog (   text)    verboseLogC(text, 1)

Definition at line 115 of file Application.hh.

◆ verboseLogC

#define verboseLogC (   text,
  neededVerbosity 
)
Value:
if (Application::verboseLevel() >= neededVerbosity) { \
Application::logStream() << text << std::endl; }

Definition at line 110 of file Application.hh.

Variable Documentation

◆ DEFAULT_MAX_OUTPUT_LINES

const int DEFAULT_MAX_OUTPUT_LINES = 200

default value of maximum amount of output lines saved from popen() output in runShellCommandAndGetOutput()

Definition at line 124 of file Application.hh.

◆ MAX_OUTPUT_LINE_LENGTH

const int MAX_OUTPUT_LINE_LENGTH = 512

maximum length of an output line saved from popen() output in runShellCommandAndGetOutput()

Definition at line 128 of file Application.hh.

Referenced by Application::runShellCommandAndGetOutput(), and Application::runShellCommandSilently().

Exception::procedureName
std::string procedureName() const
Exception::lineNum
int lineNum() const
Application::writeToErrorLog
static void writeToErrorLog(const std::string fileName, const int lineNumber, const std::string functionName, const std::string message, const int neededVerbosity=0)
Definition: Application.cc:224
Application::verboseLevel
static int verboseLevel()
Definition: Application.hh:176
Application::logStream
static std::ostream & logStream()
Definition: Application.cc:155
Conversion::toString
static std::string toString(const T &source)
Exception::fileName
std::string fileName() const
__func__
#define __func__
Definition: Application.hh:67
Exception
Definition: Exception.hh:54
Exception::errorMessage
std::string errorMessage() const
Definition: Exception.cc:123
Application::abortProgram
static void abortProgram() __attribute__((noreturn))
Definition: Application.cc:266
debugLog
#define debugLog(text)
Definition: Application.hh:95