aboutsummaryrefslogtreecommitdiff
path: root/src/serialization/binary_utils.h
diff options
context:
space:
mode:
authorjebes <psteidelprogramming@gmail.com>2014-10-13 16:00:09 -0400
committerjebes <psteidelprogramming@gmail.com>2014-10-13 16:00:09 -0400
commitb032619a9cb1850dcbb1381b1e77ca1d7c2a00a7 (patch)
tree5e13ac793a68ab974ff173b4d9892386f40267c2 /src/serialization/binary_utils.h
parentMerge pull request #175 (diff)
downloadmonero-b032619a9cb1850dcbb1381b1e77ca1d7c2a00a7.tar.xz
Commented most of src/serialization/ going to read up more on variant's and finish off the job/add last touchs next
Diffstat (limited to '')
-rw-r--r--src/serialization/binary_utils.h39
1 files changed, 21 insertions, 18 deletions
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 <class T>
+ bool parse_binary(const std::string &blob, T &v)
+ {
+ std::istringstream istr(blob);
+ binary_archive<false> iar(istr);
+ return ::serialization::serialize(iar, v);
+ }
-template <class T>
-bool parse_binary(const std::string &blob, T &v)
-{
- std::istringstream istr(blob);
- binary_archive<false> iar(istr);
- return ::serialization::serialize(iar, v);
-}
-
-template<class T>
-bool dump_binary(T& v, std::string& blob)
-{
- std::stringstream ostr;
- binary_archive<true> 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<class T>
+ bool dump_binary(T& v, std::string& blob)
+ {
+ std::stringstream ostr;
+ binary_archive<true> oar(ostr);
+ bool success = ::serialization::serialize(oar, v);
+ blob = ostr.str();
+ return success && ostr.good();
+ };
-} // namespace serialization
+}