utils.h File Reference

Supportive functions. More...

#include <cassert>
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <ctime>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cstdarg>
#include <limits.h>
#include <math.h>

Go to the source code of this file.

Classes

class  FileRead
 Simpler file read. More...
class  Grand
 (game) random generator. More...

Defines

#define STR_LOAD_FAIL   "Fatal error occured while loading position."
#define MAX_THREADS   17
#define GRAND_MAX   0xFFFFFFFF
#define logInfo(...)   logFunction(LL_INFO, __TIME__, __FILE__, __FUNCTION__, __LINE__, __VA_ARGS__)
#define logWarning(...)   logFunction(LL_WARNING, __TIME__, __FILE__, __FUNCTION__, __LINE__, __VA_ARGS__)
#define logError(...)   logFunction(LL_ERROR, __TIME__, __FILE__, __FUNCTION__, __LINE__, __VA_ARGS__)
#define logRaw(...)   logFunction(LL_RAW, __TIME__, __FILE__, __FUNCTION__, __LINE__, __VA_ARGS__)
#define logDebug(...)   logFunction(LL_DEBUG, __TIME__, __FILE__, __FUNCTION__, __LINE__, __VA_ARGS__)
#define logDDebug(...)   ((void)0)
#define SQRT_CACHE_SIZE   10000
#define LOG_CACHE_SIZE   10000

Typedefs

typedef unsigned long long u64
typedef unsigned int uint

Enumerations

enum  logLevel_e {
  LL_DEBUG, LL_WARNING, LL_ERROR, LL_INFO,
  LL_RAW, LL_DDEBUG
}

Functions

void logFunction (logLevel_e logLevel, const char *timestamp, const char *file, const char *function, int line,...)
double rand01 ()
 This function is obsolete ! use grand->get01.
double log_sig (double param, double value)
 Logistic sigmoid.
template<typename T >
max (T a, T b)
template<typename T >
min (T a, T b)
void initCachedFunctions ()
float mylog (int arg)
float mysqrt (int arg)
float mylog (double arg)
float mysqrt (double arg)
int str2int (const string &str)
 String to int converter.
float str2float (const string &str)
 String to float converter.
string trimRight (const string &str)
 Spaces trim from right.
string trimLeft (const string &str)
 Spaces trim from right.
string trim (const string &str)
 Spaces trim from both sides.
string getStreamRest (istream &is)
 Get stream rest.
string replaceAllChars (string s, char c1, char c2)
 Tr analogy.

Variables

float sqrtCache [SQRT_CACHE_SIZE]
float logCache [LOG_CACHE_SIZE]


Detailed Description

Supportive functions.

Includes logger, conversion functions, etc.


Function Documentation

string replaceAllChars ( string  s,
char  c1,
char  c2 
)

Tr analogy.

Replaces all ocurences of c1 in s by c2.


Generated on Thu Aug 6 23:29:07 2009 for akimot by  doxygen 1.5.7.1