[Liblas-commits] laszip: 3 new changesets

liblas-commits at liblas.org liblas-commits at liblas.org
Wed Dec 15 11:02:19 EST 2010


changeset c08c950673aa in /Volumes/Data/www/liblas.org/laszip
details: http://hg.liblas.orglaszip?cmd=changeset;node=c08c950673aa
summary: getting byte count

changeset a945ff06f7c1 in /Volumes/Data/www/liblas.org/laszip
details: http://hg.liblas.orglaszip?cmd=changeset;node=a945ff06f7c1
summary: getting byte count

changeset 874ca24b3890 in /Volumes/Data/www/liblas.org/laszip
details: http://hg.liblas.orglaszip?cmd=changeset;node=874ca24b3890
summary: getting annoyed at hg

diffstat:

 include/laszip/lasunzipper.hpp |   4 +-
 include/laszip/laszipper.hpp   |   5 +-
 src/bytestreamin_istream.hpp   |  95 ------------------------------------------
 src/bytestreamout_ostream.hpp  |  14 +++--
 src/lasunzipper.cpp            |   3 +-
 src/laszipper.cpp              |   3 +-
 tools/laszippertest.cpp        |  34 +++++++-------
 7 files changed, 36 insertions(+), 122 deletions(-)

diffs (truncated from 308 to 300 lines):

diff -r 755123ad7728 -r 874ca24b3890 include/laszip/lasunzipper.hpp
--- a/include/laszip/lasunzipper.hpp	Wed Dec 15 06:38:48 2010 -0800
+++ b/include/laszip/lasunzipper.hpp	Wed Dec 15 08:02:04 2010 -0800
@@ -52,6 +52,8 @@
 
 #include "laszip.hpp"
 
+using namespace std;
+    
 class ByteStreamIn;
 class LASreadPoint;
 
@@ -60,7 +62,7 @@
 public:
 
   bool open(FILE* file, unsigned int num_items, const LASitem* items, unsigned int compression=0);
