12 #ifndef __MOOSE_GLOBAL_INC_
13 #define __MOOSE_GLOBAL_INC_
19 #include "../randnum/RNG.h"
20 #include "../utility/print_function.hpp"
40 #define TEST_BEGIN cout << endl << "Test(" << totalTests << "): " << SIMPLE_CURRENT_FUNCTION;
41 #define TEST_END totalTests++; \
42 cout << std::right << setw(20) << "test of " << SIMPLE_CURRENT_FUNCTION << " finished.";
44 #define MISSING_BRACKET_AT_END -1
46 #define SPACES_AT_THE_BEGINING -3
47 #define SPACES_AT_THE_END -4
48 #define SPACES_IN_BETWEEN -5
49 #define BAD_CHARACTER_IN_PATH -6
98 string joinPath(
string pathA,
string pathB);
105 void mtseed(
unsigned int seed );
156 string getExtension(
const string& path,
bool without_dot =
true );
void mtseed(unsigned int x)
Set the global seed or all rngs.
string fixPath(string path)
Fix a path. For testing purpose.
string toString(double x)
Convert a given value to string.
string pathToName(const string &path)
Return the name when path is given. Its behaviour is exactly the same as of basename command on unix ...
bool createParentDirs(const string &path)
Create directories recursively needed to open the given file p.
string getExtension(const string &path, bool without_dot)
Get the extension of a given filepath.
stringstream errorSS
Global stringstream for message printing.
string moosePathToUserPath(string path)
When user gives a path /a/b/c, moose creates a path /a[0]/b[0]/c[0]. This is helpful in cases where o...
void setGlobalSeed(int seed)
string joinPath(string pathA, string pathB)
Append pathB to pathA and return the result.
unsigned long __rng_seed__
A global seed for all RNGs in moose. When moose.seed( x ) is called, this variable is set...
string toFilename(const string &path)
Replace all directory sepearator with _. This creates a filepath which can be created in current dire...
string createMOOSEPath(const string &path)
Create a POSIX compatible path from a given string. Remove/replace bad characters.
int checkPath(const string &path)
Checks if given path is correct. If not, return false and error-code as well.
double mtrand(void)
Generate a random double between 0 and 1.
unsigned int totalTests
Keep tracks of how many tests have been executed in moose.