22#define __MIA_TOOLS_HH 1
58 std::list<std::string>& result;
59 const std::string pattern;
65 FSearchFiles(std::list<std::string>& __result,
const std::string& __pattern);
68 void operator()(
const std::string& path);
93template <
typename T,
bool is_
float>
96 static T apply(
double x)
103struct __round<T, false> {
104 static T apply(
double x)
106 return static_cast<T
>(rint(x));
124 const bool is_floating_point = std::is_floating_point<T>::value;
125 return __round<T, is_floating_point>::apply(x);
134template <
typename T,
bool is_
float>
135struct __round_clamped {
137 static T apply(
double x)
144struct __round_clamped<float, true> {
146 static float apply(
double x)
148 double y = x < std::numeric_limits<float>::max() ?
149 ( x > -std::numeric_limits<float>::max() ? x : -std::numeric_limits<float>::max()) :
150 std::numeric_limits<float>::max();
151 return static_cast<float>(y);
156struct __round_clamped<bool, false> {
157 static float apply(
double x)
165struct __round_clamped<T, false> {
166 static T apply(
double x)
168 const double y = rint(x);
169 const double yy = y < std::numeric_limits<T>::max() ?
170 ( y > std::numeric_limits<T>::min() ? y : std::numeric_limits<T>::min()) :
171 std::numeric_limits<T>::max();
172 return static_cast<T
>(yy);
190 const bool is_floating_point = std::is_floating_point<T>::value;
191 return __round_clamped<T, is_floating_point>::apply(x);
195inline void eat_char( std::istream& is,
char expect_val,
const char *message)
200 if ( c != expect_val)
201 throw std::runtime_error(message);
A Scope based helper class to save and restore the current working directory.
#define NS_MIA_BEGIN
conveniance define to start the mia namespace
#define EXPORT_CORE
Macro to manage Visual C++ style dllimport/dllexport.
#define NS_MIA_END
conveniance define to end the mia namespace
void EXPORT_CORE sincosf(float x, float *sin, float *cos)
void EXPORT_CORE sincos(double x, double *sin, double *cos)
T mia_round_clamped(double x)
void eat_char(std::istream &is, char expect_val, const char *message)