Skip to content

Commit

Permalink
syncing laszip.org with latest LASzip 2.4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Isenburg committed Feb 25, 2016
1 parent ff16991 commit 1c0ed13
Show file tree
Hide file tree
Showing 30 changed files with 7,106 additions and 331 deletions.
23 changes: 22 additions & 1 deletion src/bytestreamin.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
COPYRIGHT:
(c) 2007-2012, martin isenburg, rapidlasso - tools to catch reality
(c) 2007-2012, martin isenburg, rapidlasso - fast tools to catch reality
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
Expand All @@ -24,6 +24,7 @@
CHANGE HISTORY:
2 January 2013 -- new functions for reading a stream of groups of bits
1 October 2011 -- added 64 bit file support in MSVC 6.0 at McCafe at Hbf Linz
10 January 2011 -- licensing change for LGPL release and liblas integration
12 December 2010 -- created from ByteStreamOutFile after Howard got pushy (-;
Expand All @@ -38,6 +39,21 @@
class ByteStreamIn
{
public:
/* write single bits */
inline U32 getBits(U32 num_bits)
{
if (num_buffer < num_bits)
{
U32 input_bits;
get32bitsLE((U8*)&input_bits);
bit_buffer = bit_buffer | (((U64)input_bits) << num_buffer);
num_buffer = num_buffer + 32;
}
U32 new_bits = (U32)(bit_buffer & ((1 << num_bits) - 1));
bit_buffer = bit_buffer >> num_bits;
num_buffer = num_buffer - num_bits;
return new_bits;
};
/* read a single byte */
virtual U32 getByte() = 0;
/* read an array of bytes */
Expand All @@ -62,8 +78,13 @@ class ByteStreamIn
virtual BOOL seek(const I64 position) = 0;
/* seek to the end of the file */
virtual BOOL seekEnd(const I64 distance=0) = 0;
/* constructor */
inline ByteStreamIn() { bit_buffer = 0; num_buffer = 0; };
/* destructor */
virtual ~ByteStreamIn() {};
private:
U64 bit_buffer;
U32 num_buffer;
};

#endif
3 changes: 2 additions & 1 deletion src/bytestreamin_array.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
CHANGE HISTORY:
9 April 2012 -- created after cooking Zuccini/Onion/Potatoe dinner for Mara
19 July 2015 -- moved from LASlib to LASzip for "compatibility mode" in DLL
9 April 2012 -- created after cooking Zuccini/Onion/Potatoe dinner for Mara
===============================================================================
*/
Expand Down
2 changes: 1 addition & 1 deletion src/bytestreamin_file.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
COPYRIGHT:
(c) 2007-2012, martin isenburg, rapidlasso - tools to catch reality
(c) 2007-2012, martin isenburg, rapidlasso - fast tools to catch reality
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
Expand Down
2 changes: 1 addition & 1 deletion src/bytestreamin_istream.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
COPYRIGHT:
(c) 2007-2012, martin isenburg, rapidlasso - tools to catch reality
(c) 2007-2012, martin isenburg, rapidlasso - fast tools to catch reality
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
Expand Down
45 changes: 45 additions & 0 deletions src/bytestreaminout.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
===============================================================================
FILE: bytestreaminout.hpp
CONTENTS:
Abstract base class for streams that both input and output with endian handling.
PROGRAMMERS:
[email protected] - https://rapidlasso.com
COPYRIGHT:
(c) 2007-2013, martin isenburg, rapidlasso - fast tools to catch reality
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.
This software is distributed WITHOUT ANY WARRANTY and without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
CHANGE HISTORY:
29 December 2013 -- created after helping a client to QA their Optech LiDAR
===============================================================================
*/
#ifndef BYTE_STREAM_INOUT_HPP
#define BYTE_STREAM_INOUT_HPP

#include "mydefs.hpp"
#include "bytestreamin.hpp"
#include "bytestreamout.hpp"

class ByteStreamInOut : public ByteStreamIn, ByteStreamOut
{
public:
/* destructor */
virtual ~ByteStreamInOut() {};
};

#endif
57 changes: 57 additions & 0 deletions src/bytestreaminout_file.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/*
===============================================================================
FILE: bytestreaminout_file.hpp
CONTENTS:
Class for FILE*-based streams that both input and output with endian handling.
PROGRAMMERS:
[email protected] - https://rapidlasso.com
COPYRIGHT:
(c) 2007-2013, martin isenburg, rapidlasso - fast tools to catch reality
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.
This software is distributed WITHOUT ANY WARRANTY and without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
CHANGE HISTORY:
29 December 2013 -- created after helping a client to QA their Optech LiDAR
===============================================================================
*/
#ifndef BYTE_STREAM_INOUT_FILE_HPP
#define BYTE_STREAM_INOUT_FILE_HPP

#include "bytestreamin_file.hpp"
#include "bytestreamout_file.hpp"

class ByteStreamInOutFileLE : public ByteStreamInFileLE, public ByteStreamOutFileLE
{
public:
ByteStreamInOutFileLE(FILE* file);
};

class ByteStreamInOutFileBE : public ByteStreamInFileBE, public ByteStreamOutFileBE
{
public:
ByteStreamInOutFileBE(FILE* file);
};

inline ByteStreamInOutFileLE::ByteStreamInOutFileLE(FILE* file) : ByteStreamInFileLE(file), ByteStreamOutFileLE(file)
{
}

inline ByteStreamInOutFileBE::ByteStreamInOutFileBE(FILE* file) : ByteStreamInFileBE(file), ByteStreamOutFileBE(file)
{
}

#endif
36 changes: 35 additions & 1 deletion src/bytestreamout.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
COPYRIGHT:
(c) 2007-2012, martin isenburg, rapidlasso - fast tools to catch reality
(c) 2007-2013, martin isenburg, rapidlasso - fast tools to catch reality
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
Expand All @@ -24,6 +24,7 @@
CHANGE HISTORY:
2 January 2013 -- new functions for writing a stream of groups of bits
1 O