[Liblas-commits] laszip: 4 new changesets

liblas-commits at liblas.org liblas-commits at liblas.org
Wed Dec 15 11:28:00 EST 2010


changeset 6fc09696ca40 in /Volumes/Data/www/liblas.org/laszip
details: http://hg.liblas.orglaszip?cmd=changeset;node=6fc09696ca40
summary: eof instead of bad

changeset e7dea1f25db5 in /Volumes/Data/www/liblas.org/laszip
details: http://hg.liblas.orglaszip?cmd=changeset;node=e7dea1f25db5
summary: added check for input & output bytes

changeset eafa0e1730af in /Volumes/Data/www/liblas.org/laszip
details: http://hg.liblas.orglaszip?cmd=changeset;node=eafa0e1730af
summary: merging with my code

changeset e4af65b349e7 in /Volumes/Data/www/liblas.org/laszip
details: http://hg.liblas.orglaszip?cmd=changeset;node=e4af65b349e7
summary: merging with my code

diffstat:

 include/laszip/lasunzipper.hpp |  75 +++++++++++++++++---------------
 include/laszip/laszipper.hpp   |  81 +++++++++++++++++------------------
 src/bytestreamin.hpp           |   4 +
 src/bytestreamin_file.hpp      |  25 +++++++++-
 src/bytestreamin_istream.hpp   |  95 +++++++++++++++++++++--------------------
 src/bytestreamout_ostream.hpp  |  87 ++++++++++++++++++++-----------------
 src/lasunzipper.cpp            |  82 ++++++++++++++++++------------------
 src/laszipper.cpp              |  84 ++++++++++++++++++------------------
 tools/laszippertest.cpp        |  51 +++++++++++-----------
 9 files changed, 308 insertions(+), 276 deletions(-)

diffs (truncated from 968 to 300 lines):

diff -r f9bbc9504f92 -r e4af65b349e7 include/laszip/lasunzipper.hpp
--- a/include/laszip/lasunzipper.hpp	Wed Dec 15 08:02:55 2010 -0800
+++ b/include/laszip/lasunzipper.hpp	Wed Dec 15 08:27:40 2010 -0800
@@ -1,21 +1,21 @@
-/******************************************************************************
- *
- * Project:  integrating laszip into liblas - http://liblas.org -
- * Purpose:
- * Author:   Martin Isenburg
- *           isenburg at cs.unc.edu
- *
- ******************************************************************************
- * Copyright (c) 2010, Martin Isenburg
- *
- * This is free software; you can redistribute and/or modify it under
- * the terms of the GNU Lesser General Licence as published
- * by the Free Software Foundation.
- *
- * See the COPYING file for more information.
- *
- ****************************************************************************/
-
+/******************************************************************************
+ *
+ * Project:  integrating laszip into liblas - http://liblas.org -
+ * Purpose:
+ * Author:   Martin Isenburg
+ *           isenburg at cs.unc.edu
+ *
+ ******************************************************************************
+ * Copyright (c) 2010, Martin Isenburg
+ *
+ * This is free software; you can redistribute and/or modify it under
+ * the terms of the GNU Lesser General Licence as published
+ * by the Free Software Foundation.
+ *
+ * See the COPYING file for more information.
+ *
+ ****************************************************************************/
+
 /*
 ===============================================================================
 
@@ -39,40 +39,43 @@
   
   CHANGE HISTORY:
   
-    12 December 2010 -- created from LASwriter/LASreader after Howard got pushy (-;
+    12 December 2010 -- created from LASwriter/LASreader after Howard got pushy (-;
   
 ===============================================================================
 */
 #ifndef LAS_UNZIPPER_H
 #define LAS_UNZIPPER_H
 
-#include <stdio.h>
+#include <stdio.h>
+
+#if _MSC_VER < 1300
+#include <fstream.h>
+#else
+#include <fstream>
+using namespace std;
+#endif
+
+#include "laszip.hpp"
 
-#include <fstream>
-
-#include "laszip.hpp"
-
-using namespace std;
-    
-class ByteStreamIn;
-class LASreadPoint;
-
+class ByteStreamIn;
+class LASreadPoint;
+
 class LASunzipper
 {
 public:
 
-  bool open(FILE* file, unsigned int num_items, const LASitem* items, unsigned int compression=0);
-  bool open(istream* stream, unsigned int num_items, const LASitem* items, unsigned int compression=0);
-  bool read(unsigned char** point);
-  bool close();
+  bool open(FILE* file, unsigned int num_items, const LASitem* items, unsigned int compression=0);
+  bool open(istream* stream, unsigned int num_items, const LASitem* items, unsigned int compression=0);
+  bool read(unsigned char** point);
+  unsigned int close();
 
   LASunzipper();
   ~LASunzipper();
 
-private:
+private:
   int count;
-  ByteStreamIn* stream;
-  LASreadPoint* reader;
+  ByteStreamIn* stream;
+  LASreadPoint* reader;
 };
 
 #endif
