This module offers C++ utility functions.
More...
#include "Config.h"
Go to the source code of this file.
|
| #define | CMSQ2MMSQ 1.0e2 |
| | cm^2 -> mm^2
|
| |
| #define | ERG2KEV 6.242e8 |
| | erg -> keV
|
| |
| #define | KEV2J 1.602176634e-16 |
| | keV -> J (SI)
|
| |
| #define | LN10 2.30258509299404590109361379290930926799774169921875 |
| | log(10)
|
| |
| #define | LN2 0.6931471805599453094172321214581766 |
| | log_e 2
|
| |
| #define | MAGJY 54.7986954228065314964624121785 |
| | zero-point flux for the magnitude
|
| |
| #define | MM2M 1.0e-3 |
| | mm -> m
|
| |
| #define | PI 3.141592653589793115997963468544185161590576171875 |
| | pi
|
| |
| #define | PIOVERTWO 1.570796326794896557998981734272092580795288085937 |
| | pi/2
|
| |
| #define | S2MS 1.0e3 |
| | s -> ms
|
| |
| #define | SQRT2 1.4142135623730951454746218587388284504413604736328125 |
| | sqrt(2)
|
| |
| #define | SQRT2PI 2.50662827463100024161235523934010416269302368164062 |
| | sqrt(2pi)
|
| |
| #define | TWOPI 6.28318530717958623199592693708837032318115234375 |
| | 2pi
|
| |
|
| string | GetDirectoryFromFilePath (const string aFilePath) |
| | Returns the directory from the file path.
|
| |
| string | GetFileNameFromPath (const string aFilePath) |
| | Returns the file name given the file path.
|
| |
| unsigned int | GetGcd (unsigned int aN1, unsigned int aN2) |
| | Returns the greater common divisor between 2 numbers.
|
| |
| vector< string > | Glob (const char *aPattern) |
| | C utility to extract a list of files from a given file pattern.
|
| |
| bool | IsDirectory (const string aDirPath) |
| | Checks if a directory exists.
|
| |
| bool | IsFile (const string aFileName) |
| | Checks if a file exists.
|
| |
| bool | IsPowerOfTwo (const unsigned int aN) |
| | Tests whether an integer is a power of 2.
|
| |
| int | NextPowerOfTwo (const double aX) |
| | Returns the next power of 2.
|
| |
| string | ReplaceAll (string aStr, const string &aFrom, const string &aTo) |
| | Replaces all occurences of a sub-string by another sub-string.
|
| |
| vector< string > | SplitString (const string aStringToSplit, const char aSeparator) |
| | Splits a string.
|
| |
◆ CMSQ2MMSQ
◆ ERG2KEV
◆ KEV2J
| #define KEV2J 1.602176634e-16 |
◆ LN10
| #define LN10 2.30258509299404590109361379290930926799774169921875 |
◆ LN2
| #define LN2 0.6931471805599453094172321214581766 |
◆ MAGJY
| #define MAGJY 54.7986954228065314964624121785 |
zero-point flux for the magnitude
◆ MM2M
◆ PI
| #define PI 3.141592653589793115997963468544185161590576171875 |
◆ PIOVERTWO
| #define PIOVERTWO 1.570796326794896557998981734272092580795288085937 |
◆ S2MS
◆ SQRT2
| #define SQRT2 1.4142135623730951454746218587388284504413604736328125 |
◆ SQRT2PI
| #define SQRT2PI 2.50662827463100024161235523934010416269302368164062 |
◆ TWOPI
| #define TWOPI 6.28318530717958623199592693708837032318115234375 |
◆ GetDirectoryFromFilePath()
| string GetDirectoryFromFilePath |
( |
const string |
aFilePath | ) |
|
Returns the directory from the file path.
- Parameters
-
◆ GetFileNameFromPath()
| string GetFileNameFromPath |
( |
const string |
aFilePath | ) |
|
|
inline |
Returns the file name given the file path.
For example "myprog.exe" is returned from:
- the full path "/usr/bin/myprog.exe"
- the relative path "./bin/myprog.exe"
- Parameters
-
- Returns
- The file name with path.
◆ GetGcd()
| unsigned int GetGcd |
( |
unsigned int |
aN1, |
|
|
unsigned int |
aN2 |
|
) |
| |
Returns the greater common divisor between 2 numbers.
- Parameters
-
| [in] | aN1 | First number. |
| [in] | aN2 | Second number. |
◆ Glob()
| vector< string > Glob |
( |
const char * |
aPattern | ) |
|
C utility to extract a list of files from a given file pattern.
- Returns
- a list of files matching a pattern.
- Parameters
-
| [in] | aPattern | File pattern to match. |
◆ IsDirectory()
| bool IsDirectory |
( |
const string |
aDirPath | ) |
|
Checks if a directory exists.
- Returns
- true if the directory path exists.
- Parameters
-
| [in] | aDirPath | Path to the directory to test. |
◆ IsFile()
| bool IsFile |
( |
const string |
aFileName | ) |
|
Checks if a file exists.
- Returns
- true if the input file exists, false otherwise.
- Parameters
-
| [in] | aFileName | Path to the file to test. |
◆ IsPowerOfTwo()
| bool IsPowerOfTwo |
( |
const unsigned int |
aN | ) |
|
|
inline |
Tests whether an integer is a power of 2.
- Parameters
-
- Returns
- true if the integer is a power of 2, false otherwise.
◆ NextPowerOfTwo()
| int NextPowerOfTwo |
( |
const double |
aX | ) |
|
|
inline |
Returns the next power of 2.
- Parameters
-
| [in] | aX | number to consider. |
- Returns
- The power of 2 next to the given number.
◆ ReplaceAll()
| string ReplaceAll |
( |
string |
aStr, |
|
|
const string & |
aFrom, |
|
|
const string & |
aTo |
|
) |
| |
Replaces all occurences of a sub-string by another sub-string.
All occurences of sub-string 'aFrom' are replaced by 'aTo'.
- Returns
- The modified string.
- Parameters
-
| aStr | String to modify. |
| aFrom | Substring to replace from. |
| aTo | Substring to replace to. |
◆ SplitString()
| vector< string > SplitString |
( |
const string |
aStringToSplit, |
|
|
const char |
aSeparator |
|
) |
| |
Splits a string.
A string is divided into a vector of sub-strings. The separator defines where to break the input string. The separator must be a single character.
- Returns
- A vector of string, excluding the separator
- Parameters
-
| [in] | aStringToSplit | String to divide. |
| [in] | aSeparator | Separator. |