Inheritance diagram for OLReferenceCountedStream:
Public Member Functions
|Make a copy of this stream. |
|Free the stream's resources. |
Initializers and Deallocators
|Decrement the reference count. |
|Initialize the stream with a reference count of one. |
|The reference count of this stream. |
Due to the fact that it is not always possible or safe to copy stream instances, it is necessary, in order to maintain the desired usage model, to count references to streams and only release them when no one is watching anymore. This base class just maintains a simple reference count, incrementing it on init (OLReferenceCountedStream) and copy (OLReferenceCountedStream) and decrementing it on free (OLReferenceCountedStream), releasing the stream's resources when the reference count drops to zero.
|- (id) copy|
Make a copy of this stream.
The reference count is incremented and a refernce to this stream is returned.
|- (id) free|
Decrement the reference count.
If the reference count falls to zero, then the stream's freeStreamResources method will be called and the stream will be forever free.
|- (void) freeStreamResources|
Free the stream's resources.
This secondary freeing method is necessary to allow the reference count to be properly manipulated from within the normal free method.
Reimplemented in OLBufferingInStream, OLBufferingOutStream, OLBzlibInStream, OLBzlibOutStream, OLDataInStream, OLDataOutStream, OLFileInStream, OLFileOutStream, OLGzipInStream, OLGzipOutStream, OLLayeredInStream, OLLayeredOutStream, OLObjectInStream, OLObjectOutStream, OLZlibInStream, and OLZlibOutStream.
|- (id) init|
Initialize the stream with a reference count of one.
Reimplemented in OLDataOutStream.
|- (unsigned) referenceCount
The reference count of this stream.