AmpGen 2.1
Loading...
Searching...
No Matches
Utilities.h File Reference
#include <cxxabi.h>
#include <stddef.h>
#include <algorithm>
#include <fstream>
#include <functional>
#include <map>
#include <sstream>
#include <string>
#include <typeinfo>
#include <vector>
#include <future>
#include "AmpGen/MsgService.h"
#include "AmpGen/MetaUtils.h"

Go to the source code of this file.

Namespaces

namespace  AmpGen
 

Functions

template<typename iterator_type, typename functor_type>
std::string AmpGen::vectorToString (iterator_type begin, iterator_type end, const std::string &delim, functor_type fcn)
 
template<typename container_type, typename vtype = typename container_type::value_type, typename functor_type = std::function<vtype(const vtype&)>>
std::string AmpGen::vectorToString (const container_type &obj, const std::string &delim="", const functor_type &f=[](const auto &arg){ return arg;})
 
template<typename T>
std::vector< std::vector< T > > AmpGen::nCr (const T &n, const T &r)
 
std::vector< std::string > AmpGen::vectorFromFile (const std::string &filename, const char ignoreLinesThatBeginWith='#')
 
std::vector< std::string > AmpGen::split (const std::string &, char, bool=true)
 
std::vector< std::string > AmpGen::split (const std::string &, const std::vector< char > &, bool=false)
 
std::vector< size_t > AmpGen::findAll (const std::string &input, const std::string &ch)
 
std::map< size_t, std::string > AmpGen::vecFindAll (const std::string &input, const std::vector< std::string > &vCh)
 
size_t AmpGen::find_next_of (const std::string &input, const std::vector< std::string > &patterns, const size_t &begin=0)
 
std::string AmpGen::replaceAll (const std::string &input, const std::string &toReplace, const std::string &replaceWith)
 
std::string AmpGen::replaceAll (const std::string &input, const std::vector< std::pair< std::string, std::string > > &rules)
 
unsigned int AmpGen::FNV1a_hash (const std::string &toHash)
 
std::vector< std::string > AmpGen::getItems (const std::string &tree, const std::vector< std::string > &brackets={"{", "}"}, const std::string &seperator=",")
 
void AmpGen::swapChars (std::string &arg, const char a, const char b)
 
unsigned int AmpGen::editDistance (const std::string &s1, const std::string &s2)
 
std::string AmpGen::round (const double &number, const unsigned int &nsf)
 
std::string AmpGen::numberWithError (const double &number, const double &error, const unsigned int &nDigits)
 
template<typename return_type>
return_type AmpGen::lexical_cast (const std::string &word, bool &status)
 
template<class ... ARGS>
std::string AmpGen::mysprintf (const std::string &format, ARGS &&... args)
 
template<>
double AmpGen::lexical_cast (const std::string &word, bool &status)
 
template<>
unsigned int AmpGen::lexical_cast (const std::string &word, bool &status)
 
template<>
std::string AmpGen::lexical_cast (const std::string &word, bool &status)
 
template<>
float AmpGen::lexical_cast (const std::string &word, bool &status)
 
template<>
bool AmpGen::lexical_cast (const std::string &word, bool &status)
 
template<>
int AmpGen::lexical_cast (const std::string &word, bool &status)
 
template<>
unsigned long int AmpGen::lexical_cast (const std::string &word, bool &status)
 
template<>
long int AmpGen::lexical_cast (const std::string &word, bool &status)
 
template<typename functor_type>
void AmpGen::processFile (const std::string &filename, functor_type &&toDo, const char ignoreLinesThatBeginWith='#')
 
std::pair< size_t, int > AmpGen::minSwaps (const std::vector< size_t > &indices, const std::vector< int > &exchangeParities)
 
template<class iterator, class comparator>
void AmpGen::parallel_sort (iterator begin, iterator end, const comparator &comp, const size_t &grainsize)
 
template<class iterator, class initial_value, class functor>
initial_value AmpGen::parallel_accumulate (iterator begin, iterator end, const initial_value &init, const functor &f)
 
template<typename return_type, typename contained_type>
std::function< return_type(const contained_type &)> AmpGen::arrayToFunctor (const std::vector< return_type > &values)
 
template<typename T>
std::vector< std::vector< T > > AmpGen::all_combinations (const std::vector< std::vector< T > > &elements)
 
template<class iterator>
void AmpGen::parallel_sort (iterator begin, iterator end, const size_t &grainsize)
 
bool AmpGen::stringMatchesWildcard (const std::string &input, const std::string &wildcard_string, const char wildcard_character=' *')
 
bool AmpGen::isDir (const std::string &fname)
 
bool AmpGen::fileExists (const std::string &name)
 
std::vector< std::string > AmpGen::getListOfFiles (const std::string &directory, const std::string &patternString="")
 
void AmpGen::printSplash ()
 
void AmpGen::printReleaseNotes (const std::string &fname)
 
std::string AmpGen::ltrim (std::string s)
 
std::string AmpGen::rtrim (std::string s)
 
std::string AmpGen::trim (const std::string &s)
 
std::string AmpGen::expandGlobals (std::string path)
 
std::ostream & AmpGen::bold_on (std::ostream &)
 
std::ostream & AmpGen::bold_off (std::ostream &)
 
std::ostream & AmpGen::italic_on (std::ostream &)
 
std::ostream & AmpGen::italic_off (std::ostream &)