home *** CD-ROM | disk | FTP | other *** search
- //
- // _MiscDistributorConnection.m -- A helper for MiscDistributor.
- //
- // Written by Don Yacktman. Copyright 1994 by Don Yacktman.
- // Version 1.0 All rights reserved.
- //
- // This notice may not be removed from this source code.
- //
- // This object is included in the MiscKit by permission from the author
- // and its use is governed by the MiscKit license, found in the file
- // "LICENSE.rtf" in the MiscKit distribution. Please refer to that file
- // for a list of all applicable permissions and restrictions.
- //
-
- #define INSUBPROJ
- #import "../_MiscDistributorConnection.h"
-
- #define CURRENT_VERSION 1
-
- @implementation _MiscDistributorConnection
-
- + initialize
- {
- // set up class version number and set up the waiting list and
- // distributors dictionary
- if (self == [_MiscDistributorConnection class]) {
- [_MiscDistributorConnection setVersion:CURRENT_VERSION];
- }
- return self;
- }
-
- - init
- {
- connectionName = NULL;
- direction = MiscInout;
- return self;
- }
-
- - free
- {
- if (connectionName) free(connectionName);
- return [super free];
- }
-
- - (const char *)connectionName { return connectionName; }
- - setConnectionName:(const char *)aString
- {
- if (connectionName) free(connectionName);
- if (aString)
- connectionName = NXCopyStringBufferFromZone(aString, [self zone]);
- return self;
- }
-
- - (MiscDCDirection)direction { return direction; }
- - setDirection:(MiscDCDirection)aDirection
- {
- direction = aDirection;
- return self;
- }
-
- - read:(NXTypedStream *)stream
- {
- int version, d;
-
- [super read:stream];
- version = NXTypedStreamClassVersion(stream,"MiscDistributor");
- if (version == CURRENT_VERSION) {
- NXReadTypes(stream, "*i", &connectionName, &d);
- direction = d;
- } else {
- connectionName = "UNTITLED";
- direction = 0;
- }
- return self;
- }
-
- - write:(NXTypedStream *)stream
- {
- int d = direction;
- [super write:stream];
- NXWriteTypes(stream, "*i", &connectionName, &d);
- return self;
- }
-
-
- @end
-