mirror of
https://github.com/USCiLab/cereal.git
synced 2025-09-27 20:59:32 +02:00
update vs sandbox
This commit is contained in:
parent
1a963d06c3
commit
0626809bac
@ -1,3 +1,6 @@
|
||||
#include <base.hpp>
|
||||
#include <derived.hpp>
|
||||
|
||||
#include <cereal/access.hpp>
|
||||
#include <cereal/details/traits.hpp>
|
||||
#include <cereal/details/helpers.hpp>
|
||||
@ -40,10 +43,7 @@
|
||||
#include <type_traits>
|
||||
#include <functional>
|
||||
|
||||
#include <base.hpp>
|
||||
#include <derived.hpp>
|
||||
|
||||
CEREAL_FORCE_LINK_SHARED_LIBRARY(Sandbox)
|
||||
//CEREAL_FORCE_LINK_SHARED_LIBRARY(Sandbox)
|
||||
|
||||
struct Archive {};
|
||||
CEREAL_SETUP_ARCHIVE_TRAITS(Archive, Archive)
|
||||
@ -144,7 +144,7 @@ struct C
|
||||
char a;
|
||||
};
|
||||
|
||||
//CEREAL_REGISTER_TYPE(B);
|
||||
CEREAL_REGISTER_TYPE(B);
|
||||
|
||||
class MemberMinimal
|
||||
{
|
||||
@ -246,11 +246,33 @@ int main()
|
||||
VersionTest x{1};
|
||||
std::shared_ptr<Base> p = std::make_shared<Derived>();
|
||||
out(x);
|
||||
//out( p );
|
||||
out( p );
|
||||
|
||||
std::shared_ptr<A> ay = std::make_shared<B>();
|
||||
out(ay);
|
||||
}
|
||||
|
||||
std::cout << dllSS1.str() << std::endl;
|
||||
std::cout << "yo" << std::endl;
|
||||
|
||||
{
|
||||
VersionTest x;
|
||||
std::shared_ptr<Base> p;
|
||||
std::shared_ptr<A> ay;
|
||||
{
|
||||
cereal::XMLInputArchive in(dllSS1);
|
||||
in(x);
|
||||
in( p );
|
||||
in( ay );
|
||||
}
|
||||
{
|
||||
cereal::XMLOutputArchive out(dllSS2);
|
||||
out( x );
|
||||
out( p );
|
||||
out( ay );
|
||||
}
|
||||
}
|
||||
|
||||
std::cout << dllSS2.str() << std::endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,13 +1,15 @@
|
||||
#ifndef CEREAL_DLL_USE
|
||||
#define CEREAL_DLL_MAKE
|
||||
#endif
|
||||
#include "base.hpp"
|
||||
|
||||
CEREAL_CLASS_VERSION(VersionTest, 1)
|
||||
CEREAL_REGISTER_SHARED_LIBRARY(Sandbox)
|
||||
//CEREAL_REGISTER_SHARED_LIBRARY(Sandbox)
|
||||
template void Base::serialize<cereal::XMLOutputArchive>
|
||||
( cereal::XMLOutputArchive & ar, std::uint32_t const version );
|
||||
template void Base::serialize<cereal::XMLInputArchive>
|
||||
( cereal::XMLInputArchive & ar, std::uint32_t const version );
|
||||
|
||||
template <class Archive>
|
||||
void Base::serialize(Archive & ar, std::uint32_t const version)
|
||||
{
|
||||
}
|
||||
//template <class Archive>
|
||||
//void Base::serialize(Archive & ar, std::uint32_t const version)
|
||||
//{
|
||||
//}
|
@ -28,7 +28,7 @@ class Base
|
||||
friend class cereal::access;
|
||||
|
||||
template < class Archive >
|
||||
DECLSPECIFIER void serialize( Archive & ar, std::uint32_t const version );
|
||||
void serialize(Archive & ar, std::uint32_t const version) {}
|
||||
virtual ~Base() {}
|
||||
};
|
||||
|
||||
@ -36,4 +36,6 @@ extern template DECLSPECIFIER void Base::serialize<cereal::XMLInputArchive>
|
||||
( cereal::XMLInputArchive & ar, std::uint32_t const version );
|
||||
|
||||
extern template DECLSPECIFIER void Base::serialize<cereal::XMLOutputArchive>
|
||||
( cereal::XMLOutputArchive & ar, std::uint32_t const version );
|
||||
( cereal::XMLOutputArchive & ar, std::uint32_t const version );
|
||||
|
||||
CEREAL_CLASS_VERSION(VersionTest, 1)
|
@ -1,6 +1,10 @@
|
||||
#ifndef CEREAL_DLL_USE
|
||||
#define CEREAL_DLL_MAKE
|
||||
#endif
|
||||
#include "derived.hpp"
|
||||
|
||||
CEREAL_REGISTER_TYPE(Derived)
|
||||
//CEREAL_REGISTER_TYPE_DLL(Derived)
|
||||
//CEREAL_REGISTER_SHARED_LIBRARY(Sandbox)
|
||||
|
||||
template void Derived::serialize<cereal::XMLOutputArchive>
|
||||
( cereal::XMLOutputArchive & ar, std::uint32_t const version );
|
||||
@ -8,8 +12,9 @@ template void Derived::serialize<cereal::XMLOutputArchive>
|
||||
template void Derived::serialize<cereal::XMLInputArchive>
|
||||
( cereal::XMLInputArchive & ar, std::uint32_t const version );
|
||||
|
||||
template <class Archive>
|
||||
void Derived::serialize(Archive & ar, std::uint32_t const version)
|
||||
{
|
||||
ar(cereal::base_class<Base>(this));
|
||||
}
|
||||
//template <class Archive>
|
||||
//void Derived::serialize(Archive & ar, std::uint32_t const version)
|
||||
//{
|
||||
// std::cout << "Hello from " << __LINE__ << std::endl;
|
||||
// ar(cereal::base_class<Base>(this));
|
||||
//}
|
@ -5,9 +5,16 @@ class Derived : public Base
|
||||
private:
|
||||
friend class cereal::access;
|
||||
template <class Archive>
|
||||
void serialize(Archive & ar, std::uint32_t const version);
|
||||
void serialize(Archive & ar, std::uint32_t const version)
|
||||
{
|
||||
std::cout << "\nHello from " << __LINE__ << std::endl;
|
||||
::cereal::detail::StaticObject<cereal::detail::bind_to_archives<Derived>>::getInstance();
|
||||
ar(cereal::base_class<Base>(this));
|
||||
}
|
||||
};
|
||||
extern template DECLSPECIFIER void Derived::serialize<cereal::XMLOutputArchive>
|
||||
( cereal::XMLOutputArchive & ar, std::uint32_t const version );
|
||||
extern template DECLSPECIFIER void Derived::serialize<cereal::XMLInputArchive>
|
||||
( cereal::XMLInputArchive & ar, std::uint32_t const version );
|
||||
( cereal::XMLInputArchive & ar, std::uint32_t const version );
|
||||
|
||||
CEREAL_REGISTER_TYPE(Derived)
|
Loading…
x
Reference in New Issue
Block a user