Skip to content

Issue with load_and_construct and versioning. #216

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Devacor opened this issue Aug 3, 2015 · 10 comments
Closed

Issue with load_and_construct and versioning. #216

Devacor opened this issue Aug 3, 2015 · 10 comments
Milestone

Comments

@Devacor
Copy link

Devacor commented Aug 3, 2015

I wanted to switch my code to the versioned save/load/serialize methods, but was having trouble with the namespace included in the following causing issues with the macro:

CEREAL_CLASS_VERSION(MV::Scene::Node, 1);

Because my version of cereal was pretty old I decided to pull and get latest, and I am no longer having issues with the above line, I changed the signature of serialize and load_and_construct from this original state:

template
void serialize(Archive & a_archive)

template
static void load_and_construct(Archive & a_archive, cereal::construct &a_construct)

To this:

template
void serialize(Archive & a_archive, const uint32_t a_version)

template
static void load_and_construct(Archive & a_archive, cereal::construct &a_construct, const uint32_t a_version)

And am now getting the following error which seems to indicate the load_and_construct is no longer actually being detected due to the versioned function signature:

1>C:\git\external\cereal\include\cereal/access.hpp(300): error C2512: 'MV::Scene::Node::Node': no appropriate default constructor available (compiling source file Source\DiggerGame\diggerGame.cpp)
1>  C:\git\external\cereal\include\cereal/details/traits.hpp(1209): note: see reference to function template instantiation 'T *cereal::access::construct<TT>(void)' being compiled
1>          with
1>          [
1>              T=MV::Scene::Node,
1>              TT=MV::Scene::Node
1>          ] (compiling source file Source\DiggerGame\diggerGame.cpp)
1>  C:\git\external\cereal\include\cereal/details/traits.hpp(1290): note: see reference to class template instantiation 'cereal::traits::is_default_constructible<T>' being compiled
1>          with
1>          [
1>              T=MV::Scene::Node
1>          ] (compiling source file Source\DiggerGame\diggerGame.cpp)
1>  C:\git\external\cereal\include\cereal/types/memory.hpp(307): note: see reference to class template instantiation 'cereal::detail::Construct<T,Archive,false,false>' being compiled
1>          with
1>          [
1>              T=MV::Scene::Node,
1>              Archive=cereal::JSONInputArchive
1>          ] (compiling source file Source\DiggerGame\diggerGame.cpp)
1>  C:\git\external\cereal\include\cereal/cereal.hpp(854): note: see reference to function template instantiation 'void cereal::load<AA,MV::Scene::Node>(Archive &,cereal::memory_detail::PtrWrapper<std::shared_ptr<MV::Scene::Node> &> &)' being compiled
1>          with
1>          [
1>              AA=cereal::JSONInputArchive,
1>              Archive=cereal::JSONInputArchive
1>          ] (compiling source file Source\DiggerGame\diggerGame.cpp)
1>  C:\git\external\cereal\include\cereal/cereal.hpp(777): note: see reference to function template instantiation 'ArchiveType &cereal::InputArchive<ArchiveType,0>::processImpl<cereal::memory_detail::PtrWrapper<std::shared_ptr<MV::Scene::Node> &>,0>(T &)' being compiled
1>          with
1>          [
1>              ArchiveType=cereal::JSONInputArchive,
1>              T=cereal::memory_detail::PtrWrapper<std::shared_ptr<MV::Scene::Node> &>
1>          ] (compiling source file Source\DiggerGame\diggerGame.cpp)
1>  C:\git\external\cereal\include\cereal/cereal.hpp(777): note: see reference to function template instantiation 'ArchiveType &cereal::InputArchive<ArchiveType,0>::processImpl<cereal::memory_detail::PtrWrapper<std::shared_ptr<MV::Scene::Node> &>,0>(T &)' being compiled
1>          with
1>          [
1>              ArchiveType=cereal::JSONInputArchive,
1>              T=cereal::memory_detail::PtrWrapper<std::shared_ptr<MV::Scene::Node> &>
1>          ] (compiling source file Source\DiggerGame\diggerGame.cpp)
1>  C:\git\external\cereal\include\cereal/cereal.hpp(680): note: see reference to function template instantiation 'void cereal::InputArchive<cereal::JSONInputArchive,0>::process<cereal::memory_detail::PtrWrapper<std::shared_ptr<MV::Scene::Node> &>&>(T)' being compiled
1>          with
1>          [
1>              T=cereal::memory_detail::PtrWrapper<std::shared_ptr<MV::Scene::Node> &> &
1>          ] (compiling source file Source\DiggerGame\diggerGame.cpp)
1>  C:\git\external\cereal\include\cereal/cereal.hpp(680): note: see reference to function template instantiation 'void cereal::InputArchive<cereal::JSONInputArchive,0>::process<cereal::memory_detail::PtrWrapper<std::shared_ptr<MV::Scene::Node> &>&>(T)' being compiled
1>          with
1>          [
1>              T=cereal::memory_detail::PtrWrapper<std::shared_ptr<MV::Scene::Node> &> &
1>          ] (compiling source file Source\DiggerGame\diggerGame.cpp)
1>  C:\git\external\cereal\include\cereal/archives/json.hpp(858): note: see reference to function template instantiation 'ArchiveType &cereal::InputArchive<ArchiveType,0>::operator ()<cereal::memory_detail::PtrWrapper<std::shared_ptr<MV::Scene::Node> &>&>(cereal::memory_detail::PtrWrapper<std::shared_ptr<MV::Scene::Node> &> &)' being compiled
1>          with
1>          [
1>              ArchiveType=cereal::JSONInputArchive
1>          ] (compiling source file Source\DiggerGame\diggerGame.cpp)
1>  C:\git\external\cereal\include\cereal/archives/json.hpp(858): note: see reference to function template instantiation 'ArchiveType &cereal::InputArchive<ArchiveType,0>::operator ()<cereal::memory_detail::PtrWrapper<std::shared_ptr<MV::Scene::Node> &>&>(cereal::memory_detail::PtrWrapper<std::shared_ptr<MV::Scene::Node> &> &)' being compiled
1>          with
1>          [
1>              ArchiveType=cereal::JSONInputArchive
1>          ] (compiling source file Source\DiggerGame\diggerGame.cpp)
1>  C:\git\external\cereal\include\cereal/cereal.hpp(854): note: see reference to function template instantiation 'void cereal::load<cereal::memory_detail::PtrWrapper<std::shared_ptr<MV::Scene::Node> &>>(cereal::JSONInputArchive &,cereal::NameValuePair<cereal::memory_detail::PtrWrapper<std::shared_ptr<MV::Scene::Node> &>> &)' being compiled (compiling source file Source\DiggerGame\diggerGame.cpp)
1>  C:\git\external\cereal\include\cereal/cereal.hpp(777): note: see reference to function template instantiation 'ArchiveType &cereal::InputArchive<ArchiveType,0>::processImpl<T,0>(T &)' being compiled
1>          with
1>          [
1>              ArchiveType=cereal::JSONInputArchive,
1>              T=cereal::NameValuePair<cereal::memory_detail::PtrWrapper<std::shared_ptr<MV::Scene::Node> &>>
1>          ] (compiling source file Source\DiggerGame\diggerGame.cpp)
1>  C:\git\external\cereal\include\cereal/cereal.hpp(777): note: see reference to function template instantiation 'ArchiveType &cereal::InputArchive<ArchiveType,0>::processImpl<T,0>(T &)' being compiled
1>          with
1>          [
1>              ArchiveType=cereal::JSONInputArchive,
1>              T=cereal::NameValuePair<cereal::memory_detail::PtrWrapper<std::shared_ptr<MV::Scene::Node> &>>
1>          ] (compiling source file Source\DiggerGame\diggerGame.cpp)
1>  C:\git\external\cereal\include\cereal/cereal.hpp(680): note: see reference to function template instantiation 'void cereal::InputArchive<cereal::JSONInputArchive,0>::process<_Ty>(T &&)' being compiled
1>          with
1>          [
1>              _Ty=cereal::NameValuePair<cereal::memory_detail::PtrWrapper<std::shared_ptr<MV::Scene::Node> &>>,
1>              T=cereal::NameValuePair<cereal::memory_detail::PtrWrapper<std::shared_ptr<MV::Scene::Node> &>>
1>          ] (compiling source file Source\DiggerGame\diggerGame.cpp)
1>  C:\git\external\cereal\include\cereal/cereal.hpp(680): note: see reference to function template instantiation 'void cereal::InputArchive<cereal::JSONInputArchive,0>::process<_Ty>(T &&)' being compiled
1>          with
1>          [
1>              _Ty=cereal::NameValuePair<cereal::memory_detail::PtrWrapper<std::shared_ptr<MV::Scene::Node> &>>,
1>              T=cereal::NameValuePair<cereal::memory_detail::PtrWrapper<std::shared_ptr<MV::Scene::Node> &>>
1>          ] (compiling source file Source\DiggerGame\diggerGame.cpp)
1>  C:\git\external\cereal\include\cereal/types/memory.hpp(189): note: see reference to function template instantiation 'ArchiveType &cereal::InputArchive<ArchiveType,0>::operator ()<cereal::NameValuePair<cereal::memory_detail::PtrWrapper<std::shared_ptr<MV::Scene::Node> &>>>(cereal::NameValuePair<cereal::memory_detail::PtrWrapper<std::shared_ptr<MV::Scene::Node> &>> &&)' being compiled
1>          with
1>          [
1>              ArchiveType=cereal::JSONInputArchive
1>          ] (compiling source file Source\DiggerGame\diggerGame.cpp)
1>  C:\git\external\cereal\include\cereal/types/memory.hpp(189): note: see reference to function template instantiation 'ArchiveType &cereal::InputArchive<ArchiveType,0>::operator ()<cereal::NameValuePair<cereal::memory_detail::PtrWrapper<std::shared_ptr<MV::Scene::Node> &>>>(cereal::NameValuePair<cereal::memory_detail::PtrWrapper<std::shared_ptr<MV::Scene::Node> &>> &&)' being compiled
1>          with
1>          [
1>              ArchiveType=cereal::JSONInputArchive
1>          ] (compiling source file Source\DiggerGame\diggerGame.cpp)
1>  C:\git\external\cereal\include\cereal/cereal.hpp(854): note: see reference to function template instantiation 'void cereal::load<AA,MV::Scene::Node>(Archive &,std::shared_ptr<MV::Scene::Node> &)' being compiled
1>          with
1>          [
1>              AA=cereal::JSONInputArchive,
1>              Archive=cereal::JSONInputArchive
1>          ] (compiling source file Source\DiggerGame\diggerGame.cpp)
1>  C:\git\external\cereal\include\cereal/cereal.hpp(777): note: see reference to function template instantiation 'ArchiveType &cereal::InputArchive<ArchiveType,0>::processImpl<std::shared_ptr<MV::Scene::Node>,0>(T &)' being compiled
1>          with
1>          [
1>              ArchiveType=cereal::JSONInputArchive,
1>              T=std::shared_ptr<MV::Scene::Node>
1>          ] (compiling source file Source\DiggerGame\diggerGame.cpp)
1>  C:\git\external\cereal\include\cereal/cereal.hpp(777): note: see reference to function template instantiation 'ArchiveType &cereal::InputArchive<ArchiveType,0>::processImpl<std::shared_ptr<MV::Scene::Node>,0>(T &)' being compiled
1>          with
1>          [
1>              ArchiveType=cereal::JSONInputArchive,
1>              T=std::shared_ptr<MV::Scene::Node>
1>          ] (compiling source file Source\DiggerGame\diggerGame.cpp)
1>  C:\git\external\cereal\include\cereal/cereal.hpp(680): note: see reference to function template instantiation 'void cereal::InputArchive<cereal::JSONInputArchive,0>::process<std::shared_ptr<MV::Scene::Node>&>(T)' being compiled
1>          with
1>          [
1>              T=std::shared_ptr<MV::Scene::Node> &
1>          ] (compiling source file Source\DiggerGame\diggerGame.cpp)
1>  C:\git\external\cereal\include\cereal/cereal.hpp(680): note: see reference to function template instantiation 'void cereal::InputArchive<cereal::JSONInputArchive,0>::process<std::shared_ptr<MV::Scene::Node>&>(T)' being compiled
1>          with
1>          [
1>              T=std::shared_ptr<MV::Scene::Node> &
1>          ] (compiling source file Source\DiggerGame\diggerGame.cpp)
1>  C:\git\external\cereal\include\cereal/archives/json.hpp(858): note: see reference to function template instantiation 'ArchiveType &cereal::InputArchive<ArchiveType,0>::operator ()<std::shared_ptr<MV::Scene::Node>&>(std::shared_ptr<MV::Scene::Node> &)' being compiled
1>          with
1>          [
1>              ArchiveType=cereal::JSONInputArchive
1>          ] (compiling source file Source\DiggerGame\diggerGame.cpp)
1>  C:\git\external\cereal\include\cereal/archives/json.hpp(858): note: see reference to function template instantiation 'ArchiveType &cereal::InputArchive<ArchiveType,0>::operator ()<std::shared_ptr<MV::Scene::Node>&>(std::shared_ptr<MV::Scene::Node> &)' being compiled
1>          with
1>          [
1>              ArchiveType=cereal::JSONInputArchive
1>          ] (compiling source file Source\DiggerGame\diggerGame.cpp)
1>  C:\git\external\cereal\include\cereal/cereal.hpp(854): note: see reference to function template instantiation 'void cereal::load<std::shared_ptr<MV::Scene::Node>&>(cereal::JSONInputArchive &,cereal::NameValuePair<std::shared_ptr<MV::Scene::Node> &> &)' being compiled (compiling source file Source\DiggerGame\diggerGame.cpp)
1>  C:\git\external\cereal\include\cereal/cereal.hpp(777): note: see reference to function template instantiation 'ArchiveType &cereal::InputArchive<ArchiveType,0>::processImpl<T,0>(T &)' being compiled
1>          with
1>          [
1>              ArchiveType=cereal::JSONInputArchive,
1>              T=cereal::NameValuePair<std::shared_ptr<MV::Scene::Node> &>
1>          ] (compiling source file Source\DiggerGame\diggerGame.cpp)
1>  C:\git\external\cereal\include\cereal/cereal.hpp(777): note: see reference to function template instantiation 'ArchiveType &cereal::InputArchive<ArchiveType,0>::processImpl<T,0>(T &)' being compiled
1>          with
1>          [
1>              ArchiveType=cereal::JSONInputArchive,
1>              T=cereal::NameValuePair<std::shared_ptr<MV::Scene::Node> &>
1>          ] (compiling source file Source\DiggerGame\diggerGame.cpp)
1>  C:\git\external\cereal\include\cereal/cereal.hpp(680): note: see reference to function template instantiation 'void cereal::InputArchive<cereal::JSONInputArchive,0>::process<_Ty>(T &&)' being compiled
1>          with
1>          [
1>              _Ty=cereal::NameValuePair<std::shared_ptr<MV::Scene::Node> &>,
1>              T=cereal::NameValuePair<std::shared_ptr<MV::Scene::Node> &>
1>          ] (compiling source file Source\DiggerGame\diggerGame.cpp)
1>  C:\git\external\cereal\include\cereal/cereal.hpp(680): note: see reference to function template instantiation 'void cereal::InputArchive<cereal::JSONInputArchive,0>::process<_Ty>(T &&)' being compiled
1>          with
1>          [
1>              _Ty=cereal::NameValuePair<std::shared_ptr<MV::Scene::Node> &>,
1>              T=cereal::NameValuePair<std::shared_ptr<MV::Scene::Node> &>
1>          ] (compiling source file Source\DiggerGame\diggerGame.cpp)
1>  Source\DiggerGame\diggerGame.cpp(50): note: see reference to function template instantiation 'ArchiveType &cereal::InputArchive<ArchiveType,0>::operator ()<cereal::NameValuePair<std::shared_ptr<MV::Scene::Node> &>>(cereal::NameValuePair<std::shared_ptr<MV::Scene::Node> &> &&)' being compiled
1>          with
1>          [
1>              ArchiveType=cereal::JSONInputArchive
1>          ]
1>  Source\DiggerGame\diggerGame.cpp(50): note: see reference to function template instantiation 'ArchiveType &cereal::InputArchive<ArchiveType,0>::operator ()<cereal::NameValuePair<std::shared_ptr<MV::Scene::Node> &>>(cereal::NameValuePair<std::shared_ptr<MV::Scene::Node> &> &&)' being compiled
1>          with
1>          [
1>              ArchiveType=cereal::JSONInputArchive
1>          ]
@AzothAmmo
Copy link
Contributor

