guts
gutilities.h File Reference
#include "gutsConventions.h"
#include <vector>
#include <string>
#include <map>
Include dependency graph for gutilities.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

 gutilities
 

Enumerations

enum  gutilities::randomModel { gutilities::uniform , gutilities::gaussian , gutilities::cosine , gutilities::sphere }
 Enumeration of random models. More...
 

Functions

string gutilities::removeLeadingAndTrailingSpacesFromString (const std::string &input)
 Removes leading and trailing spaces and tabs from a string. More...
 
string gutilities::removeAllSpacesFromString (const std::string &str)
 Removes all spaces from a string. More...
 
string gutilities::getFileFromPath (const std::string &path)
 Extracts the filename from a given file path. More...
 
string gutilities::getDirFromPath (const std::string &path)
 Extracts the directory path from a given file path. More...
 
vector< std::string > gutilities::getStringVectorFromString (const std::string &input)
 Splits a string into a vector of strings using spaces as delimiters. More...
 
string gutilities::replaceCharInStringWithChars (const std::string &input, const std::string &toReplace, const std::string &replacement)
 Replaces all occurrences of specified characters in a string with another string. More...
 
string gutilities::replaceAllStringsWithString (const string &source, const string &from, const string &to)
 Replaces all occurrences of a substring with another string. More...
 
string gutilities::fillDigits (const string &word, const string &c, int ndigits)
 Pads a string with a specified character until it reaches a desired length. More...
 
double gutilities::getG4Number (const string &v, bool warnIfNotUnit=false)
 Converts a string representation of a number with optional units to a double. More...
 
double gutilities::getG4Number (double input, const string &unit)
 Converts a numeric value with a unit into a G4 number format and returns the converted value. More...
 
vector< double > gutilities::getG4NumbersFromStringVector (const vector< string > &vstring, bool warnIfNotUnit=false)
 Converts a vector of strings representing numbers with units to a vector of doubles. More...
 
vector< double > gutilities::getG4NumbersFromString (const string &vstring, bool warnIfNotUnit=false)
 Converts a comma-separated string of numbers with units to a vector of doubles. More...
 
string gutilities::parseFileAndRemoveComments (const string &filename, const string &commentChars="#", int verbosity=0)
 Parses a file and removes all lines containing specified comment characters. More...
 
string gutilities::retrieveStringBetweenChars (const string &input, const string &firstDelimiter, const string &secondDelimiter)
 Retrieves a substring between two specified delimiters in a string. More...
 
vector< string > gutilities::getStringVectorFromStringWithDelimiter (const string &input, const string &x)
 Splits a string into a vector of substrings using a specified delimiter. More...
 
bool gutilities::directoryExists (const std::string &path)
 Checks if a directory exists at the given path. More...
 
string gutilities::searchForDirInLocations (const string &dirName, const vector< string > &possibleLocations)
 Searches for a directory within a list of possible locations. More...
 
bool gutilities::hasExtension (const string &filename, const vector< string > &extensions)
 Checks if a filename has one of the specified extensions. More...
 
vector< string > gutilities::getListOfFilesInDirectory (const string &dirName, const vector< string > &extensions)
 Retrieves a list of files with specific extensions from a directory. More...
 
string gutilities::convertToLowercase (const string &str)
 Converts a string to lowercase. More...
 
template<class KEY , class VALUE >
vector< KEY > gutilities::getKeys (const map< KEY, VALUE > &map)
 Retrieves all keys from a map. More...
 
randomModel gutilities::stringToRandomModel (const std::string &str)
 Converts a string to a corresponding randomModel enum value. More...