-
Notifications
You must be signed in to change notification settings - Fork 100
Serialize std::shared_ptr and std::weak_ptr #1352
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
base: devel
Are you sure you want to change the base?
Conversation
CLANG-FORMAT TEST - PASSED |
CMAKE-FORMAT TEST - PASSED |
Status Flag 'Pre-Test Inspection' - - This Pull Request Requires Inspection... The code must be inspected by a member of the Team before Testing/Merging |
f495b09
to
65030ea
Compare
CLANG-FORMAT TEST - PASSED |
CMAKE-FORMAT TEST - PASSED |
Status Flag 'Pre-Test Inspection' - - This Pull Request Requires Inspection... The code must be inspected by a member of the Team before Testing/Merging |
65030ea
to
18e518a
Compare
CLANG-FORMAT TEST - FAILED (on last commit): |
CMAKE-FORMAT TEST - PASSED |
Status Flag 'Pre-Test Inspection' - - This Pull Request Requires Inspection... The code must be inspected by a member of the Team before Testing/Merging |
18e518a
to
8d9f792
Compare
CMAKE-FORMAT TEST - PASSED |
Status Flag 'Pre-Test Inspection' - - This Pull Request Requires Inspection... The code must be inspected by a member of the Team before Testing/Merging |
CLANG-FORMAT TEST - FAILED (on last commit): |
CMAKE-FORMAT TEST - PASSED |
88b2765
to
769a1cf
Compare
CLANG-FORMAT TEST - FAILED (on last commit): |
CMAKE-FORMAT TEST - PASSED |
769a1cf
to
1f5b9af
Compare
CLANG-FORMAT TEST - PASSED |
CMAKE-FORMAT TEST - PASSED |
Status Flag 'Pre-Test Inspection' - - This Pull Request Requires Inspection... The code must be inspected by a member of the Team before Testing/Merging |
1f5b9af
to
9e0da66
Compare
CMAKE-FORMAT TEST - PASSED |
CLANG-FORMAT TEST - PASSED |
Status Flag 'Pre-Test Inspection' - - This Pull Request Requires Inspection... The code must be inspected by a member of the Team before Testing/Merging |
This PR provides an initial implementation of serialization of
std::shared_ptr
andstd::weak_ptr
.Unfinished work:
SST::Core::Serialization::shared_ptr()
andSST::Core::Serialization::weak_ptr()
wrapper functions, by adding an extradeleter
member to theshared_ptr_wrapper
class, and aDELETER
template parameter added.Implementation notes:
std::shared_ptr
andstd::weak_ptr
must both be handled, and astd::shared_ptr
does not necessarily return the pointer to the allocated memory when.get()
is called, since an aliasingstd::shared_ptr
can point to a sub-object of the owningstd::shared_ptr
.The owning
std::shared_ptr
must be determined with thestd::owner_less
functor and.owner_before()
methods.std::shared_ptr
andstd::weak_ptr
can be directly serialized if they point directly to the memory-managed object, butSST::Core::Serialization::shared_ptr()
andSST::Core::Serialization::weak_ptr()
wrapper functions must be used when thestd::shared_ptr
orstd::weak_ptr
may alias another object which manages the memory, in which case the owning object must be passed as well during serialization.std::shared_ptr
andstd::weak_ptr
to unbounded array types, such asstd::shared_ptr<int[]>
must also use helpers similar toSST::Core::Serialization::array()
to indicate asize
variable for the size of the array which is serialized/deserialized when thestd::shared_ptr
orstd::weak_ptr
is serialized.When a
std::shared_ptr
orstd::weak_ptr
is (de)serialized,std::map
/std::deque
are searched to find out if its owner has been seen before, and to (de)serialize the owning object the first time it is seen.