It looks like I never wrote any load_and_construct support for versioned serialization, so there's your problem! Another item for the to-do list.

@Devacor
Copy link
Author

Devacor commented Nov 4, 2015

Would it be possible to prioritize this? I need to get this in to my save game before shipping (plenty of time). I would more immediately benefit from getting this in to my level editor. Current workaround is to load the old version, save the new version, then update my load method to accept the recently saved new version.

This works locally for now.

@AzothAmmo
Copy link
Contributor

I'll try and take a crack at it this weekend, I have been super busy lately so not much has happened with cereal in the last two months or so.

@Devacor
Copy link
Author

Devacor commented Nov 4, 2015

Thank you so much! I love cereal so much. Hands down my favorite library (chaiscript is fantastic too for similar ease of binding, but cereal is even nicer), this will help immensely.

@AzothAmmo AzothAmmo added this to the v1.2.0 milestone Nov 10, 2015
@AzothAmmo
Copy link
Contributor

Didn't have much time to work on this, I have essentially no free time until about mid way through December so it may get done before then but more likely this and everything else will happen throughout December.

@Devacor
Copy link
Author

Devacor commented Nov 11, 2015

No troubles! Have a great month and happy holidays. Looking forward to this, but I can wait. :)

@Devacor
Copy link
Author

Devacor commented Dec 29, 2015

Any news? I'm really excited about swapping to versioning but heavily rely on the load_and_construct methods.

@AzothAmmo
Copy link
Contributor

It is slated for 1.2 which I'm working on now.

AzothAmmo added a commit that referenced this issue Mar 30, 2016
AzothAmmo added a commit that referenced this issue Mar 30, 2016
@AzothAmmo
Copy link
Contributor

done done

@Devacor
Copy link
Author

Devacor commented Mar 30, 2016

This is huge thank you so much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants