richfitz / RcppR6

Code-generation wrapping C++ classes as R6 classes
Other
55 stars 6 forks source link

Serialisation #5

Open richfitz opened 10 years ago

richfitz commented 10 years ago

As with modules, this is hard to get right. See package XML, which has xmlSerializeHook and xmlDeserializeHook to help.

richfitz commented 10 years ago

For some types of objects storing a copy of the data in the RcppR6 object's R environment could help. Keeping things in sync is hard. But if we could do that it might be possible to store enough to rebuild the object and provide a hook to do that.

richfitz commented 10 years ago

At the least, it should be possible to facilitate load/save, even if we have to use the RApiSerialize interface to do this.

However, that doesn't deal with the case where an object is saved because it is itself a part of another object (e.g. in a list). In theory saveRDS's refhook should be able to help out here, but I don't see that it can be set to be triggered by object type.