-  bool open(std::istream* stream, 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();
 
diff -r 755123ad7728 -r 874ca24b3890 include/laszip/laszipper.hpp
--- a/include/laszip/laszipper.hpp	Wed Dec 15 06:38:48 2010 -0800
+++ b/include/laszip/laszipper.hpp	Wed Dec 15 08:02:04 2010 -0800
@@ -48,12 +48,13 @@
 
 #include <stdio.h>
 
-#if _MSC_VER < 1300
+#if _MSC_VER < 1300
 #include <ostream.h>
 #else
 #include <fstream>
 #endif
 
+using namespace std;
 
 #include "laszip.hpp"
 
@@ -65,7 +66,7 @@
 public:
 
   bool open(FILE* outfile, unsigned int num_items, LASitem* items, unsigned int compression=0);
-  bool open(std::ostream* outstream, 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);
diff -r 755123ad7728 -r 874ca24b3890 src/bytestreamin_istream.hpp
--- a/src/bytestreamin_istream.hpp	Wed Dec 15 06:38:48 2010 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,95 +0,0 @@
-/******************************************************************************
- *
- * 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.
- *
- ****************************************************************************/
-
-/*
-===============================================================================
-
-  FILE:  bytestreamin_istream.hpp
-  
-  CONTENTS:
-      
-  PROGRAMMERS:
-  
-    martin isenburg at cs.unc.edu
-  
-  COPYRIGHT:
-  
-    copyright (C) 2010  martin isenburg at cs.unc.edu
-    
-    This software is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-  
-  CHANGE HISTORY:
-  
-    12 December 2010 -- created from ByteStreamOutFile after Howard got pushy (-;
-  
-===============================================================================
-*/
-#ifndef BYTE_STREAM_IN_ISTREAM_H
-#define BYTE_STREAM_IN_ISTREAM_H
-
-#include "bytestreamin.hpp"
-
-#if _MSC_VER < 1300
-#include <istream.h>
-#else
-#include <fstream>
-#endif
-
-class ByteStreamInIstream : public ByteStreamIn
-{
-public:
-  ByteStreamInIstream(std::istream* stream);
-/* read a single byte                                        */
-  unsigned int getByte();
-/* read an array of bytes                                    */
-  bool getBytes(unsigned char* bytes, unsigned int num_bytes);
-/* destructor                                                */
-  ~ByteStreamInIstream(){};
-private:
-  std::istream* stream;
-};
-
-inline ByteStreamInIstream::ByteStreamInIstream(std::istream* stream)
-{
-  this->stream = stream;
-}
-
-inline unsigned int ByteStreamInIstream::getByte()
-{
-  int byte = stream->get();
-  if (stream->bad())
-  {
-    byte = 0;
-  }
-  return (unsigned int)byte;
-}
-
-inline bool ByteStreamInIstream::getBytes(unsigned char* bytes, unsigned int num_bytes)
-{
-    // http://stackoverflow.com/questions/604431/c-reading-unsigned-char-from-file-stream
-    // std::ifstream only provides a specialization for char, not unsigned char.  
-    
-    // WARNING, unsafe cast!!! -- hobu
-    
-  stream->read( (char*)bytes, num_bytes);
-  return !!(stream->good());
-}
-
-#endif
diff -r 755123ad7728 -r 874ca24b3890 src/bytestreamout_ostream.hpp
--- a/src/bytestreamout_ostream.hpp	Wed Dec 15 06:38:48 2010 -0800
+++ b/src/bytestreamout_ostream.hpp	Wed Dec 15 08:02:04 2010 -0800
@@ -52,10 +52,12 @@
 #include <fstream>
 #endif
 
+using namespace std;
+
 class ByteStreamOutOstream : public ByteStreamOut
 {
 public:
-  ByteStreamOutOstream(std::ostream* stream);
+  ByteStreamOutOstream(ostream* stream);
 /* write a single byte                                       */
   bool putByte(unsigned char byte);
 /* write an array of bytes                                   */
@@ -67,11 +69,11 @@
 /* destructor                                                */
   ~ByteStreamOutOstream(){};
 private:
-  std::ostream* stream;
-  std::ios::pos_type start;
+  ostream* stream;
+  ios::pos_type start;
 };
 
-ByteStreamOutOstream::ByteStreamOutOstream(std::ostream* stream)
+ByteStreamOutOstream::ByteStreamOutOstream(ostream* stream)
 {
   this->stream = stream;
   resetCount();
@@ -91,8 +93,8 @@
 
 unsigned int ByteStreamOutOstream::byteCount() const
 {
-  std::ios::pos_type end = stream->tellp();
-  std::ios::off_type size = end - start;
+  ios::pos_type end = stream->tellp();
+  ios::off_type size = end - start;
   return static_cast<unsigned int>(size);
 }
 
diff -r 755123ad7728 -r 874ca24b3890 src/lasunzipper.cpp
--- a/src/lasunzipper.cpp	Wed Dec 15 06:38:48 2010 -0800
+++ b/src/lasunzipper.cpp	Wed Dec 15 08:02:04 2010 -0800
@@ -49,6 +49,7 @@
 #include "bytestreamin_istream.hpp"
 #include "lasreadpoint.hpp"
 
+
 bool LASunzipper::open(FILE* infile, unsigned int num_items, const LASitem* items, unsigned int compression)
 {
   count = 0;
@@ -61,7 +62,7 @@
   return true;
 }
 
-bool LASunzipper::open(std::istream* instream, unsigned int num_items, const LASitem* items, unsigned int compression)
+bool LASunzipper::open(istream* instream, unsigned int num_items, const LASitem* items, unsigned int compression)
 {
   count = 0;
   stream = new ByteStreamInIstream(instream);
diff -r 755123ad7728 -r 874ca24b3890 src/laszipper.cpp
--- a/src/laszipper.cpp	Wed Dec 15 06:38:48 2010 -0800
+++ b/src/laszipper.cpp	Wed Dec 15 08:02:04 2010 -0800
@@ -48,6 +48,7 @@
 #include "bytestreamout_file.hpp"
 #include "bytestreamout_ostream.hpp"
 #include "laswritepoint.hpp"
+using namespace std;
 
 bool LASzipper::open(FILE* outfile, unsigned int num_items, LASitem* items, unsigned int compression)
 {
@@ -61,7 +62,7 @@
   return true;
 }
 
-bool LASzipper::open(std::ostream* outstream, unsigned int num_items, LASitem* items, unsigned int compression)
+bool LASzipper::open(ostream* outstream, unsigned int num_items, LASitem* items, unsigned int compression)
 {
   count = 0;
   stream = new ByteStreamOutOstream(outstream);
diff -r 755123ad7728 -r 874ca24b3890 tools/laszippertest.cpp
--- a/tools/laszippertest.cpp	Wed Dec 15 06:38:48 2010 -0800
+++ b/tools/laszippertest.cpp	Wed Dec 15 08:02:04 2010 -0800
@@ -57,6 +57,8 @@
 #endif
 
 
+using namespace std;
+
 #include <stdio.h>
 #include <stdlib.h>
 
@@ -66,16 +68,16 @@
   unsigned int i, j;
   unsigned int num_points = 100000;
   unsigned int num_errors = 0;
-  std::filebuf ofb1;
-  std::filebuf ofb2;
-  std::ostream* ostream1 = 0;
-  std::ostream* ostream2 = 0;
+  filebuf ofb1;
+  filebuf ofb2;
+  ostream* ostream1 = 0;
+  ostream* ostream2 = 0;
   FILE* ofile1 = 0;
   FILE* ofile2 = 0;
-  std::filebuf ifb1;
-  std::filebuf ifb2;
-  std::istream* istream1 = 0;
-  std::istream* istream2 = 0;
+  filebuf ifb1;
+  filebuf ifb2;
+  istream* istream1 = 0;
+  istream* istream2 = 0;
   FILE* ifile1 = 0;
   FILE* ifile2 = 0;
   
@@ -122,16 +124,16 @@
 
   if (use_iostream)
   {
-    ofb1.open("test1.lax", std::ios::out);
-    ostream1 = new std::ostream(&ofb1);
+    ofb1.open("test1.lax", ios::out);
+    ostream1 = new ostream(&ofb1);
     if (!laszipper1->open(ostream1, num_items, items, LASZIP_COMPRESSION_NONE))
     {
       fprintf(stderr, "ERROR: could not open laszipper1\n");
       exit(1);
     }
 
-    ofb2.open("test2.lax", std::ios::out);
-    ostream2 = new std::ostream(&ofb2);
+    ofb2.open("test2.lax", ios::out);
+    ostream2 = new ostream(&ofb2);
     if (!laszipper2->open(ostream2, num_items, items, LASZIP_COMPRESSION_ARITHMETIC))
     {
       fprintf(stderr, "ERROR: could not open laszipper2\n");
@@ -195,15 +197,15 @@
 
   if (use_iostream)
   {
-    ifb1.open("test1.lax", std::ios::in);
-    istream1 = new std::istream(&ifb1);
+    ifb1.open("test1.lax", ios::in);
+    istream1 = new istream(&ifb1);
     if (!lasunzipper1->open(istream1, num_items, items, LASZIP_COMPRESSION_NONE))
     {
       fprintf(stderr, "ERROR: could not open lasunzipper1\n");
       exit(1);


More information about the Liblas-commits mailing list