Skip to content

Commit

Permalink
Clear header during initialize.
Browse files Browse the repository at this point in the history
  • Loading branch information
abellgithub committed Jul 13, 2020
1 parent 9f13fa0 commit 5b2e0ba
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
13 changes: 13 additions & 0 deletions io/PcdHeader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,19 @@
namespace pdal
{

void PcdHeader::clear()
{
m_version = PcdVersion::PCD_V6;
m_width = 1;
m_height = 0;
m_pointCount = 0;
m_origin = { 0, 0, 0, 0 };
m_orientation = { 1, 0, 0, 0 };
m_dataOffset = 0;
m_fields.clear();
m_numLines = 0;
}

std::istream& operator>>(std::istream& in, PcdVersion& version)
{
float f;
Expand Down
7 changes: 3 additions & 4 deletions io/PcdHeader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,9 @@ typedef std::vector<PcdField> PcdFieldList;
struct PcdHeader
{
PcdHeader()
: m_version(PcdVersion::PCD_V6), m_width(1), m_height(0),
m_pointCount(0), m_origin(0, 0, 0, 0), m_orientation(1, 0, 0, 0)
{
}
{ clear(); }

void clear();

PcdVersion m_version;
PcdFieldList m_fields;
Expand Down
1 change: 1 addition & 0 deletions io/PcdReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ void PcdReader::initialize()
throwError("Can't open file '" + m_filename + "'.");
try
{
m_header.clear();
*m_istreamPtr >> m_header;
}
catch( ... )
Expand Down

0 comments on commit 5b2e0ba

Please sign in to comment.