Simpact Cyan
Population based event driven simulation using mNRM
util.h
1 #ifndef UTIL_H
2 
3 #define UTIL_H
4 
5 #include <stdint.h>
6 #include <stdio.h>
7 #include <string>
8 #include <vector>
9 
10 //long double GetSystemTime();
11 bool ReadInputLine(FILE *fi, std::string &line);
12 void SplitLine(const std::string &line, std::vector<std::string> &args, const std::string &separatorChars = " \t",
13  const std::string &quoteChars = "\"'", const std::string &commentStartChars = "#",
14  bool ignoreZeroLengthFields = true);
15 
16 std::string createFullPath(const std::string &dir, const std::string &file);
17 
18 void abortWithMessage(const std::string &msg);
19 
20 bool parseAsInt(const std::string &str, int &number);
21 bool parseAsInt(const std::string &str, int64_t &number);
22 bool parseAsDouble(const std::string &str, double &number);
23 bool parseAsDoubleVector(const std::string &str, std::vector<double> &numbers, std::string &badField);
24 std::string doubleToString(double x);
25 
26 std::string trim(const std::string &str, const std::string &trimChars = " \t\r\n");
27 std::string replace(const std::string &input, const std::string &target, const std::string &replacement);
28 
29 #endif // UTIL_H
30