Le 22 sept. 04, =E0 22:27, dkb a =E9crit :
> I currently have several arrays of doubles in an obj-c class that I=20=
> would like to access with F-Script. Most of the arrays have < 20=20
> elements but a couple have 500 elements in them. I've added a simple=20=
> method
> - (Float64)salary:(unsigned)index;
> to my class for one of the arrays which works but is this the best way=20=
> to do this?
Depends of your context. Another way is to have a method that return=20
directly your array of doubles.
- (double *)salaryArray;
You would then be able to call this methods from F-Script and access=20
your array's elements (see the documentation for the Pointer class in=20
the F-Script manual).
> Wouldn't there be a lot of overhead if I wanted to get the max=20
> salary contained in this array since I would have to build the array=20=
> within F-Script by repeatedly sending the salary message with every=20
> index value?
No. Your arrays are small. Unless you need to compute things with them=20=
billions of time by second, you should not have any trouble.
> Would it be better to convert all the C arrays to NSArrays for=20
> easier access by F-Script?
>
Probably. Because then you would be able to directly make use of the=20
F-Script array programming model.
Best,
Philippe Mougin
|