48 const double pc2cm = 3.08568025e18;
52 const double mec2 = 0.5109989461;
60 const std::string& chars);
62 const std::string& chars);
64 const std::string& segment,
65 const std::string& replacement);
66 std::string
expand_env(
const std::string& arg);
67 std::string
filepath(
const std::string& pathname,
68 const std::string& filename);
70 std::string
getenv(
const std::string& arg);
71 std::string
str(
const unsigned short int& value);
72 std::string
str(
const unsigned int& value);
73 std::string
str(
const unsigned long int& value);
74 std::string
str(
const unsigned long long int& value);
75 std::string
str(
const short int& value);
76 std::string
str(
const int& value,
const std::string& fmt =
"%d");
77 std::string
str(
const long int& value);
78 std::string
str(
const long long int& value);
79 std::string
str(
const float& value,
const int& precision = 0);
80 std::string
str(
const double& value,
const int& precision = 0);
81 std::string
str(
const std::complex<double>& value,
82 const int& precision = 0);
84 char*
tochar(
const std::string& arg);
85 short toshort(
const std::string& arg);
86 unsigned short toushort(
const std::string& arg);
87 int toint(
const std::string& arg);
88 unsigned int touint(
const std::string& arg);
89 long tolong(
const std::string& arg);
90 unsigned long toulong(
const std::string& arg);
92 unsigned long long toulonglong(
const std::string& arg);
93 float tofloat(
const std::string& arg);
94 double todouble(
const std::string& arg);
95 std::string
toupper(
const std::string& s);
96 std::string
tolower(
const std::string& s);
97 std::vector<std::string>
split(
const std::string& s,
const std::string& sep);
98 std::string
fill(
const std::string& s,
const int& n);
99 std::string
left(
const std::string& s,
const int& n,
100 const char& c =
' ');
101 std::string
right(
const std::string& s,
const int& n,
102 const char& c =
' ');
103 std::string
centre(
const std::string& s,
const int& n,
104 const char& c =
' ');
105 std::string
parformat(
const std::string& s,
const int& indent = 0);
106 std::string
number(
const std::string& noun,
const int&
number);
109 const double& epivot,
110 const double& gamma);
113 const double& epivot,
114 const double& gamma);
119 bool contains(
const std::string& str,
120 const std::string& substring);
121 bool contains(
const std::vector<std::string>& strings,
122 const std::string&
string);
123 void warning(
const std::string& origin,
124 const std::string& message);
125 std::string
xml2str(
const std::string& arg);
126 std::string
str2xml(
const std::string& arg);
128 const std::string& name);
131 const std::string& name);
134 const std::string& name);
137 const std::string& name,
138 const std::string& attribute);
144 const std::string& type);
146 const std::string& name,
149 const std::string& filename);
151 const std::string& filename);
155 int recv(
int fd,
char *buffer,
int len,
int flags,
159 const double& cosdist,
160 const double& sindist,
162 const double& cosroi);
166 std::string
http_query(
const std::string& host,
167 const std::string& query);
168 std::string
host_country(
const bool& force_query =
false);
186 return (x < -DBL_MAX || x > DBL_MAX);
const double MeV2Angstrom
Abstract XML node base class.
bool contains(const std::string &str, const std::string &substring)
Checks if a substring is in a string.
void xml_get_name_value_pair(const GXmlNode *node, std::string &name, std::string &value)
Extract name / value pair from XML node.
std::string replace_segment(const std::string &arg, const std::string &segment, const std::string &replacement)
Replace string segment in string.
std::string getenv(const std::string &arg)
Return value of environment variable.
double roi_arclength(const double &rad, const double &dist, const double &cosdist, const double &sindist, const double &roi, const double &cosroi)
Returns length of circular arc within circular ROI.
std::string number(const std::string &noun, const int &number)
Convert singular noun into number noun.
void xml_check_par(const std::string &origin, const std::string &name, const int &number)
Checks whether a parameter has occured once.
void warning(const std::string &origin, const std::string &message)
Emits warning.
std::string strdate(void)
Return current date.
int recv(int fd, char *buffer, int len, int flags, int timeout)
Checks whether a parameter has occured once.
std::string strip_chars(const std::string &arg, const std::string &chars)
Strip leading and trailing character from string.
std::vector< std::string > split(const std::string &s, const std::string &sep)
Split string.
long tolong(const std::string &arg)
Convert string into long value.
std::string strip_whitespace(const std::string &arg)
Strip leading and trailing whitespace from string.
GFilename xml_file_reduce(const GXmlElement &xml, const std::string &filename)
Reduce file name provided for writing as XML attribute.
double plaw_energy_flux(const double &emin, const double &emax, const double &epivot, const double &gamma)
Compute energy flux between two energies for a power law.
std::string centre(const std::string &s, const int &n, const char &c= ' ')
Centre string to achieve a length of n characters.
bool is_notanumber(const double &x)
Signal if argument is not a number.
bool is_infinite(const double &x)
Signal if argument is infinite.
std::string right(const std::string &s, const int &n, const char &c= ' ')
Right justify string to achieve a length of n characters.
std::string http_query(const std::string &host, const std::string &query)
Return response to a HTTP query.
const double speed_of_light
short toshort(const std::string &arg)
Convert string into short value.
char * tochar(const std::string &arg)
Convert string to C string.
std::string left(const std::string &s, const int &n, const char &c= ' ')
Left justify string to achieve a length of n characters.
GXmlElement * xml_need_par(const std::string &origin, GXmlElement &xml, const std::string &name)
Return pointer to parameter with given name in XML element.
bool dir_exists(const std::string &dirname)
Checks if directory exists.
GFilename gamma_filename(const std::string &name)
Returns filename in .gamma directory.
void xml_check_parnum(const std::string &origin, const GXmlElement &xml, const int &number)
Checks number of parameters.
unsigned long long toulonglong(const std::string &arg)
Convert string into unsigned long long value.
bool xml_has_par(const GXmlElement &xml, const std::string &name)
Checks if parameter with given name in XML element exists.
std::string xml2str(const std::string &arg)
Convert XML character references in string to characters.
long long tolonglong(const std::string &arg)
Convert string into long long value.
unsigned long toulong(const std::string &arg)
Convert string into unsigned long value.
std::string rstrip_chars(const std::string &arg, const std::string &chars)
Strip trailing character from string.
std::string host_country(const bool &force_query=false)
Return two-digit host country code.
std::string tmpnam(void)
Return temporary file name.
unsigned int touint(const std::string &arg)
Convert string into unsigned integer value.
unsigned short toushort(const std::string &arg)
Convert string into unsigned short value.
std::string toupper(const std::string &s)
Convert string to upper case.
std::string tolower(const std::string &s)
Convert string to lower case.
bool compare(const double &a, const double &b, const double &tol)
Compare two floating point values with tolerance.
std::string xml_get_attr(const std::string &origin, const GXmlElement &xml, const std::string &name, const std::string &attribute)
Return attribute value for a given parameter in XML element.
std::string expand_env(const std::string &arg)
Expand environment variables in string.
int toint(const std::string &arg)
Convert string into integer value.
std::string filepath(const std::string &pathname, const std::string &filename)
Build file path from path name and file name.
std::string parformat(const std::string &s, const int &indent=0)
Convert string in parameter format.
std::string str2xml(const std::string &arg)
Convert special characters in string to XML character references.
std::string fill(const std::string &s, const int &n)
Fill string with n strings of same type.
const GXmlElement * xml_get_par(const std::string &origin, const GXmlElement &xml, const std::string &name)
Return pointer to parameter with given name in XML element.
GEnergy elogmean(const GEnergy &a, const GEnergy &b)
Computes log mean energy.
double todouble(const std::string &arg)
Convert string into double precision value.
Class that handles energies in a unit independent way.
double plaw_photon_flux(const double &emin, const double &emax, const double &epivot, const double &gamma)
Compute photon flux between two energies for a power law.
float tofloat(const std::string &arg)
Convert string into single precision value.
GFilename xml_file_expand(const GXmlElement &xml, const std::string &filename)
Expand file name provided as XML attribute for loading.
std::string str(const unsigned short int &value)
Convert unsigned short integer value into string.
void xml_check_type(const std::string &origin, GXmlElement &xml, const std::string &type)
Checks the model type.