I am trying to make a wrapper for our developers to use when doing unittests. Like expected, loaded of type "LoanedSample" is lost when going out of function context. What I would like to do is to use the get_dictionary-method, but I cannot get it to work. I have tried doing a deepcopy of the DynamicData-object(Does not work).
Is there a preffered way to get a snapshot of the data, when being a "LoanedSample"?
I forgot to add, this if for rti.connextdds python package. The solution for c/c++ is well documented.
See https://community.rti.com/forum-topic/python-sequence-memory-management
Also, in 7.1.0 the read/take APIs for DynamicData will change significantly and the regular read/take operations will return copies, not loans.
Thank you alexc for your response. It is good that this will be changed in subsequent versions. We will probably be on the current version for a while as an uplift operation in a big organisation is always a bit cumbersome. When I test your suggested solution, I still remain with the same problem though. Let's share some code:
I would like to get a dict or something similar out of the DynamicData, a deepcopy. Is this possible?