| 506 | } |
| 507 | |
| 508 | MetadataNode addOrUpdate(const std::string& lname, const double& value, |
| 509 | const std::string& descrip = std::string(), size_t precision = 10) |
| 510 | { |
| 511 | if (m_impl->nodeType(lname) == MetadataType::Array) |
| 512 | throw pdal_error("Can't call addOrUpdate() on subnode list."); |
| 513 | MetadataImplList& l = m_impl->subnodes(lname); |
| 514 | |
| 515 | if (l.empty()) |
| 516 | return add(lname, value, descrip, precision); |
| 517 | MetadataNodeImplPtr impl(new MetadataNodeImpl(lname)); |
| 518 | impl->setValue(value, precision); |
| 519 | l.front() = impl; |
| 520 | return MetadataNode(impl); |
| 521 | } |
| 522 | |
| 523 | template<typename T> |
| 524 | MetadataNode addOrUpdate(const std::string& lname, const T& value) |