12 #ifndef GRT_UTIL_HEADER 13 #define GRT_UTIL_HEADER 16 #include "GRTVersionInfo.h" 17 #include "GRTTypedefs.h" 18 #include "../DataStructures/VectorFloat.h" 19 #include "../DataStructures/MatrixFloat.h" 21 #ifdef __GRT_WINDOWS_BUILD__ 31 #ifdef __GRT_OSX_BUILD__ 37 #ifdef __GRT_LINUX_BUILD__ 60 static bool getCxx11Enabled();
68 static bool sleep(
const unsigned int &numMilliseconds);
81 static Float scale(
const Float &x,
const Float &minSource,
const Float &maxSource,
const Float &minTarget,
const Float &maxTarget,
const bool constrain=
false);
89 static std::string timeAsString(
const bool includeDate=
true);
97 static std::string intToString(
const int &i);
105 static std::string intToString(
const unsigned int &i);
113 static std::string toString(
const int &i);
121 static std::string toString(
const unsigned int &i);
129 static std::string toString(
const long &i);
137 static std::string toString(
const unsigned long &i);
145 static std::string toString(
const unsigned long long &i);
153 static std::string toString(
const bool &b);
161 static std::string toString(
const float &v);
169 static std::string toString(
const double &v);
177 static std::string toString(
const long double &v);
185 static int stringToInt(
const std::string &s);
193 static double stringToDouble(
const std::string &s);
201 static Float stringToFloat(
const std::string &s);
209 static bool stringToBool(
const std::string &s);
218 static bool stringEndsWith(
const std::string &str,
const std::string &ending);
231 static Float limit(
const Float value,
const Float minValue,
const Float maxValue);
300 static VectorFloat scale(
const VectorFloat &x,
const Float minSource,
const Float maxSource,
const Float minTarget=0,
const Float maxTarget=1,
const bool constrain=
false);
335 static unsigned int getMinIndex(
const VectorFloat &x);
351 static unsigned int getMaxIndex(
const VectorFloat &x);
359 static unsigned int getMin(
const std::vector< unsigned int > &x);
367 static unsigned int getMax(
const std::vector< unsigned int > &x);
374 static unsigned int getOS();
385 static void cartToPolar(
const Float x,
const Float y,Float &r, Float &theta);
396 static void polarToCart(
const Float r,
const Float theta,Float &x, Float &y);
410 static bool parseDirectory(
const std::string directoryPath,
const std::string type, std::vector< std::string > &filenames );
421 #endif // GRT_UTIL_HEADER