[Biococoa-dev] BCSequenceRecord
Koen van der Drift
kvddrift at earthlink.net
Sat Jul 9 20:16:20 EDT 2005
On Jul 9, 2005, at 8:06 PM, Alexander Griekspoor wrote:
> About the implementation, even if we use single byte const chars, I
> still like the idea a lot of Charles to use NSMutableData as the
> internal datastore and provide an accessor to it. The NSData -bytes
> method casted to const char will give you direct access to the c
> array. Indeed the ivars can best be held read only as all editing
> should occur through class methods that also do the syncing of
> features/annotations. I would have absolutely no problem (certainly
> for performance reasons) to just have the accessor be - (NSData
> *)sequenceData; while internally it really is an NSMutableData. John
> uses to be very picky about this one, but it is fair I think that the
> user should respect that things only work for what we tell that we
> hand him, not what he really gets. I know that also Apple does this,
> their methods sometimes tell you you will get an NSArray, while in
> fact it is a NSMutableArray. But don't blame them if you start editing
> the array and things behave weird.
>
> Again the main reason for going for NSMutableData instead of directly
> using a char array is that we don't have to do the memory
> allocation/management. For instance from the NSMutableData documents:
>
>
> - (void)replaceBytesInRange:(NSRange)range withBytes:(const void
> *)replacementBytes length:(unsigned)replacementLength
> Replaces the range within the contents of the receiver with
> replacementBytes. If the length of range is not equal to
> replacementLength, the receiver is resized to accommodate the new
> bytes. Any bytes past range in the receiver are shifted to accommodate
> the new bytes.
>
> This is just fantastic instead of having to do all malloc and pointer
> shifting etc ourselves!
I like the NSData approach. So if we go for NSMutableData, we will have
mutable sequences, correct? Are we aso going to add immutable
sequences?
> Ps. Any clues on the spam stuff, I think none of my 5 messages have
> yet been posted to the list while you Koen for instance got the direct
> one immediately so it seems.
I saw 2 spam messages, and 3 messages from you Alex a few hours ago.
- Koen.
More information about the Biococoa-dev
mailing list