Skip to content

Commit

Permalink
Moved inline designations to function declarations.
Browse files Browse the repository at this point in the history
  • Loading branch information
MrAlexSee committed Jun 28, 2018
1 parent 137a5fa commit e89c07c
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions helpers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,32 +30,32 @@ struct Helpers
*** FILES
*/

static bool isFileReadable(const string &filePath);
static string readFile(const string &filePath);
inline static bool isFileReadable(const string &filePath);
inline static string readFile(const string &filePath);

inline static void dumpToFile(const string &text, const string &filePath, bool newline = false);
inline static bool removeFile(const string &filePath);

static void dumpToFile(const string &text, const string &filePath, bool newline = false);
static bool removeFile(const string &filePath);

/*
*** RANDOM
*/

static int randIntRangeExcluded(int start, int end, int excluded);
inline static int randIntRangeExcluded(int start, int end, int excluded);

/*
*** STRINGS
*/

template<typename T>
static string join(const vector<T> &vec, const string &delim);
static void removeEmptyStrings(vector<string> &vec);
inline static void removeEmptyStrings(vector<string> &vec);

static string genRandomString(int size, string alphabet);
static string genRandomStringAlphNum(int size);
inline static string genRandomString(int size, string alphabet);
inline static string genRandomStringAlphNum(int size);

private:
template<typename T, typename = typename enable_if<is_arithmetic<T>::value, T>::type>
static string toString(T val)
inline static string toString(T val)
{
return to_string(val);
}
Expand All @@ -69,7 +69,7 @@ struct Helpers
};

template<typename T>
inline void Helpers::calcStatsMedian(const vector<T> &throughputVec, T *throughputMedian)
void Helpers::calcStatsMedian(const vector<T> &throughputVec, T *throughputMedian)
{
if (throughputVec.size() == 0)
{
Expand All @@ -82,13 +82,13 @@ inline void Helpers::calcStatsMedian(const vector<T> &throughputVec, T *throughp
*throughputMedian = tmp[tmp.size() / 2];
}

inline bool Helpers::isFileReadable(const string &filePath)
bool Helpers::isFileReadable(const string &filePath)
{
ifstream inStream(filePath);
return inStream.good();
}

inline string Helpers::readFile(const string &filePath)
string Helpers::readFile(const string &filePath)
{
ifstream inStream(filePath);

Expand All @@ -100,7 +100,7 @@ inline string Helpers::readFile(const string &filePath)
return static_cast<stringstream const&>(stringstream() << inStream.rdbuf()).str();
}

inline void Helpers::dumpToFile(const string &text, const string &filePath, bool newline)
void Helpers::dumpToFile(const string &text, const string &filePath, bool newline)
{
ofstream outStream(filePath, ios_base::app);

Expand All @@ -117,12 +117,12 @@ inline void Helpers::dumpToFile(const string &text, const string &filePath, bool
}
}

inline bool Helpers::removeFile(const string &filePath)
bool Helpers::removeFile(const string &filePath)
{
return remove(filePath.c_str()) == 0;
}

inline int Helpers::randIntRangeExcluded(int start, int end, int excluded)
int Helpers::randIntRangeExcluded(int start, int end, int excluded)
{
if (start > end or (start == end and start == excluded))
{
Expand All @@ -144,7 +144,7 @@ inline int Helpers::randIntRangeExcluded(int start, int end, int excluded)
}

template<typename T>
inline string Helpers::join(const vector<T> &vec, const string &delim)
string Helpers::join(const vector<T> &vec, const string &delim)
{
if (vec.size() == 0)
{
Expand All @@ -161,7 +161,7 @@ inline string Helpers::join(const vector<T> &vec, const string &delim)
return res + toString(vec.back());
}

inline void Helpers::removeEmptyStrings(vector<string> &vec)
void Helpers::removeEmptyStrings(vector<string> &vec)
{
vector<string>::iterator it = vec.begin();

Expand All @@ -178,7 +178,7 @@ inline void Helpers::removeEmptyStrings(vector<string> &vec)
}
}

inline string Helpers::genRandomString(int size, string alphabet)
string Helpers::genRandomString(int size, string alphabet)
{
random_device rd;
mt19937 mt(rd());
Expand All @@ -194,7 +194,7 @@ inline string Helpers::genRandomString(int size, string alphabet)
return res;
}

inline string Helpers::genRandomStringAlphNum(int size)
string Helpers::genRandomStringAlphNum(int size)
{
random_device rd;
mt19937 mt(rd());
Expand Down

0 comments on commit e89c07c

Please sign in to comment.