Collection of utilities.
Namespaces | |
namespace | env |
All environment variable-related utilities. | |
namespace | kt |
Classes | |
class | AbortHandler |
Object handling a user-driven process abortion. More... | |
class | Caller |
External command piping utility. More... | |
class | Derivator |
class | DocumentationGenerator |
Documentation generator object. More... | |
class | Drawable |
A generic object which can be drawn in the standard output. More... | |
class | Drawer |
struct | EnumHash |
A hasher table for an enumeration. More... | |
class | EventBrowser |
A user-friendly browser for the Event content. More... | |
class | Functional |
A string-to-functional parser. More... | |
class | FunctionWrapper |
Wrapper to a 1-dimensional function with optional parameters. More... | |
class | Graph1D |
A one-dimensional graph object. More... | |
class | Graph2D |
A two-dimensional graph object. More... | |
class | GridDrawer |
Utility object to draw a grid values mapping. More... | |
class | GSLFunctionWrapper |
GSL wrapper to define a functor as a GSL-digestible functional. More... | |
class | GSLMonteFunctionWrapper |
GSL wrapper to define a functor as an integrable functional. More... | |
struct | Hasher |
A hasher table for a given structure. More... | |
struct | Hasher< T, true > |
A hasher table for a given structure. More... | |
class | Hist1D |
1D histogram container More... | |
class | Hist2D |
2D histogram container More... | |
class | Histogram |
Generic container for binned distributions. More... | |
class | Logger |
General purpose message logger. More... | |
class | Piper |
External command piping utility. More... | |
class | ProcessVariablesAnalyser |
class | ProgressBar |
A simple progress indicator. More... | |
class | RandomGenerator |
A random number generator. More... | |
struct | RunAbortedException |
Exception raised when the user terminates the process. More... | |
class | StreamCollector |
class | TimeKeeper |
Collection of clocks to benchmark execution blocks. More... | |
class | Timer |
A generic timer to extract the processing time between two steps in this software's flow. More... | |
Typedefs | |
using | DrawableColl = std::vector<const Drawable*> |
Collection of drawable objects A generic drawing utility. | |
Enumerations | |
enum struct | Normalise { no = 0 , yes = 1 } |
enum class | Colour { none = -1 , reset = 0 , black = 30 , red = 31 , green = 32 , yellow = 33 , blue = 34 , magenta = 35 , cyan = 36 , white = 37 } |
TTY-type enumeration of colours. More... | |
enum struct | Modifier : int16_t { none = -1 , reset = 0 , bold = 1 , dimmed = 1 << 1 , italic = 1 << 2 , underline = 1 << 3 , blink = 1 << 4 , reverse = 1 << 6 } |
Functions | |
double | mX2 (double xbj, double q2, double mp2) |
Compute the diffractive mass from virtuality/Bjorken x. | |
double | xBj (double q2, double mp2, double mx2) |
Compute Bjorken x from virtuality/diffractive mass. | |
double | q2 (double xbj, double mp2, double mx2) |
Compute the virtuality from Bjorken x/diffractive mass. | |
double | energyFromW (double w, double mp2, double m2) |
Compute energy from mass and emitted mass. | |
template<typename K , typename T > | |
std::vector< K > | keys (const std::map< K, T > &coll) |
Retrieve all keys from a map. | |
template<typename K , typename T > | |
std::vector< K > | keys (const std::unordered_map< K, T > &coll) |
Retrieve all keys from an unordered map. | |
template<typename T > | |
bool | contains (const std::vector< T > &coll, const T &item) |
Check if a vector contains an item. | |
template<typename T > | |
bool | contains (const std::set< T > &coll, const T &item) |
Check if a set contains an item. | |
template<typename K , typename T > | |
bool | contains (const std::unordered_map< K, T > &coll, const T &item) |
Check if an unordered map contains an item. | |
template<typename T > | |
void | normalise (std::vector< T > &coll) |
Remove duplicates and sort a collection. | |
template<typename T > | |
bool | uniform (const std::vector< T > &coll) |
Check if all elements of a collection are uniform. | |
Event | generateLPAIREvent () |
Generate a standard single-dissociative \(pp \to p^\ast (\gamma\gamma \to \mu^+\mu^-) p\) LPAIR event. | |
bool | fileExists (const std::string &) |
Check if the file exists. | |
std::string | fileExtension (const std::string &file) |
Small utility to retrieve the extension of a filename. | |
std::string | readFile (const std::string &) |
Read the content of a file into a string buffer. | |
bool | isWriteable (const std::string &) |
Check if path can be accessed for writing. | |
template<typename T > | |
bool | positive (const T &val) |
Check if a number is positive and finite. | |
template<typename T > | |
short | sign (const T &val) |
Type-safe C++ sign function. | |
double | fastHypot (double, double) |
Compute the square root of the squared sum (sqrt(a^2+b^2)) | |
double | fastHypot (double, double, double) |
Compute the square root of the squared sum (sqrt(a^2+b^2+c^2)) | |
double | fastSqrtSqDiff (double, double, Normalise normalise=Normalise::no) |
Compute the square root of the squared difference (sqrt(a^2-b^2)) | |
double | fastSqrtSqDiff (double, double, double, Normalise normalise=Normalise::no) |
Compute the square root of the squared difference (sqrt(a^2-b^2-c^2)) | |
template<typename T > | |
std::string | toString (const T &obj) |
Transform any type into a string. | |
template<> | |
std::string | toString (const Limits &) |
Specialisation of string conversion of limits. | |
template<> | |
std::string | toString (const ParametersList &) |
Specialisation of string conversion of parameters list. | |
template<> | |
std::string | toString (const std::string &obj) |
Trivial specialisation of string conversion of string. | |
template<> | |
std::string | toString (const double &) |
template<> | |
std::string | toString (const std::wstring &) |
Convert a wide characters to a standard characters string. | |
std::wstring | toWstring (const std::string &str) |
Convert a standard characters to a wide characters string. | |
std::string | toCamelCase (const std::string &, bool lower=true) |
Convert any case into a camelCase string. | |
bool | isInt (const std::string &) |
Check if a string is also an integer. | |
bool | isFloat (const std::string &) |
Check if a string is also a floating point number. | |
template<typename... Args> | |
std::string | format (const std::string &fmt, Args... args) |
Format a string using a printf style format descriptor. | |
template<typename... Args> | |
std::string | format (const std::wstring &fmt, Args... args) |
Format a wide string using a printf style format descriptor. | |
std::string | demangle (const char *) |
Demangle a type id if possible. | |
std::string | timeAs (const std::string &fmt) |
Return the formatted date/time now. | |
std::string | yesno (bool test) |
Human-readable boolean printout Boldify a string for TTY-type output streams. | |
template<typename T > | |
std::string | boldify (T str) |
std::ostream & | operator<< (std::ostream &, const Colour &) |
std::ostream & | operator<< (std::ostream &, const Modifier &) |
Modifier | operator| (const Modifier &, const Modifier &) |
std::string | colourise (const std::string &, const Colour &, const Modifier &=Modifier::none) |
Colourise a string for TTY-type output streams. | |
std::string | sanitise (const std::string &) |
Replace all unsafe characters to build a computer-readable (and filename-safe) string. | |
std::string | parseSpecialChars (const std::string &) |
Transform all emoji-like special characters into their LaTeX representation. | |
size_t | replaceAll (std::string &str, const std::string &from, const std::string &to) |
Replace all occurrences of a text by another. | |
std::string | replaceAll (const std::string &str, const std::string &from, const std::string &to) |
Replace all occurrences of a text by another. | |
std::string | replaceAll (const std::string &str, const std::vector< std::pair< std::string, std::string > > &keys) |
Replace all occurrences of multiple texts by others. | |
std::vector< std::string > | split (const std::string &, char, bool trim_parts=false) |
Split a string according to a separation character. | |
template<typename T > | |
std::string | merge (const T &val, const std::string &) |
Merge a printable type in a single string. | |
template<typename T > | |
std::string | merge (const std::vector< T > &, const std::string &) |
Merge a collection of a printable type in a single string. | |
template<typename T > | |
std::string | merge (const std::vector< std::vector< T > > &, const std::string &) |
Merge a collection of collections of a printable type in a single string. | |
template<typename T , size_t N> | |
std::string | merge (const std::array< T, N > &arr, const std::string &delim) |
Merge a collection of a printable type in a single string. | |
std::string | merge (const std::string &val, const std::string &) |
Trivial dimension-1 "merger" for string input. | |
std::string | merge (const ParametersList &, const std::string &) |
Trivial dimension-1 "merger" for parameters list input. | |
std::string | merge (const Limits &, const std::string &) |
Trivial dimension-1 "merger" for limits input. | |
std::string | toUpper (const std::string &) |
Capitalise a string. | |
std::string | toLower (const std::string &) |
Lowercase version of a string. | |
std::vector< std::string > | between (const std::string &str, const std::string &beg, const std::string &end) |
Get a (list of) substring(s) between two characters chains. | |
std::string | s (const std::string &, float, bool=true) |
Add a trailing "s" when needed. | |
template<class T > | |
std::string | repr (const std::vector< T > &vec, const std::function< std::string(const T &)> &printer, const std::string &sep=",") |
Helper to print a vector. | |
template<class T > | |
std::string | repr (const std::vector< T > &vec, const std::string &sep=",") |
Helper to print a vector. | |
template<class T > | |
std::string | repr (const std::set< T > &vec, const std::string &sep=",") |
Helper to print a set of values. | |
std::string | randomString (size_t size) |
Generate a random string of a given size. | |
std::string | ltrim (const std::string &str) |
Trim leading spaces. | |
std::string | rtrim (const std::string &str) |
Trim trailing spaces. | |
std::string | trim (const std::string &str) |
Trim leading and trailing spaces. | |
std::string | strip (const std::string &) |
Strip all special characters from string. | |
bool | startsWith (const std::string &, const std::string &) |
Check if a string starts with a given token. | |
bool | endsWith (const std::string &, const std::string &) |
Check if a string ends with a given token. | |
std::string | describeError (int error_number) |
Describe an error code. | |
Variables | |
std::atomic< int > | gSignal |
using DrawableColl = std::vector<const Drawable*> |
|
strong |
|
strong |
std::vector< std::string > between | ( | const std::string & | str, |
const std::string & | beg, | ||
const std::string & | end ) |
[in] | str | String to check |
[in] | beg | Start delimiter of the substring(s) |
[in] | end | End delimiter of the substring(s) |
std::string boldify | ( | T | str | ) |
std::string colourise | ( | const std::string & | , |
const Colour & | , | ||
const Modifier & | = Modifier::none ) |
bool contains | ( | const std::set< T > & | coll, |
const T & | item ) |
Definition at line 51 of file Collections.h.
bool contains | ( | const std::unordered_map< K, T > & | coll, |
const T & | item ) |
Definition at line 56 of file Collections.h.
bool contains | ( | const std::vector< T > & | coll, |
const T & | item ) |
Definition at line 46 of file Collections.h.
std::string demangle | ( | const char * | ) |
std::string describeError | ( | int | error_number | ) |
bool endsWith | ( | const std::string & | , |
const std::string & | ) |
double energyFromW | ( | double | w, |
double | mp2, | ||
double | m2 ) |
double fastHypot | ( | double | , |
double | ) |
double fastHypot | ( | double | , |
double | , | ||
double | ) |
double fastSqrtSqDiff | ( | double | , |
double | , | ||
double | , | ||
Normalise | normalise = Normalise::no ) |
double fastSqrtSqDiff | ( | double | , |
double | , | ||
Normalise | normalise = Normalise::no ) |
bool fileExists | ( | const std::string & | ) |
std::string fileExtension | ( | const std::string & | file | ) |
std::string format | ( | const std::string & | fmt, |
Args... | args ) |
std::string format | ( | const std::wstring & | fmt, |
Args... | args ) |
Event generateLPAIREvent | ( | ) |
Definition at line 27 of file EventUtils.h.
bool isFloat | ( | const std::string & | ) |
bool isInt | ( | const std::string & | ) |
bool isWriteable | ( | const std::string & | ) |
std::vector< K > keys | ( | const std::map< K, T > & | coll | ) |
Definition at line 32 of file Collections.h.
std::vector< K > keys | ( | const std::unordered_map< K, T > & | coll | ) |
Definition at line 39 of file Collections.h.
std::string ltrim | ( | const std::string & | str | ) |
std::string merge | ( | const Limits & | , |
const std::string & | ) |
std::string merge | ( | const ParametersList & | , |
const std::string & | ) |
std::string merge | ( | const std::array< T, N > & | arr, |
const std::string & | delim ) |
std::string merge | ( | const std::string & | val, |
const std::string & | ) |
std::string merge | ( | const std::vector< std::vector< T > > & | , |
const std::string & | ) |
std::string merge | ( | const std::vector< T > & | , |
const std::string & | ) |
std::string merge | ( | const T & | val, |
const std::string & | ) |
double mX2 | ( | double | xbj, |
double | q2, | ||
double | mp2 ) |
void normalise | ( | std::vector< T > & | coll | ) |
Definition at line 61 of file Collections.h.
std::ostream & operator<< | ( | std::ostream & | , |
const Colour & | ) |
std::ostream & operator<< | ( | std::ostream & | , |
const Modifier & | ) |
std::string parseSpecialChars | ( | const std::string & | ) |
bool positive | ( | const T & | val | ) |
double q2 | ( | double | xbj, |
double | mp2, | ||
double | mx2 ) |
std::string randomString | ( | size_t | size | ) |
std::string readFile | ( | const std::string & | ) |
std::string replaceAll | ( | const std::string & | str, |
const std::string & | from, | ||
const std::string & | to ) |
std::string replaceAll | ( | const std::string & | str, |
const std::vector< std::pair< std::string, std::string > > & | keys ) |
size_t replaceAll | ( | std::string & | str, |
const std::string & | from, | ||
const std::string & | to ) |
std::string repr | ( | const std::set< T > & | vec, |
const std::string & | sep = "," ) |
std::string repr | ( | const std::vector< T > & | vec, |
const std::function< std::string(const T &)> & | printer, | ||
const std::string & | sep = "," ) |
std::string repr | ( | const std::vector< T > & | vec, |
const std::string & | sep = "," ) |
std::string rtrim | ( | const std::string & | str | ) |
std::string s | ( | const std::string & | , |
float | , | ||
bool | = true ) |
std::string sanitise | ( | const std::string & | ) |
std::vector< std::string > split | ( | const std::string & | , |
char | , | ||
bool | trim_parts = false ) |
bool startsWith | ( | const std::string & | , |
const std::string & | ) |
std::string strip | ( | const std::string & | ) |
std::string timeAs | ( | const std::string & | fmt | ) |
std::string toCamelCase | ( | const std::string & | , |
bool | lower = true ) |
std::string toLower | ( | const std::string & | ) |
std::string toString | ( | const double & | ) |
std::string toString | ( | const Limits & | ) |
std::string toString | ( | const ParametersList & | ) |
std::string toString | ( | const std::wstring & | ) |
std::string toUpper | ( | const std::string & | ) |
std::wstring toWstring | ( | const std::string & | str | ) |
bool uniform | ( | const std::vector< T > & | coll | ) |
Definition at line 70 of file Collections.h.
double xBj | ( | double | q2, |
double | mp2, | ||
double | mx2 ) |
std::string yesno | ( | bool | test | ) |
T | type of variable to be boldified |
|
extern |