Skip to content

Commit

Permalink
Merge pull request #448 from PDAL/noiter
Browse files Browse the repository at this point in the history
Remove iterators from pdal readers
  • Loading branch information
abellgithub committed Sep 10, 2014
2 parents 9fae916 + 417c10a commit 8aadfcb
Show file tree
Hide file tree
Showing 84 changed files with 1,629 additions and 4,212 deletions.
4 changes: 3 additions & 1 deletion include/pdal/Charbuf.hpp
Expand Up @@ -32,6 +32,8 @@
* OF SUCH DAMAGE.
****************************************************************************/

#pragma once

#include <streambuf>
#include <vector>

Expand Down Expand Up @@ -63,4 +65,4 @@ class Charbuf : public std::streambuf
pos_type m_bufOffset;
};

} //namespace
} //namespace pdal
15 changes: 13 additions & 2 deletions include/pdal/IStream.hpp
Expand Up @@ -54,13 +54,22 @@ class IStream
friend class IStreamMarker;

public:
IStream(const std::string& filename)
{ m_stream = m_fstream = new std::ifstream(filename); }
IStream() : m_stream(NULL), m_fstream(NULL)
{}
IStream(const std::string& filename) : m_stream(NULL), m_fstream(NULL)
{ open(filename); }
IStream(std::istream *stream) : m_stream(stream), m_fstream(NULL)
{}
~IStream()
{ delete m_fstream; }

int open(const std::string& filename)
{
if (m_stream)
return -1;
m_stream = m_fstream = new std::ifstream(filename);
return 0;
}
operator bool ()
{ return (bool)(*m_stream); }
void seek(std::streampos pos)
Expand Down Expand Up @@ -98,6 +107,8 @@ class IStream
class ILeStream : public IStream
{
public:
ILeStream() : IStream()
{}
ILeStream(const std::string& filename) : IStream(filename)
{}
ILeStream(std::istream *stream) : IStream(stream)
Expand Down
31 changes: 12 additions & 19 deletions include/pdal/Reader.hpp
Expand Up @@ -32,46 +32,39 @@
* OF SUCH DAMAGE.
****************************************************************************/

#ifndef INCLUDED_READER_HPP
#define INCLUDED_READER_HPP
#pragma once

#include <pdal/Stage.hpp>
#include <pdal/Options.hpp>
#include <pdal/StageIterator.hpp>

namespace pdal
{

//
// supported options:
// <uint32>id
// <bool>debug
// <uint32>verbose
//

class PDAL_DLL Reader : public Stage
{
public:
Reader()
{}
Reader(Options const& options) : Stage(options)
{};
virtual ~Reader()
{};
Reader(Options const& options) : Stage(options),
m_count(std::numeric_limits<point_count_t>::max())
{}

protected:
std::string m_filename;
point_count_t m_count;

private:
virtual PointBufferSet run(PointBufferPtr buffer)
{
PointBufferSet pbSet;

StageSequentialIterator *it = createSequentialIterator();
it->read(*buffer);
read(*buffer, m_count);
pbSet.insert(buffer);
return pbSet;
}
virtual void readerProcessOptions(const Options& options);
virtual point_count_t read(PointBuffer& buf, point_count_t num)
{ return 0; }
virtual boost::property_tree::ptree serializePipeline() const;
};

} // namespace pdal

#endif
66 changes: 0 additions & 66 deletions include/pdal/ReaderIterator.hpp

This file was deleted.

10 changes: 3 additions & 7 deletions include/pdal/Stage.hpp
Expand Up @@ -121,13 +121,7 @@ class PDAL_DLL Stage
static bool s_isEnabled() { return YES_OR_NO; } \
bool isEnabled() const { return YES_OR_NO; }

virtual StageSequentialIterator*
createSequentialIterator(PointBuffer&) const
{ return NULL; }
virtual StageSequentialIterator*
createSequentialIterator() const
{ std::cerr << "Created crap sequential iterator!\n"; return NULL; }
virtual StageRandomIterator* createRandomIterator(PointBuffer&) const
virtual StageSequentialIterator* createSequentialIterator() const
{ return NULL; }
inline MetadataNode getMetadata() const
{ return m_metadata; }
Expand All @@ -151,6 +145,8 @@ class PDAL_DLL Stage
void l_processOptions(const Options& options);
virtual void processOptions(const Options& /*options*/)
{}
virtual void readerProcessOptions(const Options& /*options*/)
{}
virtual void writerProcessOptions(const Options& /*options*/)
{}
void l_initialize(PointContext ctx);
Expand Down
196 changes: 0 additions & 196 deletions include/pdal/StageIterator.hpp

This file was deleted.

0 comments on commit 8aadfcb

Please sign in to comment.