45 #include <sys/types.h> 47 #include <sys/timeb.h> 54 #define GCC_VERSION ( __GNUC__ * 10000 \ 55 + __GNUC_MINOR__ * 100 \ 56 + __GNUC_PATCHLEVEL__ ) 57 #if (__GNUC__ >= 3) && !defined(_LIBCPP_VERSION) 58 #define HAVE_STDIO_FILEBUF 1 62 #ifdef HAVE_STDIO_FILEBUF 63 #include <ext/stdio_filebuf.h> 64 using namespace __gnu_cxx;
72 #if ( defined ( __GNUC__ ) ) && ( GCC_VERSION >= 40200 ) && !( defined ( __INTEL_COMPILER ) ) && !( defined ( __NVCC__ ) ) 73 #define __PRAGMA(P) _Pragma(#P) 74 #define __WARNING_OFF(WARN) __PRAGMA(GCC diagnostic ignored #WARN) 75 #define __WARNING_ON(WARN) __PRAGMA(GCC diagnostic warning #WARN) 76 #define WARNING_OFF(WARN) __WARNING_OFF(-W ## WARN) 77 #define WARNING_ON(WARN) __WARNING_ON(-W ## WARN) 79 #define WARNING_OFF(WARN) 80 #define WARNING_ON(WARN) 86 template <
typename _DomainType,
typename _RangeType = _DomainType>
98 virtual void apply (
const DomainType &Arg, RangeType &Dest )
const = 0;
107 const string red =
"\033[0;31m";
110 const string blue =
"\033[0;34m";
112 const string cyan =
"\033[0;36m";
119 const string pink =
"\033[1;35m";
129 template<
class T>
inline T
Min (
const T a,
const T b ) {
return ( ( a < b ) ? a : b ); }
130 template<
class T>
inline T
Max (
const T a,
const T b ) {
return ( ( a < b ) ? b : a ); }
134 template<
class T>
inline T
Sqr (
const T a) {
return a * a; }
137 template<
class T>
inline T
signum (
const T x ) {
138 if (x > 0.0)
return 1;
139 else if (x == 0.0)
return 0;
140 else if (x < 0.0)
return -1;
145 string strprintf(
const char * format, ...);
147 void makeDirectory (
const char *DirectoryName,
bool verbose =
true );
T signum(const T x)
Signum function template, signum ( 0 ) = 0.
T Min(const T a, const T b)
T Clamp(const T Value, const T Min, const T Max)
bool fileExists(std::string filename)
string strprintf(const char *format,...)
Give back formatted string, analogously to sprintf, but save the long way 'round with char arrays...
void makeDirectory(const char *DirectoryName, bool verbose)
T Max(const T a, const T b)