Skip to content

Commit

Permalink
Add utility toArchiveFile method
Browse files Browse the repository at this point in the history
  • Loading branch information
Levi-Armstrong committed Oct 15, 2024
1 parent f839085 commit 0b729bd
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tesseract_common/include/tesseract_common/serialization.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,18 @@ struct Serialization
return true;
}

template <typename SerializableType>
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<SerializableType>::value)
return toArchiveFileBinary<SerializableType>(archive_type, file_path, name);

return toArchiveFileXML<SerializableType>(archive_type, file_path, name);
}

template <typename SerializableType>
static std::vector<std::uint8_t> toArchiveBinaryData(const SerializableType& archive_type,
const std::string& name = "")
Expand Down

0 comments on commit 0b729bd

Please sign in to comment.