/afs/in2p3.fr/throng/virgo/virgoDev/SoftFlorent/GWOLLUM/v2r1/src/Utils/CUtils.h File Reference
#include <iostream>
#include <iomanip>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <vector>
#include <stdio.h>
#include <sstream>
#include <fstream>
#include <regex.h>
#include <dirent.h>
#include <glob.h>
#include <fnmatch.h>
Go to the source code of this file.
Defines |
#define | LN2 0.6931471805599453094172321214581766 |
| log_e 2
|
Functions |
vector< string > | Glob (const char *pattern) |
| c utility to extract a list of files.
|
bool | IsBinaryFile (const string filename) |
| Check if a file exists and is a binary file.
|
bool | IsBinaryFile (const char *filename) |
| Check if a file exists and is a binary file.
|
bool | IsDirectory (const string dirname) |
| Check if a directory exists.
|
bool | IsDirectory (const char *dirname) |
| Check if a directory exists.
|
bool | IsPowerOfTwo (unsigned int x) |
| Is this integer a power of 2.
|
bool | IsTextFile (const string filename) |
| Check if a file exists and is a txt file.
|
bool | IsTextFile (const char *filename) |
| Check if a file exists and is a txt file.
|
bool | ListDirectories (const string maindir, vector< string > &subdir) |
| Returns list of subdirectories.
|
double | medianbiasfactor (const int nn) |
| Returns the bias factor when computing a median with nn samples.
|
int | NextPowerOfTwo (double x) |
| Returns the next power of 2.
|
string | ReplaceAll (string str, const string &from, const string &to) |
| Replace all occurences of a sub-string.
|
vector< string > | SplitString (const string stringtodivide, const char separator) |
| Splits a string.
|
Define Documentation
#define LN2 0.6931471805599453094172321214581766 |
Function Documentation
vector<string> Glob |
( |
const char * |
pattern |
) |
|
c utility to extract a list of files.
Returns a list of files matching a pattern.
- Parameters:
-
bool IsBinaryFile |
( |
const string |
filename |
) |
[inline] |
Check if a file exists and is a binary file.
Returns true if 'filename' is an existing binary file.
- Parameters:
-
| filename | path to file to test |
bool IsBinaryFile |
( |
const char * |
filename |
) |
|
Check if a file exists and is a binary file.
Returns true if 'filename' is an existing binary file.
- Parameters:
-
| filename | path to file to test |
bool IsDirectory |
( |
const string |
dirname |
) |
[inline] |
Check if a directory exists.
Returns true if 'dirname' is an existing directory.
- Parameters:
-
| dirname | path to directory to test |
bool IsDirectory |
( |
const char * |
dirname |
) |
|
Check if a directory exists.
Returns true if 'dirname' is an existing directory.
- Parameters:
-
| dirname | path to directory to test |
bool IsPowerOfTwo |
( |
unsigned int |
x |
) |
[inline] |
Is this integer a power of 2.
true is returned if this is the case.
- Parameters:
-
bool IsTextFile |
( |
const string |
filename |
) |
[inline] |
Check if a file exists and is a txt file.
Returns true if 'filename' is an existing text file.
- Parameters:
-
| filename | path to file to test |
bool IsTextFile |
( |
const char * |
filename |
) |
|
Check if a file exists and is a txt file.
Returns true if 'filename' is an existing text file.
- Parameters:
-
| filename | path to file to test |
bool ListDirectories |
( |
const string |
maindir, |
|
|
vector< string > & |
subdir | |
|
) |
| | |
Returns list of subdirectories.
The vector 'subdir' is filled with directories contained in 'maindir' Returns true if success
- Parameters:
-
| maindir | path to main directory |
double medianbiasfactor |
( |
const int |
nn |
) |
|
Returns the bias factor when computing a median with nn samples.
- Parameters:
-
int NextPowerOfTwo |
( |
double |
x |
) |
[inline] |
Returns the next power of 2.
- Parameters:
-
| x | to get the next power of 2 of |
string ReplaceAll |
( |
string |
str, |
|
|
const string & |
from, |
|
|
const string & |
to | |
|
) |
| | |
Replace all occurences of a sub-string.
All occurences of substring 'from' are replaced by 'to'. The modified string is returned.
- Parameters:
-
| str | string to modify |
| from | substring to replace from |
| from | substring to replace to |
vector<string> SplitString |
( |
const string |
stringtodivide, |
|
|
const char |
separator | |
|
) |
| | |
Splits a string.
A string is divided into an array of words. The separator defines where to break the string. The separator should be a single character. A vector of string is returned.
- Parameters:
-
| stringtodivide | string to divide |
| separator | separator |