MCPcopy Create free account
hub / github.com/PDAL/PDAL / numericCast

Function numericCast

pdal/util/Utils.hpp:747–764  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

745 */
746 template<typename T_IN, typename T_OUT>
747 bool numericCast(T_IN in, T_OUT& out)
748 {
749 if (std::is_same<T_IN, T_OUT>::value)
750 {
751 out = static_cast<T_OUT>(in);
752 return true;
753 }
754 if (std::is_integral<T_OUT>::value)
755 in = static_cast<T_IN>(sround((double)in));
756 if ((std::is_same<T_OUT, double>::value) ||
757 (in <= static_cast<double>((std::numeric_limits<T_OUT>::max)()) &&
758 in >= static_cast<double>(std::numeric_limits<T_OUT>::lowest())))
759 {
760 out = static_cast<T_OUT>(in);
761 return true;
762 }
763 return false;
764 }
765
766 /**
767 Convert a numeric value from double to float. Specialization to handle

Callers 14

writeMethod · 0.85
inspectMethod · 0.85
initializeMethod · 0.85
fillPointBufMethod · 0.85
packMethod · 0.85
TESTFunction · 0.85
getFieldAsMethod · 0.85
setFieldMethod · 0.85
readFieldMethod · 0.85
readPointMethod · 0.85
getFieldAsFunction · 0.85
setFieldFunction · 0.85

Calls 1

sroundFunction · 0.85

Tested by 1

TESTFunction · 0.68