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

Method doTRE

plugins/nitf/io/MetadataReader.cpp:319–360  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

317
318
319void MetadataReader::doTRE(const std::string& key,
320 ::nitf::TRE& tre)
321{
322 const std::string& tag = key + "." + tre.getTag();
323
324 // The C interface to nitro has a TREDescription object which
325 // (I think) allows you to enumerate the keys in the
326 // TRE. However, there is no C++ interface for it, so instead
327 // we will use the raw iterator to access each (Key,Value)
328 // pair. we won't use the Value from pair.second() directly,
329 // however: instead, we'll call getField(key) and get the
330 // value as represented by a Field object (which will tell us
331 // the formatting, etc).
332
333 ::nitf::TREFieldIterator iter = tre.begin();
334 while (iter != tre.end())
335 {
336 try
337 {
338 // nitro will explicitly throw when dereferencing iter
339 // if there's no pair object set (would be nice if
340 // there was a is_valid() function or something...)
341 ::nitf::Pair pair = *iter;
342
343 const char* key = pair.first();
344
345 // only put into metadata things that look like legit
346 // stringy things
347 if (strcmp(key, "raw_data") != 0)
348 {
349 ::nitf::Field field = tre.getField(key);
350 writeField(tag, key, field);
351 }
352 }
353 catch (::except::NullPointerReference&)
354 {
355 // oh, well - skip this one, go to the next iteration
356 }
357
358 ++iter;
359 }
360}
361
362
363void MetadataReader::doExtensions(const std::string& key,

Callers

nothing calls this directly

Calls 3

getFieldMethod · 0.80
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected