Copy an object

ss_pers_copy is a function defined in sspers.c.

Synopsis:

ss_pers_t * ss_pers_copy(ss_pers_t *pers, ss_scope_t *scope, unsigned flags, ss_pers_t *buf, ss_prop_t *props)

Formal Arguments:

  • pers: The object to be copied.
  • scope: The destination scope that will own the new object.
  • flags: Creation flags like SS_ALLSAME (see ss_pers_new).
  • buf: Optional buffer for return value.
  • props: Additional properties (none defined yet)

Description: Copy the given object and return a link to it. If the object contains memory that needs to be copied (like character strings or variable length arrays) then those are copied also. Other objects to which the original pointed are not copied – the new object has links to the same ones.

Return Value: Returns a link to the new object on success; the null pointer on failure. If buf is supplied then that will be the successful return value, otherwise a persistent object link will be allocated.

Parallel Notes: Independent or collective. This function must be collective across the scope’s communicator (althrough communication-free) if the SS_ALLSAME bit is passed in the flags argument. In other words, if all tasks are participating to create one single new object then the call must be collecitve if we wish to avoid the synchronization costs later. However, it is still possible for all tasks to create one single object independently (i.e., creation order doesn’t matter) if they don’t pass SS_ALLSAME and they don’t mind paying the synchronization cost later.

See Also: