/*!
 * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
 * Licensed under the MIT License.
 */
/**
 * An object which counts the number of users / references to it.
 * @remarks
 * This implements the [Reference counting](https://en.wikipedia.org/wiki/Reference_counting) pattern.
 * Getting the reference count correct is difficult in TypeScript and great care must be used.
 * Because of this, this interface should not be used in the public API.
 */
export interface ReferenceCounted {
    /**
     * Called to increase the reference count tracked by this object.
     * @remarks
     * When a user of this object allows something else to use it,
     * this should be called.
     */
    referenceAdded(): void;
    /**
     * Called to decrease the reference count tracked by this object.
     * @remarks
     * When a user of this object will no longer use it, this should be called.
     */
    referenceRemoved(): void;
    /**
     * @returns true if mutating this object may impact other users of it.
     *
     * Implementations can return true if the refcount is 1 OR the content is logically immutable.
     */
    isShared(): boolean;
}
/**
 * Base class to assist with implementing ReferenceCounted.
 */
export declare abstract class ReferenceCountedBase implements ReferenceCounted {
    private refCount;
    protected constructor(refCount?: number);
    referenceAdded(count?: number): void;
    referenceRemoved(count?: number): void;
    isShared(): boolean;
    isUnreferenced(): boolean;
    /**
     * Called when refcount reaches 0.
     */
    protected abstract onUnreferenced(): void;
}
//# sourceMappingURL=referenceCounting.d.ts.map