ODIN
|
Classes | |
class | ndim |
class | tjarray< V, T > |
class | ProgressDisplayDriver |
class | ProgressMeter |
class | LockProxy< T > |
class | SingletonHandler< T, thread_safe > |
class | UniqueIndex< T > |
class | Labeled |
class | List< I, P, R > |
struct | LogMessage |
class | LogBase |
class | Log< C > |
class | RandomDist |
class | MinimizationFunction |
class | Process |
class | Profiler |
class | StaticHandler< T > |
class | UnitTest |
class | Mutex |
class | MutexLock |
class | Event |
class | Thread |
class | ThreadedLoop< In, Out, Local > |
class | TypeTraits |
class | ValList< T > |
class | tjvector< T > |
struct | svector |
Typedefs | |
typedef tjarray< fvector, float > | farray |
typedef tjarray< dvector, double > | darray |
typedef tjarray< ivector, int > | iarray |
typedef tjarray< cvector, STD_complex > | carray |
typedef tjarray< svector, STD_string > | sarray |
typedef void(* | tracefunction) (const LogMessage &msg) |
typedef tjvector< float > | fvector |
typedef tjvector< double > | dvector |
typedef tjvector< int > | ivector |
typedef tjvector< STD_complex > | cvector |
Enumerations | |
enum | logPriority |
enum | whichOccurences |
enum | expFormat |
enum | fopenMode |
Functions | |
STD_string | print_table (const sarray &table) |
sarray | parse_table (const STD_string &str) |
STD_string | ctos (const STD_complex &z) |
STD_complex | stoc (const STD_string &s) |
bool | operator< (const STD_complex &c1, const STD_complex &c2) |
bool | operator> (const STD_complex &c1, const STD_complex &c2) |
void | default_tracefunction (const LogMessage &msg) |
int | solve_cubic (double a, double b, double c, double *x0, double *x1, double *x2) |
fvector | bruteforce_minimize1d (const MinimizationFunction &f, float low, float upp) |
STD_string | replaceStr (const STD_string &s, const STD_string &searchstring, const STD_string &replacement, whichOccurences mode=allOccurences) |
STD_string | extract (const STD_string &s, const STD_string &blockbegin, const STD_string &blockend, bool hierachical=false, int beginpos=0) |
STD_string | rmblock (const STD_string &s, const STD_string &blockbegin, const STD_string &blockend, bool rmbegin=true, bool rmend=true, bool rmall=true, bool hierachical=false) |
STD_string | toupperstr (const STD_string &s) |
STD_string | tolowerstr (const STD_string &s) |
STD_string | ftos (double f, unsigned int digits=_DEFAULT_DIGITS_, expFormat eformat=autoExp) |
STD_string | itos (int i, unsigned int maxabs=0) |
STD_string | ptos (const void *p) |
STD_string | n_times (const STD_string &s, unsigned int n) |
STD_string | justificate (const STD_string &s, unsigned int indention=0, bool ignore_firstline=false, unsigned int linewidth=_DEFAULT_LINEWIDTH_) |
int | textbegin (const STD_string &s, int startpos=0, const char custom_separator=0) |
int | sepbegin (const STD_string &s, int startpos=0, const char custom_separator=0) |
STD_string | shrink (const STD_string &s) |
int | noccur (const STD_string &s, const STD_string &searchstring) |
STD_string | dos2unix (const STD_string &s) |
int | load (STD_string &str, const STD_string &filename) |
int | write (const STD_string &str, const STD_string &filename, fopenMode mode=overwriteMode) |
double | norm (double x, double y) |
double | norm3 (double x, double y, double z) |
double | maxof3 (double f1, double f2, double f3) |
const char * | modestring (fopenMode mode) |
LONGEST_INT | filesize (const char *filename) |
const char * | getpwd () |
int | chpwd (const char *dirname) |
int | createdir (const char *dirname) |
bool | checkdir (const char *dirname) |
int | movefile (const char *src, const char *dst) |
int | copyfile (const char *src, const char *dst) |
int | rmfile (const char *fname) |
int | chperm (const char *fname, int perm) |
void * | filemap (const STD_string &filename, LONGEST_INT nbytes, LONGEST_INT offset, bool readonly, int &fd) |
void | fileunmap (int fd, void *start, LONGEST_INT nbytes, LONGEST_INT offset) |
STD_string | tempfile () |
int | create_empty_file (const STD_string &filename, LONGEST_INT nbytes, fopenMode mode=overwriteMode) |
const char * | lasterr () |
void | sleep_ms (unsigned int ms) |
double | current_time_s () |
double | secureDivision (double numerator, double denominator) |
double | secureInv (double denominator) |
const char * | getenv_nonnull (const char *variable_name) |
bool | little_endian_byte_order () |
unsigned int | numof_cores () |
double | sinc (double x) |
int | getCommandlineOption (int argc, char *argv[], const char *option, char *returnvalue, int maxchar, bool modify=true) |
int | isCommandlineOption (int argc, char *argv[], const char *option, bool modify=true) |
int | getLastArgument (int argc, char *argv[], char *returnvalue, int maxchar, bool modify=true) |
int | hasHelpOption (int argc, char *argv[]) |
const char * | helpUsage () |
const char * | configInfo () |
template<class T > | |
STD_vector< T > | list2vector (const STD_list< T > &src) |
fvector | real (const cvector &cv) |
fvector | imag (const cvector &cv) |
fvector | amplitude (const cvector &cv) |
fvector | phase (const cvector &cv) |
cvector | real2complex (const fvector &fv) |
dvector | fvector2dvector (const fvector &fv) |
fvector | dvector2fvector (const dvector &dv) |
svector | tokens (const STD_string &tokenstring, char custom_separator=0, char escape_begin='"', char escape_end='"') |
STD_string | tokenstring (const svector &tokens, unsigned int linewidth=_DEFAULT_LINEWIDTH_) |
svector | browse_dir (const STD_string &dirname, bool only_dirs=false, bool discard_dotfiles=false) |
Basic data types, vectors and arrays used by ODIN (tjutils library)
A vector of complex numbers
Definition at line 462 of file tjvector.h.
A vector of double precision floating point numbers
Definition at line 451 of file tjvector.h.
A vector of floating point numbers
Definition at line 446 of file tjvector.h.
A vector of integer numbers
Definition at line 456 of file tjvector.h.
typedef void(* tracefunction) (const LogMessage &msg) |
enum expFormat |
Enum to flag exponential printing of floating point numbers:
Definition at line 119 of file tjstring.h.
enum fopenMode |
enum logPriority |
enum whichOccurences |
Enum to flag replacement policy:
Definition at line 60 of file tjstring.h.
svector browse_dir | ( | const STD_string & | dirname, |
bool | only_dirs = false , |
||
bool | discard_dotfiles = false |
||
) |
Returns all entries in the given directory, if 'only_dirs' is 'true' only subdirectories will be reported. Files starting with a dot are discarded when setting 'discard_dotfiles' to 'true'. The resulting vector is sorted alphanumerically according to the file names.
fvector bruteforce_minimize1d | ( | const MinimizationFunction & | f, |
float | low, | ||
float | upp | ||
) |
one-dimensional brute-force minimizer in given interval [low,upp]. Returns coordinates of minimum.
bool checkdir | ( | const char * | dirname | ) |
Returns true if directory 'dirname' exists, otherwise false
int chperm | ( | const char * | fname, |
int | perm | ||
) |
Changes permissions of file 'fname' to 'perm'. On success, zero is returned. On error, -1 is returned.
int chpwd | ( | const char * | dirname | ) |
Changes the current directory of the process to dirname. On success, zero is returned. On error, -1 is returned.
const char* configInfo | ( | ) |
Returns general information about the ODIN package/configuration
int copyfile | ( | const char * | src, |
const char * | dst | ||
) |
Copies a file 'src' to destination 'dst'. On success, zero is returned. On error, -1 is returned.
int create_empty_file | ( | const STD_string & | filename, |
LONGEST_INT | nbytes, | ||
fopenMode | mode = overwriteMode |
||
) |
Create an empty file, filled with zeroes. Overwrite or append according to 'mode'. On error, -1 is returned.
int createdir | ( | const char * | dirname | ) |
Creates the given directory. On success, zero is returned. On error, -1 is returned.
STD_string ctos | ( | const STD_complex & | z | ) |
Returns the complex number 'z' as a formatted string
double current_time_s | ( | ) |
Returns the current time in s
void default_tracefunction | ( | const LogMessage & | msg | ) |
Default trace function
STD_string dos2unix | ( | const STD_string & | s | ) |
Replaces all '0d0a' sequences by '0a' in the string
STD_string extract | ( | const STD_string & | s, |
const STD_string & | blockbegin, | ||
const STD_string & | blockend, | ||
bool | hierachical = false , |
||
int | beginpos = 0 |
||
) |
returns a block of characters within s that is enclosed by 'blockbegin' and 'blockend'; the delimiters itself are not returned; If hierachical is true the nesting is considered, e.g. extract("(a(b)c)", "(", ")", true) will return "a(b)c" and not "a(b" ; beginpos is the position to start searching; If 'blockbegin' is a zero-length string, extraction will start at the beginning of the string; If 'blockend' is a zero-length string, extraction will stop at the end of the string;
void* filemap | ( | const STD_string & | filename, |
LONGEST_INT | nbytes, | ||
LONGEST_INT | offset, | ||
bool | readonly, | ||
int & | fd | ||
) |
Creates a file mapping of file 'filename' with 'nbytes' length starting at 'offset' bytes into the file, optionally in 'readonly' mode. The 'fd' will hold the file descriptor (handle) of the mapped file. Returns a pointer to the mapped memory region.
LONGEST_INT filesize | ( | const char * | filename | ) |
Returns file size in bytes if file exists, otherwise -1
void fileunmap | ( | int | fd, |
void * | start, | ||
LONGEST_INT | nbytes, | ||
LONGEST_INT | offset | ||
) |
Deletes a file mapping of file descriptor 'fd' which maps a region at memory location 'start' of 'nbytes' length starting at 'offset' bytes into the file.
STD_string ftos | ( | double | f, |
unsigned int | digits = _DEFAULT_DIGITS_ , |
||
expFormat | eformat = autoExp |
||
) |
returns a string that contains the formatted floating point number 'f' with precision 'digits' and exponential usage 'eformat'
int getCommandlineOption | ( | int | argc, |
char * | argv[], | ||
const char * | option, | ||
char * | returnvalue, | ||
int | maxchar, | ||
bool | modify = true |
||
) |
Copies maximum of 'maxchar' characters from the argv[] which follows an argv[] that matches 'option' into 'returnvalue'; returns TRUE if successful; 'maxchar' should NOT be greater than the number of bytes allocated for 'returnvalue' even if the number of chars in argv[] is smaller. If 'modify' is true, remove argument from the list.
const char* getenv_nonnull | ( | const char * | variable_name | ) |
Same as getenv, but returns empty string instead of NULL if variable is not found
int getLastArgument | ( | int | argc, |
char * | argv[], | ||
char * | returnvalue, | ||
int | maxchar, | ||
bool | modify = true |
||
) |
Copies maximum of 'maxchar' characters from the last argv[] into 'returnvalue'; returns TRUE if successful; 'maxchar' should NOT be greater than the number of bytes allocated for 'returnvalue' even if the number of chars in argv[] is smaller
const char* getpwd | ( | ) |
Returns the current directory of the process
int hasHelpOption | ( | int | argc, |
char * | argv[] | ||
) |
Returns whether one of the options '-h, -help, –help or –version' was given
const char* helpUsage | ( | ) |
Returns description of the standard help, version options
int isCommandlineOption | ( | int | argc, |
char * | argv[], | ||
const char * | option, | ||
bool | modify = true |
||
) |
Returns TRUE if 'option' is found in argv[] If 'modify' is true, remove argument from the list.
STD_string itos | ( | int | i, |
unsigned int | maxabs = 0 |
||
) |
returns a string that contains the formatted integer 'i'. If 'maxabs' is non-zero, the string will be formatted to have the same number of (possibly zero-padded) digits as 'maxabs'.
STD_string justificate | ( | const STD_string & | s, |
unsigned int | indention = 0 , |
||
bool | ignore_firstline = false , |
||
unsigned int | linewidth = _DEFAULT_LINEWIDTH_ |
||
) |
returns a justification of s with the specified indention and linewidth
const char* lasterr | ( | ) |
Returns the last system error as a string
STD_vector<T> list2vector | ( | const STD_list< T > & | src | ) |
Converts a list into a vector
Definition at line 500 of file tjvector.h.
bool little_endian_byte_order | ( | ) |
Returns true if the current platform has little endian byte order, otherwise false
int load | ( | STD_string & | str, |
const STD_string & | filename | ||
) |
Loads 'str' from the ASCII-file 'filename'. Returns 0 on success, -1 otherwise.
double maxof3 | ( | double | f1, |
double | f2, | ||
double | f3 | ||
) |
Maximum value of 3 numbers
const char* modestring | ( | fopenMode | mode | ) |
Returns mode string suitable for fopen according to 'mode'
int movefile | ( | const char * | src, |
const char * | dst | ||
) |
Moves a file 'src' to destination 'dst'. On success, zero is returned. On error, -1 is returned.
STD_string n_times | ( | const STD_string & | s, |
unsigned int | n | ||
) |
Returns n times s, e.g. n_times("3",3) —> "333"
int noccur | ( | const STD_string & | s, |
const STD_string & | searchstring | ||
) |
searches for number of occurences of 'searchstring' in s, returns number of matches otherwise 0
double norm | ( | double | x, |
double | y | ||
) |
Norm of a double vector
double norm3 | ( | double | x, |
double | y, | ||
double | z | ||
) |
Norm of a triple vector
unsigned int numof_cores | ( | ) |
Returns the number of (virtual) CPUs
|
inline |
Comparison operator for the norm of the complex numbers c1 and c2
Definition at line 61 of file tjcomplex.h.
|
inline |
Comparison operator for the norm of the complex numbers c1 and c2
Definition at line 66 of file tjcomplex.h.
sarray parse_table | ( | const STD_string & | str | ) |
Parses the string 'str' as a table and returns result as a 2-dim array (rows x cols).
STD_string print_table | ( | const sarray & | table | ) |
Prints the 2-dimensional array 'table' (rows x cols) with the column widths adjusted to the maximum width (string length) in each column.
STD_string ptos | ( | const void * | p | ) |
returns a string that contains the address of pointer 'p'
STD_string replaceStr | ( | const STD_string & | s, |
const STD_string & | searchstring, | ||
const STD_string & | replacement, | ||
whichOccurences | mode = allOccurences |
||
) |
Returns a string where occurences of 'searchstring' are replaced by 'replacement' in s. The 'mode' parameter determines whether only the first or all occurences should be replaced.
STD_string rmblock | ( | const STD_string & | s, |
const STD_string & | blockbegin, | ||
const STD_string & | blockend, | ||
bool | rmbegin = true , |
||
bool | rmend = true , |
||
bool | rmall = true , |
||
bool | hierachical = false |
||
) |
Returns s whereby a block of characters that is enclosed by 'blockbegin' and 'blockend' is removed; the flags rmbegin/rmend specify whether the delimiters itself should be removed. If 'rmall' is true, the last possible end delimiter will be used, otherwise the first. If 'hierachical' is true the nesting is considered, e.g. extract("(",")",true) applied to "(a(b)c)" will return "a(b)c" and not "a(b"
int rmfile | ( | const char * | fname | ) |
Removes the file or directory 'fname'. On success, zero is returned. On error, -1 is returned.
double secureDivision | ( | double | numerator, |
double | denominator | ||
) |
If denominator is zero the functions returns 0, otherwise numerator/denominator
|
inline |
int sepbegin | ( | const STD_string & | s, |
int | startpos = 0 , |
||
const char | custom_separator = 0 |
||
) |
Gives the position of the first speparator character in s. Search starts at 'startpos'. Blanks, tabs and newlines or 'custom_separator' if non-zero are considered as separators.
STD_string shrink | ( | const STD_string & | s | ) |
Remove all blanks, tabs and newlines from the string s
double sinc | ( | double | x | ) |
Returns sinc function with accurate results for small x (in contrast to using sin(x)/x directly)
void sleep_ms | ( | unsigned int | ms | ) |
Halt process/thread for 'ms' miliseconds.
int solve_cubic | ( | double | a, |
double | b, | ||
double | c, | ||
double * | x0, | ||
double * | x1, | ||
double * | x2 | ||
) |
Solve cubic equation x^3 + a x^2 + b x + c = 0 , copied from the GSL-lib
STD_complex stoc | ( | const STD_string & | s | ) |
Parses an returns string 's' as complex number
STD_string tempfile | ( | ) |
Return a unique name for a temporary file.
int textbegin | ( | const STD_string & | s, |
int | startpos = 0 , |
||
const char | custom_separator = 0 |
||
) |
Gives the position of the first non-speparator character in s. Search starts at 'startpos'. Blanks, tabs and newlines or 'custom_separator' if non-zero are considered as separators.
svector tokens | ( | const STD_string & | tokenstring, |
char | custom_separator = 0 , |
||
char | escape_begin = '"' , |
||
char | escape_end = '"' |
||
) |
Splits the string into tokens, which are substrings separated by blanks, tabs and newlines or custom_separator (if custom_separator!=0) and returns them as a vector of strings. Parts of the string enclosed by 'escape_begin' and 'escape_end' will not be decomposed into tokens.
STD_string tokenstring | ( | const svector & | tokens, |
unsigned int | linewidth = _DEFAULT_LINEWIDTH_ |
||
) |
Produces a string with linebreaks if width exceeds 'linewidth' from a vector of single strings. A 'linewidth' of zero will produce no linebreaks.
STD_string tolowerstr | ( | const STD_string & | s | ) |
returns s, but with all uppercase characters transformed to lowercase
STD_string toupperstr | ( | const STD_string & | s | ) |
returns s, but with all lowercase characters transformed to uppercase
int write | ( | const STD_string & | str, |
const STD_string & | filename, | ||
fopenMode | mode = overwriteMode |
||
) |
Writes 'str' to the ASCII-file 'filename', the 'mode' determines whether data will be appended/overwritten if the file already exists. Returns 0 on success, -1 otherwise.