15#define RETRY_SLEEP 1000000
35 static int safeStoi(std::string str);
49 static long long safeStoll(std::string str);
63 static long long safeStod(std::string str);
71 static void appendBy(std::vector<char> &result, std::string word,
char delimiter);
81 static void appendBy(std::vector<char> &result, std::vector<std::string> words,
char wordSeparator,
char endChar);
89 static std::vector<std::string>
splitStringOn(std::string str,
char delimiter);
131 if (errno != 0 && errno != ERANGE)
133 usleep(pow(2, retries) * RETRY_SLEEP);
136 }
while (errno != 0 && errno != ERANGE && retries <= MAX_RETRIES);
137 if (retries > MAX_RETRIES)
Implements generic functionality.
Definition: Utility.h:21
static T queryWithRetry(std::function< T()> query)
A general template for a query to be performed with retries.
Definition: Utility.h:123
static long long getCurrentTimeMilliSeconds()
Gets the current time since epoch in milliseconds, represented as an integer.
Definition: Utility.cpp:123
static std::vector< std::string > splitStringOn(std::string str, char delimiter)
Splits a string on a special character.
Definition: Utility.cpp:93
static void appendBy(std::vector< char > &result, std::string word, char delimiter)
Appends a char vector by a string and adds a special character at the end.
Definition: Utility.cpp:69
static long long safeStod(std::string str)
Safely attempts to convert a string to a corresponding double.
Definition: Utility.cpp:50
static long long getCurrentTimeSeconds()
Gets the current time since epoch in seconds, represented as an integer.
Definition: Utility.cpp:117
static long long safeStoll(std::string str)
Safely attempts to convert a string to a corresponding long long.
Definition: Utility.cpp:31
static std::string uuidStringToHash(std::string uuid)
Changes a string with the format of a uuid to a string with the format of a hash.
Definition: Utility.cpp:111
static std::string hashToUUIDString(std::string hash)
Changes a string with the format of a hash to a string with the format of a UUID.
Definition: Utility.cpp:105
static int safeStoi(std::string str)
Safely attempts to convert a string to a corresponding int.
Definition: Utility.cpp:12