41 #define OGDF_ASSERT(expr) 42 #define OGDF_ASSERT_IF(minLevel,expr) 45 #define OGDF_SET_DEBUG_LEVEL(level) 51 # ifndef OGDF_USE_ASSERT_EXCEPTIONS 53 # define OGDF_ASSERT(expr) assert(expr) 63 class AssertionFailed :
public std::runtime_error {
64 using std::runtime_error::runtime_error;
68 # define OGDF_ASSERT(expr) do { \ 70 std::stringstream ogdf_assert_ss; \ 72 << "OGDF assertion `" #expr "' failed at " __FILE__ ":" \ 74 << "(" << OGDF_FUNCTION_NAME << ")"; \ 75 ogdf::get_stacktrace(ogdf_assert_ss); \ 76 throw ogdf::AssertionFailed(ogdf_assert_ss.str()); \ 79 # undef OGDF_ASSERT_IF 80 # define OGDF_ASSERT_IF(minLevel,expr) do { \ 81 if (int(ogdf::debugLevel) >= int(minLevel)) { \ 84 # undef OGDF_SET_DEBUG_LEVEL 85 # define OGDF_SET_DEBUG_LEVEL(level) ogdf::debugLevel = level 104 using std::numeric_limits;
127 #ifdef OGDF_USE_ASSERT_EXCEPTIONS 128 extern void get_stacktrace(std::ostream &);
169 x1 = 2.0 * rndVal - 1.0;
171 double x2 = 2.0 * rndVal - 1.0;
175 w = sqrt((-2.0 * log(w))/w) ;
211 template<
typename CONTAINER,
typename T>
215 for (
const T &y : C) {
236 enum class DebugLevel {
242 extern DebugLevel debugLevel;
245 bool debugLevelIsAtLeast(
const DebugLevel& dl);
261 virtual int getBucket(
const E &x) = 0;
273 using std::to_string;
bool equalIgnoreCase(const string &str1, const string &str2)
Compares the two strings str1 and str2, ignoring the case of characters.
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
double randomDoubleNormal(double m, double sd)
Returns a random double value from the normal distribution with mean m and standard deviation sd...
int randomNumber(int low, int high)
Returns random integer between low and high (including).
Basic configuration file.
static Initialization s_ogdfInitializer
long unsigned int randomSeed()
Returns a random value suitable as initial seed for a random number engine.
void removeTrailingWhitespace(string &str)
Removes trailing space, horizontal and vertical tab, feed, newline, and carriage return from str...
double randomDouble(double low, double high)
Returns a random double value from the interval [low, high).
double usedTime(double &T)
Returns used CPU time from T to current time and assigns current time to T.
The class Initialization is used for initializing global variables.
Abstract base class for bucket functions.
The namespace for all OGDF objects.
bool prefixIgnoreCase(const string &prefix, const string &str)
Tests if prefix is a prefix of str, ignoring the case of characters.
void setSeed(int val)
Sets the seed for functions like randomSeed(), randomNumber(), randomDouble().
int searchPos(const CONTAINER &C, const T &x)
Searches for the position of x in container C; returns -1 if not found.