Starting a JSON archive

This commit is contained in:
Randolph Voorhies
2013-06-12 20:37:36 -07:00
parent b1ef8f9ddb
commit 1b7d5387d2
5 changed files with 122 additions and 31 deletions

View File

@@ -54,7 +54,7 @@ namespace cereal
save(BinaryOutputArchive & ar, T const & t)
{
ar.save_binary(std::addressof(t), sizeof(t));
std::cout << "Saving POD size: " << sizeof(T) << " [" << t << "]" << std::endl;
//std::cout << "Saving POD size: " << sizeof(T) << " [" << t << "]" << std::endl;
}
//! Loading for POD types from binary
@@ -63,14 +63,14 @@ namespace cereal
load(BinaryInputArchive & ar, T & t)
{
ar.load_binary(std::addressof(t), sizeof(t));
std::cout << "Loading POD size: " << sizeof(T) << " [" << t << "]" << std::endl;
//std::cout << "Loading POD size: " << sizeof(T) << " [" << t << "]" << std::endl;
}
//! Saving for NVP types to binary
template<class T>
void save(BinaryOutputArchive & ar, NameValuePair<T> const & t)
{
std::cout << "Saving NVP: " << t.name << std::endl;
//std::cout << "Saving NVP: " << t.name << std::endl;
ar & t.value;
}
@@ -78,7 +78,7 @@ namespace cereal
template<class T>
void load(BinaryInputArchive & ar, NameValuePair<T> t)
{
std::cout << "Loading NVP... " << std::endl;
//std::cout << "Loading NVP... " << std::endl;
ar & t.value;
}
@@ -90,7 +90,7 @@ namespace cereal
ar & str.size();
ar.save_binary(str.data(), str.size() * sizeof(CharT));
std::cout << "Saving string: " << str << std::endl;
//std::cout << "Saving string: " << str << std::endl;
}
//! Serialization for basic_string types from binary
@@ -101,6 +101,6 @@ namespace cereal
ar & size;
str.resize(size);
ar.load_binary(const_cast<CharT*>(str.data()), size * sizeof(CharT));
std::cout << "Loading string: " << str << std::endl;
//std::cout << "Loading string: " << str << std::endl;
}
}