Skip to content

Commit

Permalink
Add error message if your pipeline has more than one leaf node.
Browse files Browse the repository at this point in the history
  • Loading branch information
abellgithub committed Sep 13, 2021
1 parent 2a9b8c6 commit f469b0f
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pdal/PipelineManager.cpp
Expand Up @@ -118,6 +118,12 @@ void PipelineManager::setLog(const LogPtr& log)
}


LogPtr PipelineManager::log() const
{
return m_log;
}


Stage& PipelineManager::addReader(const std::string& type)
{
Stage *reader = m_factory->createStage(type);
Expand Down
1 change: 1 addition & 0 deletions pdal/PipelineManager.hpp
Expand Up @@ -121,6 +121,7 @@ class PDAL_DLL PipelineManager

// Set the log to be available to stages.
void setLog(const LogPtr& log);
LogPtr log() const;

QuickInfo preview() const;
void prepare() const;
Expand Down
14 changes: 14 additions & 0 deletions pdal/PipelineReaderJSON.cpp
Expand Up @@ -133,6 +133,20 @@ void PipelineReaderJSON::parsePipeline(NL::json& tree)
if (tag.size())
tags[tag] = s;
}

// Tell user if the pipeline seems wacky.
const std::vector<Stage *> llist = m_manager.leaves();
if (llist.size() > 1)
{
const LogPtr& log = m_manager.log();
log->get(LogLevel::Error) << "Pipeline has multiple leaf nodes.\n";
log->get(LogLevel::Error) << "Only the first of the following leaf nodes will be run.\n";
for (Stage *s : llist)
{
std::string name = s->tag().size() ? s->tag() : s->getName();
log->get(LogLevel::Error) << " " << name << "\n";
}
}
}


Expand Down

0 comments on commit f469b0f

Please sign in to comment.