Skip to content

Commit

Permalink
doc updates
Browse files Browse the repository at this point in the history
  • Loading branch information
hobu committed Nov 7, 2016
1 parent cef8e35 commit b3ecee9
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 20 deletions.
18 changes: 9 additions & 9 deletions python/pdal/PipelineExecutor.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
#include "PipelineExecutor.hpp"
#include <pdal/PDALUtils.hpp>

#ifdef PDAL_HAVE_LIBXML2
#include <pdal/XMLSchema.hpp>
#endif


namespace pdal
{

Expand All @@ -18,6 +13,7 @@ PipelineExecutor::PipelineExecutor(std::string const& json)
{
}


std::string PipelineExecutor::getPipeline() const
{
if (!m_executed)
Expand All @@ -28,6 +24,7 @@ std::string PipelineExecutor::getPipeline() const
return strm.str();
}


std::string PipelineExecutor::getMetadata() const
{
if (!m_executed)
Expand All @@ -39,6 +36,7 @@ std::string PipelineExecutor::getMetadata() const
return strm.str();
}


std::string PipelineExecutor::getSchema() const
{
if (!m_executed)
Expand All @@ -48,10 +46,6 @@ std::string PipelineExecutor::getSchema() const
MetadataNode root = m_manager.pointTable().toMetadata().clone("schema");
pdal::Utils::toJSON(root, strm);
return strm.str();
// #ifdef PDAL_HAVE_LIBXML2
// pdal::XMLSchema schema(m_manager.pointTable().layout());
// m_schema = schema.xml();
// #endif
}


Expand All @@ -67,6 +61,7 @@ int64_t PipelineExecutor::execute()
return count;
}


void PipelineExecutor::setLogStream(std::ostream& strm)
{

Expand All @@ -75,21 +70,26 @@ void PipelineExecutor::setLogStream(std::ostream& strm)
m_manager.setLog(log);

}


void PipelineExecutor::setLogLevel(int level)
{
m_logLevel = static_cast<pdal::LogLevel>(level);
setLogStream(m_logStream);
}


int PipelineExecutor::getLogLevel() const
{
return static_cast<int>(m_logLevel);
}


std::string PipelineExecutor::getLog() const
{
return m_logStream.str();
}


}} //namespace pdal::executor

68 changes: 63 additions & 5 deletions python/pdal/PipelineExecutor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,32 +9,90 @@ namespace pdal
namespace executor
{

/**
An executor hides the management of constructing, executing, and
fetching data from a PipelineManager.
It is constructed with JSON defining a pipeline.
*/

class PipelineExecutor {
public:

/**
Construct a PipelineExecutor
\param json Pipeline JSON defining the PDAL operations
*/
PipelineExecutor(std::string const& json);

/**
dtor
*/
~PipelineExecutor(){};

/**
Execute the pipeline
\return total number of points produced by the pipeline.
*/
int64_t execute();
bool executed() const { return m_executed; }

/**
\return the transliterated pipeline
*/
std::string getPipeline() const;

/**
\return computed metadata for the pipeline and all stages
*/
std::string getMetadata() const;

/**
\return computed schema for the pipeline
*/
std::string getSchema() const;

/**
\return log output for the executed pipeline. use
setLogLevel to adjust verbosity.
*/
std::string getLog() const;

/**
set the log verbosity. Use values 0-8.
*/
void setLogLevel(int level);

/**
\return log verbosity
*/
int getLogLevel() const;

PipelineManager const& getManagerConst() const { return m_manager; }
PipelineManager & getManager() { return m_manager; }
/**
\return has the pipeline been executed
*/
inline bool executed() const
{
return m_executed;
}


/**
\return a const reference to the pipeline manager
*/
PipelineManager const& getManagerConst() const { return m_manager; }

// std::vector<PArray> getArrays() const;
/**
\return a reference to the pipeline manager
*/
PipelineManager & getManager() { return m_manager; }

private:
void setLogStream(std::ostream& strm);

std::string m_json;
pdal::PipelineManager m_manager; // no progress reporting
pdal::PipelineManager m_manager;
bool m_executed;
std::stringstream m_logStream;
pdal::LogLevel m_logLevel;
Expand Down
9 changes: 3 additions & 6 deletions src/plang/Environment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,10 @@ Environment::Environment()
Py_Initialize();
} else
{

PyObject* imported = PyImport_AddModule("redirector");
if (!imported)
throw pdal_error("unable to add redirector module!");

PyImport_ImportModule("redirector");
m_redirector.init();
PyObject* added = PyImport_AddModule("redirector");
if (!added)
throw pdal_error("unable to add redirector module!");
}

initNumpy();
Expand Down

0 comments on commit b3ecee9

Please sign in to comment.