From e96b447e375e06764e9602c537c2c69c91e20b27 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Mon, 29 Jul 2013 11:42:33 -0400 Subject: [PATCH] add print_cast() Cast value to "printable" type. A no-op except for char types, which are cast to int so that they are printed as numbers std::ostream operators. --- pvDataApp/misc/typeCast.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pvDataApp/misc/typeCast.h b/pvDataApp/misc/typeCast.h index 8bf33be..0717d0c 100644 --- a/pvDataApp/misc/typeCast.h +++ b/pvDataApp/misc/typeCast.h @@ -159,6 +159,14 @@ static FORCE_INLINE TO castUnsafe(const FROM& from) void castUnsafeV(size_t count, ScalarType to, void *dest, ScalarType from, const void *src); +//! Cast value to printable type +//! A no-op except for char types, which are cast to int +//! so that they are printed as numbers std::ostream operators. +template +static FORCE_INLINE +typename detail::print_cast::type +print_cast(const T& v) { return v; } + }} // end namespace #endif // PVTYPECAST_H