From 0b729bd6f5e638e130f99141ec69b55f179ac7cc Mon Sep 17 00:00:00 2001 From: Levi Armstrong Date: Tue, 15 Oct 2024 10:27:19 -0500 Subject: [PATCH] Add utility toArchiveFile method --- .../include/tesseract_common/serialization.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tesseract_common/include/tesseract_common/serialization.h b/tesseract_common/include/tesseract_common/serialization.h index bd954f86c6a..f62ea45c9c7 100644 --- a/tesseract_common/include/tesseract_common/serialization.h +++ b/tesseract_common/include/tesseract_common/serialization.h @@ -156,6 +156,18 @@ struct Serialization return true; } + template + static bool toArchiveFile(const SerializableType& archive_type, + const std::string& file_path, + const std::string& name = "") + { + fs::path fp(file_path); + if (fp.extension() == serialization::binary::extension::value) + return toArchiveFileBinary(archive_type, file_path, name); + + return toArchiveFileXML(archive_type, file_path, name); + } + template static std::vector toArchiveBinaryData(const SerializableType& archive_type, const std::string& name = "")