[Liblas-commits] r984 - in trunk: include/liblas src

liblas-commits at liblas.org liblas-commits at liblas.org
Tue Feb 3 00:32:02 EST 2009


Author: hobu
Date: Tue Feb  3 00:32:01 2009
New Revision: 984
URL: http://liblas.org/changeset/984

Log:
an attempt at a Reset() and IsEOF() functions #85

Modified:
   trunk/include/liblas/lasreader.hpp
   trunk/src/lasreader.cpp

Modified: trunk/include/liblas/lasreader.hpp
==============================================================================
--- trunk/include/liblas/lasreader.hpp	(original)
+++ trunk/include/liblas/lasreader.hpp	Tue Feb  3 00:32:01 2009
@@ -78,6 +78,9 @@
     // Allow fetching of the stream
     std::istream& GetStream() const;
     
+    bool Reset();
+    bool IsEOF() const;
+    
 private:
 
     // Blocked copying operations, declared but not defined.
@@ -85,6 +88,7 @@
     LASReader& operator=(LASReader const& rhs);
 
     void Init(); // throws on error
+    void MakePIMPL(std::istream& ifs);
 
     /// \todo TODO: Should we handle m_record.point_source_id ?
     void MakePoint(double const& time);

Modified: trunk/src/lasreader.cpp
==============================================================================
--- trunk/src/lasreader.cpp	(original)
+++ trunk/src/lasreader.cpp	Tue Feb  3 00:32:01 2009
@@ -52,9 +52,9 @@
 namespace liblas
 {
 
-LASReader::LASReader(std::istream& ifs) :
-    m_pimpl(detail::ReaderFactory::Create(ifs))
+LASReader::LASReader(std::istream& ifs) 
 {
+    MakePIMPL(ifs);
     Init();
 }
 
@@ -140,9 +140,14 @@
     return m_point;
 }
 
+void LASReader::MakePIMPL(std::istream& ifs) 
+{
+    detail::Reader* ptr = detail::ReaderFactory::Create(ifs);
+    std::auto_ptr<detail::Reader>m_pimpl (ptr);
 
+}
 void LASReader::Init()
-{
+{    
     bool ret = m_pimpl->ReadHeader(m_header);
 
     if (!ret)
@@ -179,5 +184,19 @@
     return m_pimpl->GetStream();
 }
 
+bool LASReader::Reset() 
+{
+    std::istream& ifs = GetStream();
+    ifs.clear();
+    ifs.seekg(0);
+    MakePIMPL(ifs);
+    return true;
+}
+
+bool LASReader::IsEOF() const
+{
+    return GetStream().eof();
+}
+
 } // namespace liblas
 


More information about the Liblas-commits mailing list