diff --git a/Modules/Core/Metadata/include/otbMetadataStorageInterface.h b/Modules/Core/Metadata/include/otbMetadataStorageInterface.h index 2206a65223ea81141ce63821f3b4925760c7a6f7..7153a11e6baec41b2bfb8b01dd819798a3be3871 100644 --- a/Modules/Core/Metadata/include/otbMetadataStorageInterface.h +++ b/Modules/Core/Metadata/include/otbMetadataStorageInterface.h @@ -59,6 +59,20 @@ public: { SetMetadataValue(path.c_str(), value.c_str(), band); } + + /** Parse a std::vector to a metadata value */ + template < typename T> void SetAsVector(const char *path, std::vector<T> value, const char sep=' ', int band=-1) + { + std::ostringstream oss; + oss << "["; + otb::Join(oss, value, std::string(&sep)); + oss << "]"; + SetMetadataValue(path, oss.str().c_str(), band); + } + template < typename T> void SetAsVector(const std::string& path, std::vector<T> value, const char sep=' ', int band=-1) + { + SetAsVector(path.c_str(), value, sep, band); + } };