axis-c-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adrian Dick <>
Subject Re: C-support and array implementation
Date Wed, 05 Apr 2006 07:43:39 GMT

The get() method was not specifically provided to support C-bindings,
though it may coincidentally do this.
This was added as the data member m_Array, which is the C-style data array,
was made hidden from the user, so they need now need to make use of the set
and get methods to work with this.

As you say, it simply returns the actual array (m_Array), so a copy will
need to be taken if the Axis_Array object is likely to be deleted before
you're finished working with the C-style array.
I had considered implementing the get() method to return a deep copy of the
array, which would remove this problem, I had also intended to return the
data as const.  But I found some users were already taking advantage of the
current design to modify the data.  I guess what we really need is to add
in some of the common array operators (eg: []).
Alternatively, we could modify the get() method to have an additional and
optional parameter to indicate a deep copy is wanted, with the current
behaviour being the default.

I hope this is of help.

Adrian Dick (

Nadir Amra <> wrote on 05/04/2006 00:14:35:

> Getting close to have Doc-Literal support for the C-bindings working but
> have a question: I want to confirm my assumption that the sole reason for

> the get() method in the Axis_Array class is in support of the C-bindings?

> The reason I ask is that I want to change the implementation so that it
> returns a new array that is malloc'ed instead of new'ed.  Currently it
> simply returns the actual array in the C++ object, but I do not think
> will work for the C bindings since the object will not be around, etc.
> Otherwise, I will have to just create a new method that does what I want.

> Please let me know the answer as soon as possible.
> Nadir K. Amra

View raw message