tools.h File Reference
#include <sys/resource.h>
#include <cassert>
#include <iomanip>
#include <iostream>
#include <fstream>
#include <vector>
#include <map>
#include <list>
#include <set>
Go to the source code of this file.
Classes |
| class | Pointer< Type > |
| | A Smartpointer with reference counter. More...
|
| class | Timer |
| | Initialize the random-number-generator, using srand(time(NULL)). More...
|
Defines |
| #define | rtol 1e-10 |
| #define | MIN(a, b) ((a) <= (b) ? (a) : (b)) |
| #define | MAX(a, b) ((a) >= (b) ? (a) : (b)) |
| #define | INFINITY 1e99 |
| #define | INF 65535 |
| #define | out_out if (out_out_p) (*out_out_p) |
| #define | out_log if (out_log_p) (*out_log_p) |
| #define | out_err if (out_err_p) (*out_err_p) |
Functions |
| void | print_all_Pointer (ostream &out) |
| | Prints all registered pointers and the number of Pointers to each of them.
|
| int | random (int lb, int ub) |
| | Gives a random integer.
|
| double | random (double lb, double ub) |
| | Gives a random double.
|
| unsigned int | get_mem () |
| int | start_process (const char *name, char *const *const args, int timelimit=0, const char *envvarname=NULL, const char *envvarvalue=NULL) |
Variables |
| map< const void *, int > | refcount |
| | The (global) counters for the objects, we point to and want to delete.
|
| Pointer< ostream > | out_out_p |
| Pointer< ostream > | out_log_p |
| Pointer< ostream > | out_err_p |
Define Documentation
| #define MIN |
( |
a, |
|
|
b |
|
) |
((a) <= (b) ? (a) : (b)) |
| #define MAX |
( |
a, |
|
|
b |
|
) |
((a) >= (b) ? (a) : (b)) |
Function Documentation
| void print_all_Pointer |
( |
ostream & |
out |
) |
|
Prints all registered pointers and the number of Pointers to each of them.
- Parameters:
-
| out | The ostream to print to. |
| int random |
( |
int |
lb, |
|
|
int |
ub | |
|
) |
| | |
Gives a random integer.
- Parameters:
-
| lb | The lower bound. |
| ub | The upper bound. |
- Returns:
- A random integer x {lb, ..., ub}.
| double random |
( |
double |
lb, |
|
|
double |
ub | |
|
) |
| | |
Gives a random double.
- Parameters:
-
| lb | The lower bound. |
| ub | The upper bound. |
- Returns:
- A uniformly distributed random number from (lb, ub).
| int start_process |
( |
const char * |
name, |
|
|
char *const *const |
args, |
|
|
int |
timelimit = 0, |
|
|
const char * |
envvarname = NULL, |
|
|
const char * |
envvarvalue = NULL | |
|
) |
| | |
Variable Documentation
The (global) counters for the objects, we point to and want to delete.