/* DataRecord.m:
 * You may freely copy, distribute, and reuse the code in this example.
 * NeXT disclaims any warranty of any kind, expressed or  implied, as to its
 * fitness for any particular use.
 *
 */

#import "DataRecord.h"

@implementation DataRecord

- init
{
    aString = NULL;
    anInt = 0;
    return self;
}

- free
{
    if(aString) free(aString);
    return [super free];
}

- setAString:(const char *)str
{
    if(aString) free(aString);
    aString = NXCopyStringBuffer(str);
    return self;
}

- (const char *)aString
{
    return aString;
}

- setAnInt:(int)number
{
    anInt = number;
    return self;
}

- (int)anInt;
{
    return anInt;
}

- write:(NXTypedStream *)stream
{
    [super write:stream];
    NXWriteTypes(stream,"*i", &aString, &anInt);
    return self;
}

- read:(NXTypedStream *)stream
{
    [super read:stream];
    NXReadTypes(stream,"*i", &aString, &anInt);
    return self;
}

@end


