Commented most of src/serialization/ going to read up more on variant's and finish off the job/add last touchs next

This commit is contained in:
jebes
2014-10-13 16:00:09 -04:00
parent 6f65ab1904
commit b032619a9c
5 changed files with 315 additions and 97 deletions

View File

@@ -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);
}
/*! 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();
};
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();
};
} // namespace serialization