From b032619a9cb1850dcbb1381b1e77ca1d7c2a00a7 Mon Sep 17 00:00:00 2001 From: jebes Date: Mon, 13 Oct 2014 16:00:09 -0400 Subject: Commented most of src/serialization/ going to read up more on variant's and finish off the job/add last touchs next --- src/serialization/binary_utils.h | 39 +++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 18 deletions(-) (limited to 'src/serialization/binary_utils.h') diff --git a/src/serialization/binary_utils.h b/src/serialization/binary_utils.h index 3b1db3e48..f2cfadd4e 100644 --- a/src/serialization/binary_utils.h +++ b/src/serialization/binary_utils.h @@ -34,23 +34,26 @@ #include "binary_archive.h" namespace serialization { + /*! creates a new archive with the passed blob and serializes it into v + */ + template + bool parse_binary(const std::string &blob, T &v) + { + std::istringstream istr(blob); + binary_archive iar(istr); + return ::serialization::serialize(iar, v); + } -template -bool parse_binary(const std::string &blob, T &v) -{ - std::istringstream istr(blob); - binary_archive iar(istr); - return ::serialization::serialize(iar, v); -} - -template -bool dump_binary(T& v, std::string& blob) -{ - std::stringstream ostr; - binary_archive oar(ostr); - bool success = ::serialization::serialize(oar, v); - blob = ostr.str(); - return success && ostr.good(); -}; + /*! dumps the data in v into the blob string + */ + template + bool dump_binary(T& v, std::string& blob) + { + std::stringstream ostr; + binary_archive oar(ostr); + bool success = ::serialization::serialize(oar, v); + blob = ostr.str(); + return success && ostr.good(); + }; -} // namespace serialization +} -- cgit v1.2.3