ftp.nice.ch/pub/next/connectivity/protocol/PPPMeter.v1.5.NIHS.bs.tar.gz#/PPPMeter.v1.5/Source/Autorelease.h

This is Autorelease.h in view mode; [Download] [Up]

#import <objc/Object.h>

/*
 * This file provides classes based on NEXTSTEP's traditional base class Object
 * with the autorelease features of OpenStep's NSObject.
 *
 * To make a class based on Object have autoreleasing do one of two things:
 *
 *      1) Make it a subclass of AutoreleaseObject and your done.
 * or
 *      2) Make it adhere to the Autorelease protocol and 
 *         be certain that -retainCount = 1 after your -init
 */


/*
 * Simple protocol to provide control of the objects reference count.
 */
@protocol Autorelease 
- incrementRetainCount;
- decrementRetainCount;
- (unsigned int) retainCount;
@end


/*
 * A base class that adheres to the above protocol.
 */
@interface AutoreleaseObject : Object <Autorelease>
{
   unsigned int retainCount;		     /* reference count */
}

- init;
- free;
@end

/*
 * A category that utilizes the protocol to provide autoreleasing.
 */
@interface Object (AutoreleaseCategory)
- autorelease;
- (void) release;
- retain;
- dealloc;
@end

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.