diff -r f9bbc9504f92 -r e4af65b349e7 include/laszip/laszipper.hpp
--- a/include/laszip/laszipper.hpp	Wed Dec 15 08:02:55 2010 -0800
+++ b/include/laszip/laszipper.hpp	Wed Dec 15 08:27:40 2010 -0800
@@ -1,21 +1,21 @@
-/******************************************************************************
- *
- * Project:  integrating laszip into liblas - http://liblas.org -
- * Purpose:
- * Author:   Martin Isenburg
- *           isenburg at cs.unc.edu
- *
- ******************************************************************************
- * Copyright (c) 2010, Martin Isenburg
- *
- * This is free software; you can redistribute and/or modify it under
- * the terms of the GNU Lesser General Licence as published
- * by the Free Software Foundation.
- *
- * See the COPYING file for more information.
- *
- ****************************************************************************/
-
+/******************************************************************************
+ *
+ * Project:  integrating laszip into liblas - http://liblas.org -
+ * Purpose:
+ * Author:   Martin Isenburg
+ *           isenburg at cs.unc.edu
+ *
+ ******************************************************************************
+ * Copyright (c) 2010, Martin Isenburg
+ *
+ * This is free software; you can redistribute and/or modify it under
+ * the terms of the GNU Lesser General Licence as published
+ * by the Free Software Foundation.
+ *
+ * See the COPYING file for more information.
+ *
+ ****************************************************************************/
+
 /*
 ===============================================================================
 
@@ -39,45 +39,44 @@
   
   CHANGE HISTORY:
   
-    12 December 2010 -- created from LASwriter/LASreader after Howard got pushy (-;
+    12 December 2010 -- created from LASwriter/LASreader after Howard got pushy (-;
   
 ===============================================================================
 */
 #ifndef LAS_ZIPPER_H
 #define LAS_ZIPPER_H
 
-#include <stdio.h>
+#include <stdio.h>
+
+#if _MSC_VER < 1300
+#include <fstream.h>
+#else
+#include <fstream>
+using namespace std;
+#endif
+
+#include "laszip.hpp"
 
-#if _MSC_VER < 1300
-#include <ostream.h>
-#else
-#include <fstream>
-#endif
-
-using namespace std;
-
-#include "laszip.hpp"
-
-class ByteStreamOut;
-class LASwritePoint;
-
+class ByteStreamOut;
+class LASwritePoint;
+
 class LASzipper
 {
 public:
 
-  bool open(FILE* outfile, unsigned int num_items, LASitem* items, unsigned int compression=0);
-  bool open(ostream* outstream, unsigned int num_items, LASitem* items, unsigned int compression=0);
-  bool write(unsigned char** point);
-  bool chunk(LASchunk* chunk);
-  bool close(LASchunk* chunk=0);
+  bool open(FILE* outfile, unsigned int num_items, LASitem* items, unsigned int compression=0);
+  bool open(ostream* outstream, unsigned int num_items, LASitem* items, unsigned int compression=0);
+  bool write(unsigned char** point);
+  bool chunk(LASchunk* chunk);
+  unsigned int close(LASchunk* chunk=0);
 
   LASzipper();
   ~LASzipper();
 
-private:
+private:
   int count;
-  ByteStreamOut* stream;
-  LASwritePoint* writer;
+  ByteStreamOut* stream;
+  LASwritePoint* writer;
 };
 
 #endif
diff -r f9bbc9504f92 -r e4af65b349e7 src/bytestreamin.hpp
--- a/src/bytestreamin.hpp	Wed Dec 15 08:02:55 2010 -0800
+++ b/src/bytestreamin.hpp	Wed Dec 15 08:27:40 2010 -0800
@@ -51,6 +51,10 @@
   virtual unsigned int getByte() = 0;
 /* read an array of bytes                                    */
   virtual bool getBytes(unsigned char* bytes, unsigned int num_bytes) = 0;
+/* returns how many bytes were read since last reset         */
+  virtual unsigned int byteCount() const = 0;
+/* reset byte counter                                        */
+  virtual void resetCount() = 0;
 /* destructor                                                */
   virtual ~ByteStreamIn() {};
 };
diff -r f9bbc9504f92 -r e4af65b349e7 src/bytestreamin_file.hpp
--- a/src/bytestreamin_file.hpp	Wed Dec 15 08:02:55 2010 -0800
+++ b/src/bytestreamin_file.hpp	Wed Dec 15 08:27:40 2010 -0800
@@ -56,22 +56,29 @@
   unsigned int getByte();
 /* read an array of bytes                                    */
   bool getBytes(unsigned char* bytes, unsigned int num_bytes);
+/* returns how many bytes were read since last reset         */
+  unsigned int byteCount() const;
+/* reset byte counter                                        */
+  void resetCount();
 /* destructor                                                */
   ~ByteStreamInFile(){};
 private:
-  FILE* fp;
+  FILE* file;
+  long start;
 };
 
 ByteStreamInFile::ByteStreamInFile(FILE* file)
 {
-  fp = file;
+  this->file = file;
+  resetCount();
 }
 
 unsigned int ByteStreamInFile::getByte()
 {
-  int byte = getc(fp);
+  int byte = getc(file);
   if (byte == EOF)
   {
+    fprintf(stderr, "reading EOF\n");
     byte = 0;
   }
   return (unsigned int)byte;
@@ -79,7 +86,17 @@
 
 bool ByteStreamInFile::getBytes(unsigned char* bytes, unsigned int num_bytes)
 {
-  return (fread(bytes, 1, num_bytes, fp) != num_bytes);
+  return (fread(bytes, 1, num_bytes, file) != num_bytes);
+}
+
+unsigned int ByteStreamInFile::byteCount() const
+{
+  return ftell(file)-start;
+}
+
+void ByteStreamInFile::resetCount()
+{
+  start = ftell(file);
 }
 
 #endif
diff -r f9bbc9504f92 -r e4af65b349e7 src/bytestreamin_istream.hpp
--- a/src/bytestreamin_istream.hpp	Wed Dec 15 08:02:55 2010 -0800
+++ b/src/bytestreamin_istream.hpp	Wed Dec 15 08:27:40 2010 -0800
@@ -16,50 +16,49 @@
  *
  ****************************************************************************/
 
-/*
-===============================================================================
-
-  FILE:  bytestreamin_istream.hpp
-  
-  CONTENTS:
-      
-  PROGRAMMERS:


More information about the Liblas-commits mailing list