// Class Test generated using getset 1.1
// Copyright 1994 by M. Onyschuk and Associates Inc.
// All Rights Reserved.

#import "Object.h"

@interface Test:Object
{
    char *aString1;
    char *aString2;
    int anInt;
    long aLongInt;
    float aFloat;
    double aDouble;
    id anId;
    id anotherId;
    double anotherDouble;
    id delegate;
}

- free;

- read:(NXTypedStream *)aStream;
- write:(NXTypedStream *)aStream;

- copyFromZone:(NXZone *)aZone;

- (const char *)aString1;
- setAString1:(const char *)aValue;

- (const char *)aString2;
- setAString2:(const char *)aValue;

- (int)anInt;
- setAnInt:(int)aValue;

- (long)aLongInt;
- setALongInt:(long)aValue;

- (float)aFloat;
- setAFloat:(float)aValue;

- (double)aDouble;
- setADouble:(double)aValue;

- anId;
- setAnId:aValue;

- anotherId;
- setAnotherId:aValue;

- (double)anotherDouble;
- setAnotherDouble:(double)aValue;

- delegate;
- setDelegate:aValue;

@end

#import "Test.h"
#import <objc/hashtable.h>

@implementation Test

- free
{
    NXZone *z = [self zone];

    if (aString1) {
        NXZoneFree(z, aString1);
        aString1 = NULL;
    }
    if (aString2) {
        NXZoneFree(z, aString2);
        aString2 = NULL;
    }
    if (anId) {
        anId = [anId free];
    }
    if (anotherId) {
        anotherId = [anotherId free];
    }
    if (delegate) {
        delegate = [delegate free];
    }

    return [super free];
}

- read:(NXTypedStream *)stream
{
    [super read:stream];

    NXReadType(stream, "*", &aString1);
    NXReadType(stream, "*", &aString2);
    NXReadType(stream, "i", &anInt);
    NXReadType(stream, "l", &aLongInt);
    NXReadType(stream, "f", &aFloat);
    NXReadType(stream, "d", &aDouble);
    anId = NXReadObject(stream);
    anotherId = NXReadObject(stream);
    NXReadType(stream, "d", &anotherDouble);
    delegate = NXReadObject(stream);

    return self;
}

- write:(NXTypedStream *)stream
{
    [super write:stream];

    NXWriteType(stream, "*", &aString1);
    NXWriteType(stream, "*", &aString2);
    NXWriteType(stream, "i", &anInt);
    NXWriteType(stream, "l", &aLongInt);
    NXWriteType(stream, "f", &aFloat);
    NXWriteType(stream, "d", &aDouble);
    NXWriteObject(stream, anId);
    NXWriteObject(stream, anotherId);
    NXWriteType(stream, "d", &anotherDouble);
    NXWriteObject(stream, delegate);

    return self;
}

- copyFromZone:(NXZone *)aZone
{
    Test *copy = [super copyFromZone:aZone];

    if (aString1) {
        copy->aString1 = NXCopyStringBufferFromZone(aString1, z);
    }
    if (aString2) {
        copy->aString2 = NXCopyStringBufferFromZone(aString2, z);
    }
    copy->anId = [anId copyFromZone:aZone];
    copy->anotherId = [anotherId copyFromZone:aZone];
    copy->delegate = [delegate copyFromZone:aZone];

    return copy;
}

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

- setAString1:(const char *)aValue
{
    NXZone *z = [self zone];
    if (aString1) {
        NXZoneFree(z, aString1);
    }
    aString1 = (aValue) ? NXCopyStringBufferFromZone(aValue, z) : NULL;
    return self;
}

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

- setAString2:(const char *)aValue
{
    NXZone *z = [self zone];
    if (aString2) {
        NXZoneFree(z, aString2);
    }
    aString2 = (aValue) ? NXCopyStringBufferFromZone(aValue, z) : NULL;
    return self;
}

- (int)anInt
{
    return anInt;
}

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

- (long)aLongInt
{
    return aLongInt;
}

- setALongInt:(long)aValue
{
    aLongInt = aValue;
    return self;
}

- (float)aFloat
{
    return aFloat;
}

- setAFloat:(float)aValue
{
    aFloat = aValue;
    return self;
}

- (double)aDouble
{
    return aDouble;
}

- setADouble:(double)aValue
{
    aDouble = aValue;
    return self;
}

- anId
{
    return anId;
}

- setAnId:aValue
{
    [anId free];
    anId = [aValue copyFromZone:[self zone]];
    return self;
}

- setAnIdNoCopy:aValue
{
    [anId free];
    anId = aValue;
    return self;
}

- anotherId
{
    return anotherId;
}

- setAnotherId:aValue
{
    [anotherId free];
    anotherId = [aValue copyFromZone:[self zone]];
    return self;
}

- setAnotherIdNoCopy:aValue
{
    [anotherId free];
    anotherId = aValue;
    return self;
}

- (double)anotherDouble
{
    return anotherDouble;
}

- setAnotherDouble:(double)aValue
{
    anotherDouble = aValue;
    return self;
}

- delegate
{
    return delegate;
}

- setDelegate:aValue
{
    [delegate free];
    delegate = [aValue copyFromZone:[self zone]];
    return self;
}

- setDelegateNoCopy:aValue
{
    [delegate free];
    delegate = aValue;
    return self;
}

@end

