Constants and utility functions¶
The GTools.hpp header defines a number of constants and utility functions that are widely used in GammaLib.
Constants¶
The following constants are available:
Constant |
Value |
Purpose |
---|---|---|
|
\(1.6021765 \times 10^{-6}\) |
Converts MeV to erg |
|
\(624150.96\) |
Converts erg to MeV |
|
\(1.239841875\times 10^{-2}\) |
Converts MeV to Angstrom |
|
\(3.08568025 \times 10^{18}\) |
Converts pc to cm |
|
\(86400.0\) |
Number of seconds in one day |
|
\(1/86400\) |
Converts seconds to days |
|
\(32.184\) |
Converts TAI to TT system |
|
\(0.5109989461\) |
Electron rest mass in MeV |
|
\(299792458.0\) |
Vacuum speed of light in m/s |
Functions¶
The following functions are available:
Function |
Description |
---|---|
|
Strips all leading and trailing whitespace from string. |
|
Strips all leading and trailing characters from string. |
|
Strips all trailing characters from string. |
|
Replace string segment by another segment. |
|
Replace any environment variables in string by its value. |
|
Build path from filename and path. |
|
Returns temporary file name. |
|
Conversion of C-types to strings. |
|
Returns current date string. |
|
Conversion of string to |
|
Conversion of string to |
|
Conversion of string to |
|
Conversion of string to |
|
Conversion of string to |
|
Conversion of string to |
|
Conversion of string to |
|
Conversion of string to |
|
Conversion of string to |
|
Conversion of string to |
|
Conversion of string to |
|
Conversion of string to upper case letters. |
|
Conversion of string to lower case letters. |
|
Split string in vector of strings. |
|
Fill string with a number of replications of a string. |
|
Left justify string to achieve a given length of characters. |
|
Right justify string to achieve a given length of characters. |
|
Centre string to achieve a given length of characters. |
|
Format string for parameter value display. |
|
Append a |
|
Compute photon flux under a power law. |
|
Compute energy flux under a power law. |
|
Computes geometric mean of energy. |
|
Check whether a directory exists. |
|
Check whether a double precision value is infinite. |
|
Check whether a double precision value is not a number. |
|
Check whether a string contains a sub-string. |
|
Dump warning in console. |
|
Converts XML to string. |
|
Converts string to XML. |
|
Checks is XML file has parameter. |
|
Require specific parameter in XML file. |
|
Get parameter from XML file. |
|
Get attribute from XML file. |
|
Check parameter in XML file. |
|
Expand file name in XML file. |
|
Reduce file name in XML file. |
|
Get name/value pair from XML node. |
|
Receive on socket with timeout. |
|
Compute arc length of intersection with Region of Interest. |
|
Compares two floating point value with a specific tolerance. |
|
Returns result of HTTP query. |
|
Returns host country two-digit string. |
|
Returns filename in |