Skip to content

Add functions to return SFTcatalog slices

Description

Summoning @karl-wette as the SWIG expert.

I'm interested in slightly modifying the behavior of two specific functions, namely XLALCheckCRCSFTCatalog and XLALSFTCatalogTimeslice.

In both cases, these functions do not return a value, but rather they store it in the first argument, which is supposed to be allocated but not populated.

I am aware of SWIG directives such as SWIGLAL(INOUT_STRUCTS(TYPE, ...)), but that seems to apply only to double pointers, rather than the situation I've got here.

In short, is there any specific SWIG directive to take a C function int F(OUTPUT_TYPE* output_val, ...) and convert it into a Python function def f(...) -> OUTPUT_TYPE?

If not, what would be the proper way of implementing such behavior?

Summary after resolving discussions:

  • Add function to return catalog slices so that SWIG can properly manage memory ownership.
  • Remove old function from SWIG as it cannot be actually used due to such memory ownership problem.

API Changes and Justification

Backwards Compatible Changes

  • This change does not modify any class/function/struct/type definitions in a public C header file or any Python class/function definitions
  • This change adds new classes/functions/structs/types to a public C header file or Python module

Backwards Incompatible Changes

  • This change modifies an existing class/function/struct/type definition in a public C header file or Python module
  • This change removes an existing class/function/struct/type from a public C header file or Python module

If any of the Backwards Incompatible check boxes are ticked please provide a justification why this change is necessary and why it needs to be done in a backwards incompatible way.

Review Status

Review pending. @karl-wette @david-keitel .

Edited by Rodrigo Tenorio

Merge request reports