MCPcopy Create free account
hub / github.com/PDAL/PDAL / execute

Method execute

kernels/PipelineKernel.cpp:113–185  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

111
112
113int PipelineKernel::execute()
114{
115 if (!Utils::fileExists(m_inputFile))
116 throw pdal_error("file not found: " + m_inputFile);
117 if (m_progressFile.size())
118 {
119 m_progressFd = Utils::openProgress(m_progressFile);
120 m_manager.setProgressFd(m_progressFd);
121 }
122
123 if (m_validate)
124 {
125 NL::json root;
126 // Validate the options of the pipeline we were
127 // given, and once we succeed, we're done
128 try
129 {
130 m_manager.readPipeline(m_inputFile);
131 if (!m_manager.hasReader())
132 throw pdal_error("Pipeline does not start with a reader.");
133 m_manager.prepare();
134 root["valid"] = true;
135 root["error_detail"] = "";
136 root["streamable"] = m_manager.pipelineStreamable();
137 }
138 catch (pdal::pdal_error const& e)
139 {
140 root["valid"] = false;
141 root["error_detail"] = e.what();
142 root["streamable"] = false;
143 }
144 Utils::closeProgress(m_progressFd);
145 std::cout << root.dump(4) << "\n";
146 return 0;
147 }
148
149 m_manager.readPipeline(m_inputFile);
150 if (!m_manager.hasReader())
151 throw pdal_error("Pipeline does not start with a reader.");
152 m_manager.pointTable().layout()->setAllowedDims(m_dimNames);
153 if (m_manager.execute(m_mode).m_mode == ExecMode::None)
154 throw pdal_error("Couldn't run pipeline in requested execution mode.");
155
156 if (m_metadataFile.size())
157 {
158 std::ostream *out = Utils::createFile(m_metadataFile, false);
159 if (!out)
160 throw pdal_error("Can't open file '" + m_metadataFile +
161 "' for metadata output.");
162 Utils::toJSON(m_manager.getMetadata(), *out);
163 Utils::closeFile(out);
164 }
165 if (m_pipelineFile.size())
166 PipelineWriter::writePipeline(m_manager.getStage(), m_pipelineFile);
167
168 if (m_PointCloudSchemaOutput.size() > 0)
169 {
170#ifdef PDAL_HAVE_LIBXML2

Callers

nothing calls this directly

Calls 15

openProgressFunction · 0.85
closeProgressFunction · 0.85
toJSONFunction · 0.85
writePipelineFunction · 0.85
hasReaderMethod · 0.80
xmlMethod · 0.80
fileExistsFunction · 0.50
createFileFunction · 0.50
closeFileFunction · 0.50
sizeMethod · 0.45
readPipelineMethod · 0.45
prepareMethod · 0.45

Tested by

no test coverage detected