[Liblas-commits] hg: move GetStream of detail::Writer down into pimpl

liblas-commits at liblas.org liblas-commits at liblas.org
Tue May 4 14:09:04 EDT 2010


changeset 4496a84f0d06 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=4496a84f0d06
summary: move GetStream of detail::Writer down into pimpl

diffstat:

 include/liblas/laswriter.hpp |  2 +-
 src/detail/writer/writer.cpp |  1 -
 src/las_c_api.cpp            |  4 +++-
 src/laswriter.cpp            |  6 +++---
 4 files changed, 7 insertions(+), 6 deletions(-)

diffs (60 lines):

diff -r 6f47f776555e -r 4496a84f0d06 include/liblas/laswriter.hpp
--- a/include/liblas/laswriter.hpp	Tue May 04 12:17:29 2010 -0500
+++ b/include/liblas/laswriter.hpp	Tue May 04 13:08:58 2010 -0500
@@ -105,7 +105,7 @@
 
     Header m_header;
     detail::PointRecord m_record;
-    std::ostream& m_ofs;
+    // std::ostream& m_ofs;
 
 };
 
diff -r 6f47f776555e -r 4496a84f0d06 src/detail/writer/writer.cpp
--- a/src/detail/writer/writer.cpp	Tue May 04 12:17:29 2010 -0500
+++ b/src/detail/writer/writer.cpp	Tue May 04 13:08:58 2010 -0500
@@ -188,7 +188,6 @@
 }
 
 
-
 WriterImpl* WriterFactory::Create(std::ostream& ofs)
 {
     if (!ofs)
diff -r 6f47f776555e -r 4496a84f0d06 src/las_c_api.cpp
--- a/src/las_c_api.cpp	Tue May 04 12:17:29 2010 -0500
+++ b/src/las_c_api.cpp	Tue May 04 13:08:58 2010 -0500
@@ -1453,7 +1453,9 @@
     
         if (static_cast<std::ofstream&>(*ostrm))
             static_cast<std::ofstream&>(*ostrm).close();
-        delete ostrm;
+        
+        if (ostrm != NULL)
+            delete ostrm;
         ostrm = NULL;
   
         }  catch (std::runtime_error const& e/* e */) 
diff -r 6f47f776555e -r 4496a84f0d06 src/laswriter.cpp
--- a/src/laswriter.cpp	Tue May 04 12:17:29 2010 -0500
+++ b/src/laswriter.cpp	Tue May 04 13:08:58 2010 -0500
@@ -54,8 +54,7 @@
 {
 
 Writer::Writer(std::ostream& ofs, Header const& header) :
-    m_pimpl(detail::WriterFactory::Create(ofs)), m_header(header),
-    m_ofs(ofs)
+    m_pimpl(detail::WriterFactory::Create(ofs)), m_header(header)
 {
     m_pimpl->WriteHeader(m_header);
 }
@@ -86,7 +85,8 @@
 
 std::ostream& Writer::GetStream() const
 {
-    return m_ofs;
+    return m_pimpl->GetStream();
+    // return m_ofs;
 }
 
 void Writer::WriteHeader(Header& header)


More information about the Liblas-commits mailing list