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

Method extractStageOptions

pdal/Kernel.cpp:137–171  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

135
136
137StringList Kernel::extractStageOptions(const StringList& cmdArgs)
138{
139 StringList stringArgs;
140 OptionsMap& stageOptions = m_manager.stageOptions();
141
142 // Scan the argument vector for extra stage options. Pull them out and
143 // stick them in the list. Let the ProgramArgs handle everything else.
144 // NOTE: This depends on the format being "option=value" rather than
145 // "option value". This is what we've always expected, so no problem,
146 // but it would be better to be more flexible.
147 for (auto it = cmdArgs.begin(); it != cmdArgs.end(); ++it)
148 {
149 const std::string& cmd = *it;
150
151 std::string stageName, opName, value;
152 auto res = parseStageOption(cmd, stageName, opName, value);
153 if (res == ParseStageResult::Unknown)
154 stringArgs.push_back(cmd);
155 else if (res == ParseStageResult::Invalid)
156 throw pdal_error("Stage option '" + cmd + "' not valid.");
157 else // ParseStageResult::Ok
158 {
159 if (value.empty())
160 {
161 if (++it == cmdArgs.end())
162 throw pdal_error("Stage option '" + stageName + "." +
163 opName + "' has no value.");
164 value = *it;
165 }
166 Option op(opName, value);
167 stageOptions[stageName].add(op);
168 }
169 }
170 return stringArgs;
171}
172
173bool Kernel::doSwitches(const StringList& cmdArgs, ProgramArgs& args)
174{

Callers

nothing calls this directly

Calls 5

stageOptionsMethod · 0.80
beginMethod · 0.45
endMethod · 0.45
emptyMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected