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

Method execute

apps/pdal.cpp:319–409  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

317
318
319int App::execute(StringList& cmdArgs, LogPtr& log)
320{
321 ProgramArgs args;
322
323 addArgs(args);
324 try
325 {
326 args.parseSimple(cmdArgs);
327 }
328 catch (arg_val_error const& e)
329 {
330 Utils::printError(e.what());
331 return 1;
332 }
333
334 log = Log::makeLog("PDAL", m_log, m_logtiming);
335 if (m_logLevel != LogLevel::None)
336 log->setLevel(m_logLevel);
337 else if (m_debug)
338 log->setLevel(LogLevel::Debug);
339 log->get(LogLevel::Debug) << "Debugging..." << std::endl;
340 PluginManager<Stage>::setLog(log);
341 PluginManager<Kernel>::setLog(log);
342#ifndef _WIN32
343 if (m_debug)
344 {
345 signal(SIGSEGV, [](int sig)
346 {
347 logPtr->get(LogLevel::Debug) << "Segmentation fault (signal 11)\n";
348 StringList lines = Utils::backtrace();
349
350 for (const auto& l : lines)
351 logPtr->get(LogLevel::Debug) << l << std::endl;
352 exit(1);
353 });
354 }
355#endif
356
357 m_command = Utils::tolower(m_command);
358 if (!m_command.empty())
359 {
360 int ret = 0;
361 std::string name("kernels." + m_command);
362
363 Kernel *kernel = PluginManager<Kernel>::createObject(name);
364 if (kernel)
365 {
366 if (m_help)
367 cmdArgs.push_back("--help");
368 // This shouldn't throw. If it does, it's something awful, so
369 // not cleaning up seems inconsequential.
370 log->setLeader("pdal " + m_command);
371 ret = kernel->run(cmdArgs, log);
372 delete kernel;
373 // IMPORTANT - The kernel must be destroyed before GDAL
374 // drivers are unregistered or GDAL will attempt to destroy
375 // resources more than once, resulting in a crash.
376 gdal::unregisterDrivers();

Callers 15

mainFunction · 0.45
inspectMethod · 0.45
readLaszipMethod · 0.45
checkXYZFunction · 0.45
TESTFunction · 0.45
TESTFunction · 0.45
exec1Function · 0.45
exec2Function · 0.45
exec3Function · 0.45
exec4Function · 0.45
exec5Function · 0.45
exec6Function · 0.45

Calls 12

printErrorFunction · 0.85
setLogFunction · 0.85
tolowerFunction · 0.85
unregisterDriversFunction · 0.85
outputHelpFunction · 0.85
parseSimpleMethod · 0.80
addArgsFunction · 0.50
whatMethod · 0.45
getMethod · 0.45
emptyMethod · 0.45
runMethod · 0.45
sizeMethod · 0.45

Tested by 15

TESTFunction · 0.36
TESTFunction · 0.36
exec1Function · 0.36
exec2Function · 0.36
exec3Function · 0.36
exec4Function · 0.36
exec5Function · 0.36
exec6Function · 0.36
TESTFunction · 0.36
TESTFunction · 0.36
TESTFunction · 0.36
TESTFunction · 0.36