Hello I am trying to enhance my enhance my Rcpp class with the functionality to be saved across R sessions. For convenience reasons I would like to do that in R, using the ReferenceClass's S4 member function 'finalize()'. My plan is to simply save all object's fields (vectors of various types) to a special list (with a special class name), remove the Rcpp object, and save the plain R object instead. Would that work/be a good option? In particular, what happens on the C++ side if I call rm(reference_object)? Would that remove the C++ side and free its memory? And how can the reverse be accomplished, that is, if an object (identified by its class name) is loaded from a previous session, rebuild the C++ side and form the original reference object?
Sort of finalising: <art> x = new( 'Rcpp_Myclass' ) x$finalize() calls: x_list = make_my_special_list( x ) rm( x ) and then the system calls: gc() </art> Sort of loading: <art> start_function_?() calls: x_lists = look_if_there_is_some_x_lists() for every x_list in x_lists: name = name_of(x_list) name = new( 'Rcpp_Myclass' ) name$assign_values_from_x_list() </art> Thank you for help. Bests Sören _______________________________________________ Rcpp-devel mailing list Rcpp-devel@lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel