You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
class VectorWrapper {
int a;
std::vector<int> vec;
}
An outer class (which is registered with the memory manager, like a member of a sim_object or something that has been explicitly declared) that has an STL container of these objects:
class MyObject {
std::vector<VectorWrapper> vec_user_defined;
}
If MyObject is populated, it will be able to checkpoint and restore without throwing an error, and all the VectorWrapper objects will be present, but vec will not be restored (a will restore successfully). The contents of vec are never written out to the checkpoint file.
If MyObject instead has a vector of pointers to VectorWrapper, and each VectorWrapper is registered with the memory manager, vec will checkpoint and restore successfully.
class MyObject {
std::vector<VectorWrapper *> vec_user_defined_ptr;
}
The text was updated successfully, but these errors were encountered:
I think you may have found a limitation of the initial STL checkpoint capability. I think the STL checkpointing can only handle simple types, including pointers, or nested STL types, i.e. vector of vectors. The memory allocated to composite types like classes like the vector of VectorWrapper is not controlled by the memory manager and would have to be temporarily allocated/freed during checkpoint/restore operations. I think it can be done, but I don't think it's an easy thing.
A case where STL checkpointing will fail:
A user defined class with an STL in it:
An outer class (which is registered with the memory manager, like a member of a sim_object or something that has been explicitly declared) that has an STL container of these objects:
If MyObject is populated, it will be able to checkpoint and restore without throwing an error, and all the
VectorWrapper
objects will be present, butvec
will not be restored (a
will restore successfully). The contents ofvec
are never written out to the checkpoint file.If
MyObject
instead has a vector of pointers toVectorWrapper
, and eachVectorWrapper
is registered with the memory manager,vec
will checkpoint and restore successfully.The text was updated successfully, but these errors were encountered: