2#ifndef INTARNA_GENERAL_H_
3#define INTARNA_GENERAL_H_
12#include "IntaRNA/intarna_config.h"
18#if defined(_DEBUG) || !defined(NDEBUG)
19 #define INTARNA_IN_DEBUG_MODE 1
21 #define INTARNA_IN_DEBUG_MODE 0
26#include "easylogging++.h"
30template<
class T>
void INTARNA_CLEANUP( T *& pointer) {
if (pointer != NULL) {
delete pointer; pointer=NULL;} }
36 #define INTARNA_NOT_IMPLEMENTED(message) \
37 throw std::runtime_error( \
38 std::string("\nSTOP DUE TO MISSING IMPLEMENTATION : ") \
46 #define INTARNA_CHECK_NOT_NULL(pointer,message) if (pointer == NULL) { \
47 throw std::runtime_error( \
48 std::string("\nSTOP DUE TO NULL POINTER : ") \
55#include <boost/lexical_cast.hpp>
58 #error toString already defined
60 #define toString( x ) boost::lexical_cast<std::string>(x)
68#if INTARNA_MULTIPRECISION
69 #include <boost/multiprecision/float128.hpp>
79 const E_type E_INF = (std::numeric_limits<E_type>::max() / 8) + 1;
83#if INTARNA_MULTIPRECISION
84 typedef boost::multiprecision::float128
Z_type;
85 #define Z_log boost::multiprecision::log
86 #define Z_exp boost::multiprecision::exp
89 #define Z_log std::log
90 #define Z_exp std::exp
96#ifdef IntaRNA_precisionEpsilon
97 #error IntaRNA_precisionEpsilon already defined
101#define IntaRNA_precisionEpsilon std::sqrt(std::numeric_limits<float>::min())
104 #error E_2_Ekcal already defined
107#define E_2_Ekcal( e ) ( static_cast<E_kcal_type>(e) / 100.0 )
110 #error Ekcal_2_E already defined
113#define Ekcal_2_E( e ) ( static_cast<E_type>(e * 100) )
116 #error E_2_Z already defined
119#define E_2_Z( e ) ( static_cast<Z_type>(e) / 100.0 )
122 #error Z_2_E already defined
125#define Z_2_E( e ) ( static_cast<E_type>(e * 100) )
128 #error E_equal already defined
131#define E_equal( e1, e2 ) ( e1 == e2 )
134 #error E_isNotINF already defined
137#define E_isNotINF( e ) ( E_INF > e )
140 #error E_isINF already defined
143#define E_isINF( e ) ( E_INF <= e )
148 #error Z_equal already defined
151#if INTARNA_MULTIPRECISION
152 #define Z_equal( e1, e2 ) ( boost::multiprecision::abs((e1)-(e2)) < IntaRNA_precisionEpsilon)
154 #define Z_equal( e1, e2 ) ( std::abs((e1)-(e2)) < IntaRNA_precisionEpsilon)
167 #error Z_isNotINF already defined
170#define Z_isNotINF( e ) ( std::numeric_limits<Z_type>::max() >= e )
173 #error Z_isINF already defined
176#define Z_isINF( e ) ( std::numeric_limits<Z_type>::max() < e )
void INTARNA_CLEANUP(T *&pointer)
Definition general.h:30
Definition Accessibility.h:13
void deleteInputStream(std::istream *&inStream)
int E_type
type for energy values (energy + accessibility [ED]) (internally)
Definition general.h:78
float E_kcal_type
type for energy values in kcal/mol units for in-/output only
Definition general.h:75
std::istream * newInputStream(const std::string &inName)
double Z_type
type for probabilities, RT and Boltzmann values
Definition general.h:88
const Z_type Z_INF
Definition general.h:92
void deleteOutputStream(std::ostream *&outStream)
std::ostream * newOutputStream(const std::string &outName)
const E_type E_MAX
Definition general.h:80
const E_type E_INF
Definition general.h:79