mirror of
https://github.com/USCiLab/cereal.git
synced 2025-10-18 01:45:52 +02:00
Starting a JSON archive
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user