/*
    ObjectDistributingCategory.m
    ============================

    John Holdsworth
    Coldwave Programs Ltd.

    This software is in the public domain.

    A gratuitous Category of Object that distributes objects.

*/
/*
 * $Log: ObjectDistributingCategory.m,v $
 * Revision 1.1  1997/04/14  22:46:08  johnh
 * New category just for DO created.
 *
 */

#import "ObjectDistributingCategory.h"

#import <remote/NXConnection.h>
#import <stdio.h> // DO proxy...


@implementation Object(ObjectDistributingCategory)
/* simple class to distribute instances */

- runFromAppKitWithName:(const char *)aName;
/* Distributes appliaction objects for messaging from "reload" command line program. */
{
    NXConnection *conn = [NXConnection registerRoot:self withName:aName];

    if( !conn )
	fprintf( stdout, "Unable to register object with name \"%s\"\nIs another appliactoin runing using this name?\n\n",
		aName );
    else
	[conn runFromAppKit];

    return self;
}

- runFromAppKit;
/* runs from appkit using name of object - usually class name */
{
     const char *myName = [self name];

     return [self runFromAppKitWithName:myName];
}

@end
