well, there's no array-types support..On 31 August 2012 15:03, Guy Hylton <guygantuan@gmail.com> wrote:
> I am looking for some NativeBoost advice on the best way of using a
> structure with an containing a char array like the following:
>
> int level
> int number
> char[256] msgText
> ulong elapsedTime
>
> Currently I am using an NBExternalAddress returned by NativeBoost>>allocate:
> because the external library holds onto the address and using byteAt: to see
> what is going on in the structure while I get used to the external library
> API.
>
> I can think of a couple of options, create my own NBExternalType subclass
> which I can use in an NBExternalStructure or subclass
> NBExternalAddress/Object with methods to extract the appropriate data, or
> have I missed the simple solution?
>
so, what you can do is to place dummy fields instead of array.. i.e.
int level
�int number
�char msgText1
�char msgText2
�...
�char msgText256
�ulong elapsedTime
which should do the trick.
(of course, not necessary to use chars, you can use ints, so it will
be only 64 dummies instead of 256 ;)
And of course a better way of doing that is to create a special
NBExternalType subclass , lets say NBExternalTypeArray
which takes a basic type and number of elements.
And it should answer correct #instanceSize and other related things,
as well as implement methods for pushing/storing and reading the
values of such type.
I will work on adding that in closest days.
It is not too hard to implement ;)
> Thanks, Guy
--
Best regards,
Igor Stasenko.