docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class CircularBuffer<T>

    Inheritance
    object
    CircularBuffer<T>
    Implements
    IReadOnlyList<T>
    IReadOnlyCollection<T>
    IEnumerable<T>
    IEnumerable
    IDisposable
    Inherited Members
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    Namespace: UnityEngine.VisualScripting
    Assembly: solution.dll
    Syntax
    [PublicAPI]
    public class CircularBuffer<T> : IReadOnlyList<T>, IReadOnlyCollection<T>, IEnumerable<T>, IEnumerable, IDisposable where T : IDisposable
    Type Parameters
    Name Description
    T

    Constructors

    Name Description
    CircularBuffer(int)
    CircularBuffer(int, T[])

    Initializes a new instance of the CircularBuffer<T> class.

    Properties

    Name Description
    Capacity

    Maximum capacity of the buffer. Elements pushed into the buffer after maximum capacity is reached (IsFull = true), will remove an element.

    Count

    Current buffer size (the number of elements that the buffer has).

    IsEmpty
    IsFull
    this[int]

    Gets the element at the specified index in the read-only list.

    Methods

    Name Description
    Back()

    Element at the back of the buffer - this[Size - 1].

    BinarySearch(T, IComparer<T>, out int)
    Dispose()

    Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

    Front()

    Element at the front of the buffer - this[0].

    GetEnumerator()

    Returns an enumerator that iterates through the collection.

    PopBack()

    Removes the element at the back of the buffer. Decreasing the Buffer size by 1.

    PopFront()

    Removes the element at the front of the buffer. Decreasing the Buffer size by 1.

    PushBack(T)

    Pushes a new element to the back of the buffer. Back()/this[Size-1] will now return this element.

    When the buffer is full, the element at Front()/this[0] will be popped to allow for this new element to fit.

    PushFront(T)

    Pushes a new element to the front of the buffer. Front()/this[0] will now return this element.

    When the buffer is full, the element at Back()/this[Size-1] will be popped to allow for this new element to fit.

    ToArray()

    Copies the buffer contents to an array, according to the logical contents of the buffer (i.e. independent of the internal order/contents)

    In This Article
    Back to top
    Copyright © 2024 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)