From 90f486fdfd5fc3241b326390599985c6882b2793 Mon Sep 17 00:00:00 2001
From: Emmanuel Christophe <emmanuel.christophe@orfeo-toolbox.org>
Date: Sat, 26 Mar 2011 14:34:27 -0700
Subject: [PATCH] ENH: Utils function to convert to string

---
 Code/Common/otbUtils.cxx |  8 +++++++-
 Code/Common/otbUtils.h   | 16 +++++++++++-----
 2 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/Code/Common/otbUtils.cxx b/Code/Common/otbUtils.cxx
index 4af006907b..1beb2b1acd 100644
--- a/Code/Common/otbUtils.cxx
+++ b/Code/Common/otbUtils.cxx
@@ -17,11 +17,15 @@
 =========================================================================*/
 
 #include "otbUtils.h"
+#include <sstream>
 
 namespace otb
 {
 
-bool Utils::IsLonLatValid(double lon, double lat)
+namespace Utils
+{
+
+bool IsLonLatValid(double lon, double lat)
 {
   if (lon < -180.0) return false;
   if (lon > 180.0) return false;
@@ -31,3 +35,5 @@ bool Utils::IsLonLatValid(double lon, double lat)
 }
 
 }
+
+}
diff --git a/Code/Common/otbUtils.h b/Code/Common/otbUtils.h
index 6ab435e7a3..dd0b5b8c10 100644
--- a/Code/Common/otbUtils.h
+++ b/Code/Common/otbUtils.h
@@ -29,14 +29,20 @@ namespace otb
  * Some usefull utilities in use across the library
  *
  */
-class ITK_EXPORT Utils
+namespace Utils
 {
-public:
-
   /** Check that the values for lon, lat are reasonable */
-  static bool IsLonLatValid(double lon, double lat);
+  bool IsLonLatValid(double lon, double lat);
+
+  template <class T>
+    inline std::string ConvertToString (const T& v)
+  {
+    std::stringstream s;
+    s << v;
+    return s.str();
+  }
 
-};
+}
 
 } // namespace otb
 
-- 
GitLab