|
BmnRoot 26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
|
#include <cstring>#include <ctime>#include <iomanip>#include <iostream>#include <limits.h>#include <math.h>#include <memory>#include <sstream>#include <stdio.h>#include <stdlib.h>#include <string>#include <sys/stat.h>#include <unistd.h>Go to the source code of this file.
Macros | |
| #define | CHECK_BIT(variable, position) |
Enumerations | |
| enum | BATCH_SYSTEM_NAME { SGE_BATCH_SYSTEM , TORQUE_BATCH_SYSTEM , SLURM_BATCH_SYSTEM } |
Functions | |
| int | system_command_linux (string aCommand, string &result) |
| string | expand_path (string path) |
| string | absolute_path (string path) |
| int | get_linux_processor_count () |
| int | get_batch_processor_count (BATCH_SYSTEM_NAME batch_system, string queue_name="") |
| string | get_app_name_linux () |
| string | get_app_dir_linux () |
| template<typename... Args> | |
| string | string_format (const string &format, Args... args) |
| string | double_to_string (double number, int precision, bool is_fixed_point=true) |
| string | int_to_string (int number) |
| string | int_to_hex_string (int number) |
| int | hex_string_to_int (string hex_string) |
| double | byte_size_to_double (string byte_size_in_string, char convert_to='B') |
| string | byte_size_to_human (uint64_t byte_size, unsigned precision=2) |
| bool | is_string_number (const string &s) |
| string | find_first_number (string const &str, bool isOnlyPositive=true) |
| string | find_first_double_number (string const &str, bool isOnlyPositive=true) |
| string | find_last_number (string const &str, bool isOnlyPositive=true) |
| string | find_last_double_number (string const &str, bool isOnlyPositive=true) |
| string | find_first_number (string const &str, size_t &beg_pos, size_t &end_pos, bool isOnlyPositive=true) |
| string | find_first_double_number (string const &str, size_t &beg_pos, size_t &end_pos, bool isOnlyPositive=true) |
| string | find_last_number (string const &str, size_t &beg_pos, size_t &end_pos, bool isOnlyPositive=true) |
| string | find_last_double_number (string const &str, size_t &beg_pos, size_t &end_pos, bool isOnlyPositive=true) |
| char * | convert_pchar_to_lowercase_new (char *input_char_array) |
| void | replace_string_in_text (string &text, string old_substring, string new_substring) |
| void | replace_string_in_text (string &text, string old_substring, int new_subinteger) |
| int | replace_char (char *&str, char find, char replace) |
| string | trim (const string &str, const string &whitespace=" \t\r") |
| string | reduce (const string &str, const string &fill=" ", const string &whitespace=" \t\r") |
| bool | endswith (string const &full_str, string const &ending) |
| int | check_directory_exist (const char *path) |
| int | create_directory (const char *path) |
| int | create_directory_tree (const char *path) |
| string | get_file_name (string path) |
| string | get_file_name_with_ext (string path) |
| string | get_directory_path (string file_path) |
| string | get_directory_name (string file_path) |
| string | get_current_date () |
| tm | convert_string_to_datetime (string str_datetime, const char *format="%d.%m.%Y %H:%M:%S") |
| struct timespec | convert_double_to_timespec (double sec) |
| #define CHECK_BIT | ( | variable, | |
| position ) |
Definition at line 55 of file function_set.h.
| enum BATCH_SYSTEM_NAME |
| Enumerator | |
|---|---|
| SGE_BATCH_SYSTEM | |
| TORQUE_BATCH_SYSTEM | |
| SLURM_BATCH_SYSTEM | |
Definition at line 28 of file function_set.h.
| string absolute_path | ( | string | path | ) |
Definition at line 210 of file function_set.h.
References string_format(), and system_command_linux().
| double byte_size_to_double | ( | string | byte_size_in_string, |
| char | convert_to = 'B' ) |
Definition at line 398 of file function_set.h.
References replace_string_in_text().
| string byte_size_to_human | ( | uint64_t | byte_size, |
| unsigned | precision = 2 ) |
// SIMPLE METHOD (cycle) int order = 0; while (byte_size >= 1024 && order < FILE_SIZE_UNITS.Length - 1) { order++; byte_size = byte_size/1024; }
Adjust the format string to your preferences. For example "{0:0.#}{1}" would show a single decimal place, and no space. return string_format("%.3f %s", byte_size, FILE_SIZE_UNITS[order]);
Definition at line 434 of file function_set.h.
References order, and string_format().
| int check_directory_exist | ( | const char * | path | ) |
Definition at line 712 of file function_set.h.
Referenced by create_directory_tree().
| struct timespec convert_double_to_timespec | ( | double | sec | ) |
Definition at line 854 of file function_set.h.
References convert_double_to_timespec().
| char * convert_pchar_to_lowercase_new | ( | char * | input_char_array | ) |
Definition at line 600 of file function_set.h.
References i.
| tm convert_string_to_datetime | ( | string | str_datetime, |
| const char * | format = "%d.%m.%Y %H:%M:%S" ) |
Definition at line 846 of file function_set.h.
| int create_directory | ( | const char * | path | ) |
Definition at line 725 of file function_set.h.
| int create_directory_tree | ( | const char * | path | ) |
Definition at line 742 of file function_set.h.
References check_directory_exist(), and create_directory_tree().
Referenced by create_directory_tree().
| string double_to_string | ( | double | number, |
| int | precision, | ||
| bool | is_fixed_point = true ) |
Definition at line 361 of file function_set.h.
| bool endswith | ( | string const & | full_str, |
| string const & | ending ) |
Definition at line 697 of file function_set.h.
| string expand_path | ( | string | path | ) |
Definition at line 161 of file function_set.h.
References expand_path(), and v.
Referenced by expand_path().
| string find_first_double_number | ( | string const & | str, |
| bool | isOnlyPositive = true ) |
Definition at line 501 of file function_set.h.
| string find_first_double_number | ( | string const & | str, |
| size_t & | beg_pos, | ||
| size_t & | end_pos, | ||
| bool | isOnlyPositive = true ) |
Definition at line 565 of file function_set.h.
References m.
| string find_first_number | ( | string const & | str, |
| bool | isOnlyPositive = true ) |
Definition at line 471 of file function_set.h.
| string find_first_number | ( | string const & | str, |
| size_t & | beg_pos, | ||
| size_t & | end_pos, | ||
| bool | isOnlyPositive = true ) |
Definition at line 531 of file function_set.h.
References m.
| string find_last_double_number | ( | string const & | str, |
| bool | isOnlyPositive = true ) |
Definition at line 514 of file function_set.h.
| string find_last_double_number | ( | string const & | str, |
| size_t & | beg_pos, | ||
| size_t & | end_pos, | ||
| bool | isOnlyPositive = true ) |
Definition at line 580 of file function_set.h.
References m.
| string find_last_number | ( | string const & | str, |
| bool | isOnlyPositive = true ) |
Definition at line 484 of file function_set.h.
| string find_last_number | ( | string const & | str, |
| size_t & | beg_pos, | ||
| size_t & | end_pos, | ||
| bool | isOnlyPositive = true ) |
Definition at line 546 of file function_set.h.
References m.
| string get_app_dir_linux | ( | ) |
Definition at line 317 of file function_set.h.
References get_app_name_linux(), and system_command_linux().
| string get_app_name_linux | ( | ) |
Definition at line 302 of file function_set.h.
References system_command_linux().
Referenced by get_app_dir_linux().
| int get_batch_processor_count | ( | BATCH_SYSTEM_NAME | batch_system, |
| string | queue_name = "" ) |
Definition at line 234 of file function_set.h.
References SGE_BATCH_SYSTEM, SLURM_BATCH_SYSTEM, and TORQUE_BATCH_SYSTEM.
| string get_current_date | ( | ) |
Definition at line 830 of file function_set.h.
| string get_directory_name | ( | string | file_path | ) |
Definition at line 810 of file function_set.h.
| string get_directory_path | ( | string | file_path | ) |
Definition at line 799 of file function_set.h.
| string get_file_name | ( | string | path | ) |
Definition at line 772 of file function_set.h.
| string get_file_name_with_ext | ( | string | path | ) |
Definition at line 788 of file function_set.h.
| int get_linux_processor_count | ( | ) |
Definition at line 228 of file function_set.h.
| int hex_string_to_int | ( | string | hex_string | ) |
Definition at line 387 of file function_set.h.
References x.
| string int_to_hex_string | ( | int | number | ) |
Definition at line 379 of file function_set.h.
| string int_to_string | ( | int | number | ) |
Definition at line 371 of file function_set.h.
| bool is_string_number | ( | const string & | s | ) |
Definition at line 461 of file function_set.h.
| string reduce | ( | const string & | str, |
| const string & | fill = " ", | ||
| const string & | whitespace = " \t\r" ) |
Definition at line 676 of file function_set.h.
References trim().
| int replace_char | ( | char *& | str, |
| char | find, | ||
| char | replace ) |
Definition at line 649 of file function_set.h.
| void replace_string_in_text | ( | string & | text, |
| string | old_substring, | ||
| int | new_subinteger ) |
Definition at line 630 of file function_set.h.
| void replace_string_in_text | ( | string & | text, |
| string | old_substring, | ||
| string | new_substring ) |
Definition at line 617 of file function_set.h.
Referenced by byte_size_to_double().
| string string_format | ( | const string & | format, |
| Args... | args ) |
Definition at line 347 of file function_set.h.
Referenced by absolute_path(), and byte_size_to_human().
| int system_command_linux | ( | string | aCommand, |
| string & | result ) |
Definition at line 139 of file function_set.h.
References f.
Referenced by absolute_path(), get_app_dir_linux(), and get_app_name_linux().
| string trim | ( | const string & | str, |
| const string & | whitespace = " \t\r" ) |
Definition at line 663 of file function_set.h.
Referenced by reduce().