Commit 20302610 authored by Karl Wette's avatar Karl Wette

SWIG: rename some SWIG directives for improved clarity

- RETURNS_PROPERTY() -> OWNED_BY_1ST_ARG()
- ACQUIRES_OWNERSHIP() -> OWNS_THIS_ARG()
Original: 60b19e767782e5b717cb7f6842f80c7734cec365
parent 028b5974
......@@ -259,14 +259,14 @@ typedef struct tagREAL8Window {
#ifdef SWIG /* SWIG interface directives */
SWIGLAL(ACQUIRES_OWNERSHIP(REAL4Sequence*, sequence));
SWIGLAL(ACQUIRES_OWNERSHIP(REAL8Sequence*, sequence));
SWIGLAL(OWNS_THIS_ARG(REAL4Sequence*, sequence));
SWIGLAL(OWNS_THIS_ARG(REAL8Sequence*, sequence));
#endif
REAL4Window *XLALCreateREAL4WindowFromSequence(REAL4Sequence *sequence);
REAL8Window *XLALCreateREAL8WindowFromSequence(REAL8Sequence *sequence);
#ifdef SWIG /* SWIG interface directives */
SWIGLAL_CLEAR(ACQUIRES_OWNERSHIP(REAL4Sequence*, sequence));
SWIGLAL_CLEAR(ACQUIRES_OWNERSHIP(REAL8Sequence*, sequence));
SWIGLAL_CLEAR(OWNS_THIS_ARG(REAL4Sequence*, sequence));
SWIGLAL_CLEAR(OWNS_THIS_ARG(REAL8Sequence*, sequence));
#endif
REAL4Window *XLALCreateRectangularREAL4Window(UINT4 length);
......
......@@ -1826,20 +1826,20 @@ require:
#define %swiglal_public_clear_VARIABLE_ARGUMENT_LIST(FUNCTION, TYPE, ENDVALUE)
///
/// The <b>SWIGLAL(RETURNS_PROPERTY(...))</b> macro is used when a function returns an object whose
/// The <b>SWIGLAL(OWNED_BY_1ST_ARG(...))</b> macro is used when a function returns an object whose
/// memory is owned by the object supplied as the first argument to the function. Typically this
/// occurs when the function is returning some property of its first argument. The macro applies a
/// typemap which calles \c swiglal_store_parent() to store a reference to the first argument as the
/// \c parent of the return argument, so that the parent will not be destroyed as long as the return
/// value is in scope.
///
%define %swiglal_public_RETURNS_PROPERTY(TYPE, ...)
%swiglal_map_ab(%swiglal_apply, SWIGTYPE* SWIGLAL_RETURNS_PROPERTY, TYPE, __VA_ARGS__);
%define %swiglal_public_OWNED_BY_1ST_ARG(TYPE, ...)
%swiglal_map_ab(%swiglal_apply, SWIGTYPE* SWIGLAL_OWNED_BY_1ST_ARG, TYPE, __VA_ARGS__);
%enddef
%define %swiglal_public_clear_RETURNS_PROPERTY(TYPE, ...)
%define %swiglal_public_clear_OWNED_BY_1ST_ARG(TYPE, ...)
%swiglal_map_a(%swiglal_clear, TYPE, __VA_ARGS__);
%enddef
%typemap(out, noblock=1) SWIGTYPE* SWIGLAL_RETURNS_PROPERTY {
%typemap(out, noblock=1) SWIGTYPE* SWIGLAL_OWNED_BY_1ST_ARG {
%#ifndef swiglal_no_1starg
%swiglal_store_parent($1, 0, swiglal_1starg());
%#endif
......@@ -1847,14 +1847,14 @@ require:
}
///
/// The <b>SWIGLAL(ACQUIRES_OWNERSHIP(...))</b> macro indicates that a function will acquire
/// The <b>SWIGLAL(OWNS_THIS_ARG(...))</b> macro indicates that a function will acquire
/// ownership of a particular argument, e.g. by storing that argument in some container, and that
/// therefore the SWIG object wrapping that argument should no longer own its memory.
///
%define %swiglal_public_ACQUIRES_OWNERSHIP(TYPE, ...)
%define %swiglal_public_OWNS_THIS_ARG(TYPE, ...)
%swiglal_map_ab(%swiglal_apply, SWIGTYPE* DISOWN, TYPE, __VA_ARGS__);
%enddef
%define %swiglal_public_clear_ACQUIRES_OWNERSHIP(TYPE, ...)
%define %swiglal_public_clear_OWNS_THIS_ARG(TYPE, ...)
%swiglal_map_a(%swiglal_clear, TYPE, __VA_ARGS__);
%enddef
......@@ -1900,7 +1900,7 @@ typedef struct {} NAME;
/// adds a method <i>Base* cast2Base()</i> method to Derived. Obviously this should be a valid cast
/// for the given types! The SWIG-wrapped object returned by the <i>cast2...()</i> methods will
/// remain in scope as long as the struct that was cast from, by using a typemap similar to that of
/// the SWIGLAL(RETURNS_PROPERTY(...)) macro.
/// the SWIGLAL(OWNED_BY_1ST_ARG(...)) macro.
///
%typemap(out, noblock=1) SWIGTYPE* SWIGLAL_RETURNS_SELF {
%#ifndef swiglal_no_1starg
......
......@@ -48,7 +48,7 @@ size_t XLALGetGSequenceLength(LALGSequence* seq);
void XLALDestroyGSequenceIter(LALGSequenceIter* itr);
#ifdef SWIG // SWIG interface directives
SWIGLAL(RETURNS_PROPERTY(LALGSequenceIter*, XLALGSequenceBegin));
SWIGLAL(OWNED_BY_1ST_ARG(LALGSequenceIter*, XLALGSequenceBegin));
#endif
LALGSequenceIter* XLALGSequenceBegin(LALGSequence* seq);
bool XLALGSequenceNext(LALGSequenceIter* itr);
......@@ -57,15 +57,15 @@ GSequenceIter* XLALGSequenceBeginRaw(LALGSequence* seq, LALGType type);
#endif
#ifdef SWIG // SWIG interface directives
SWIGLAL(RETURNS_PROPERTY(SnglBurst*, XLALGetGSeqSnglBurst));
SWIGLAL(OWNED_BY_1ST_ARG(SnglBurst*, XLALGetGSeqSnglBurst));
#endif
SnglBurst* XLALGetGSeqSnglBurst(LALGSequenceIter* itr);
#ifdef SWIG // SWIG interface directives
SWIGLAL(ACQUIRES_OWNERSHIP(SnglBurst*, sb));
SWIGLAL(OWNS_THIS_ARG(SnglBurst*, sb));
#endif
LALGSequenceIter* XLALAddGSeqSnglBurst(LALGSequence* seq, SnglBurst* sb);
#ifdef SWIG // SWIG interface directives
SWIGLAL_CLEAR(ACQUIRES_OWNERSHIP(SnglBurst*, sb));
SWIGLAL_CLEAR(OWNS_THIS_ARG(SnglBurst*, sb));
#endif
LALGHashTable* XLALCreateGHashTable(LALGType type);
......
......@@ -36,11 +36,11 @@ LALGHashTable* XLALGetChannelList(LALGSequence *trig_sequence);
LALGSequence* XLALPopulateTrigSequenceFromFile(LALGSequence* trig_sequence, const char* fname, double min_snr, char* ignore_list);
#ifdef SWIG // SWIG interface directives
SWIGLAL(ACQUIRES_OWNERSHIP(SnglBurst*, tbl));
SWIGLAL(OWNS_THIS_ARG(SnglBurst*, tbl));
#endif
LALGSequence* XLALPopulateTrigSequenceFromTrigList(LALGSequence* trig_sequence, SnglBurst* tbl);
#ifdef SWIG // SWIG interface directives
SWIGLAL_CLEAR(ACQUIRES_OWNERSHIP(SnglBurst*, tbl));
SWIGLAL_CLEAR(OWNS_THIS_ARG(SnglBurst*, tbl));
#endif
#ifdef __cplusplus
......
......@@ -95,7 +95,7 @@ void XLALDestroySphHarmTimeSeries( SphHarmTimeSeries* ts );
UINT4 XLALSphHarmTimeSeriesGetMaxL( SphHarmTimeSeries* ts );
#ifdef SWIG // SWIG interface directives
SWIGLAL(RETURNS_PROPERTY(COMPLEX16TimeSeries*, XLALSphHarmTimeSeriesGetMode));
SWIGLAL(OWNED_BY_1ST_ARG(COMPLEX16TimeSeries*, XLALSphHarmTimeSeriesGetMode));
#endif
/*
......@@ -166,7 +166,7 @@ void XLALDestroySphHarmFrequencySeries( SphHarmFrequencySeries* ts );
UINT4 XLALSphHarmFrequencySeriesGetMaxL( SphHarmFrequencySeries* ts );
#ifdef SWIG // SWIG interface directives
SWIGLAL(RETURNS_PROPERTY(COMPLEX16FrequencySeries*, XLALSphHarmFrequencySeriesGetMode));
SWIGLAL(OWNED_BY_1ST_ARG(COMPLEX16FrequencySeries*, XLALSphHarmFrequencySeriesGetMode));
#endif
/*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment