[Liblas-commits] hg: store a shared_ptr for each point as it is read
liblas-commits at liblas.org
liblas-commits at liblas.org
Wed Jul 28 12:29:36 EDT 2010
changeset 270605152ed9 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=270605152ed9
summary: store a shared_ptr for each point as it is read
diffstat:
include/liblas/detail/reader/point.hpp | 4 ++--
include/liblas/laspoint.hpp | 11 ++++++-----
src/detail/reader/point.cpp | 8 ++++----
src/detail/reader/reader.cpp | 2 +-
src/laspoint.cpp | 2 +-
5 files changed, 14 insertions(+), 13 deletions(-)
diffs (120 lines):
diff -r b66b720d3abd -r 270605152ed9 include/liblas/detail/reader/point.hpp
--- a/include/liblas/detail/reader/point.hpp Wed Jul 28 10:40:31 2010 -0500
+++ b/include/liblas/detail/reader/point.hpp Wed Jul 28 11:00:14 2010 -0500
@@ -60,7 +60,7 @@
{
public:
- Point(std::istream& ifs, const liblas::Header& header);
+ Point(std::istream& ifs, HeaderPtr header);
virtual ~Point();
std::istream& GetStream() const;
@@ -80,7 +80,7 @@
Point& operator=(Point const& rhs);
std::istream& m_ifs;
- const liblas::Header& m_header;
+ HeaderPtr m_header;
PointPtr m_point;
Schema m_format;
diff -r b66b720d3abd -r 270605152ed9 include/liblas/laspoint.hpp
--- a/include/liblas/laspoint.hpp Wed Jul 28 10:40:31 2010 -0500
+++ b/include/liblas/laspoint.hpp Wed Jul 28 11:00:14 2010 -0500
@@ -47,6 +47,7 @@
#include <liblas/detail/utility.hpp>
#include <liblas/lasclassification.hpp>
#include <liblas/lascolor.hpp>
+#include <liblas/liblas.hpp>
// std
#include <stdexcept> // std::out_of_range
@@ -198,8 +199,8 @@
std::vector<liblas::uint8_t> const& GetData() const {return m_format_data; }
void SetData(std::vector<uint8_t> const& v) { m_format_data = v;}
- void SetHeader(const liblas::Header& header);
- const liblas::Header* GetHeader () { return m_hdr; }
+ void SetHeader(HeaderPtr header);
+ HeaderPtr GetHeaderPtr () { return m_hdr; }
private:
static std::size_t const coords_size = 3;
@@ -218,7 +219,7 @@
std::vector<uint8_t> m_extra_data;
std::vector<uint8_t> m_format_data;
- const liblas::Header* m_hdr;
+ HeaderPtr m_hdr;
void throw_out_of_range() const
{
@@ -376,9 +377,9 @@
return m_coords[n];
}
-inline void Point::SetHeader(const liblas::Header& header)
+inline void Point::SetHeader(HeaderPtr header)
{
- m_hdr = &header;
+ m_hdr = header;
}
} // namespace liblas
diff -r b66b720d3abd -r 270605152ed9 src/detail/reader/point.cpp
--- a/src/detail/reader/point.cpp Wed Jul 28 10:40:31 2010 -0500
+++ b/src/detail/reader/point.cpp Wed Jul 28 11:00:14 2010 -0500
@@ -54,8 +54,8 @@
}
-Point::Point(std::istream& ifs, const liblas::Header& header) :
- m_ifs(ifs), m_header(header), m_point(new liblas::Point()), m_format(header.GetSchema())
+Point::Point(std::istream& ifs, HeaderPtr header) :
+ m_ifs(ifs), m_header(header), m_point(new liblas::Point()), m_format(header->GetSchema())
{
setup();
}
@@ -105,7 +105,7 @@
fill(record);
// Reader::FillPoint(record, m_point, m_header);
- m_point->SetCoordinates(m_header, m_point->GetX(), m_point->GetY(), m_point->GetZ());
+ m_point->SetCoordinates(*m_header, m_point->GetX(), m_point->GetY(), m_point->GetZ());
if (m_format.HasTime())
{
@@ -142,7 +142,7 @@
if (m_format.GetBaseByteSize() != m_format.GetByteSize())
{
- std::size_t bytesleft = m_header.GetDataRecordLength() - bytesread;
+ std::size_t bytesleft = m_header->GetDataRecordLength() - bytesread;
std::vector<uint8_t> data;
data.resize(bytesleft);
diff -r b66b720d3abd -r 270605152ed9 src/detail/reader/reader.cpp
--- a/src/detail/reader/reader.cpp Wed Jul 28 10:40:31 2010 -0500
+++ b/src/detail/reader/reader.cpp Wed Jul 28 11:00:14 2010 -0500
@@ -86,7 +86,7 @@
// If we reset the reader, we're ready to start reading points, so
// we'll create a point reader at this point.
if (m_point_reader == 0) {
- m_point_reader = PointReaderPtr(new reader::Point(m_ifs, *(header.get())));
+ m_point_reader = PointReaderPtr(new reader::Point(m_ifs, header));
}
}
diff -r b66b720d3abd -r 270605152ed9 src/laspoint.cpp
--- a/src/laspoint.cpp Wed Jul 28 10:40:31 2010 -0500
+++ b/src/laspoint.cpp Wed Jul 28 11:00:14 2010 -0500
@@ -56,7 +56,7 @@
m_flags(0),
m_userData(0),
m_angleRank(0),
- m_hdr(0)
+ m_hdr(HeaderPtr())
{
std::memset(m_coords, 0, sizeof(m_coords));
m_extra_data.resize(0);
More information about the Liblas-commits
mailing list