rc-js-util
Version:
A collection of TS and C++ utilities to help writing performant and correct applications, achieved through strict typing and (removable) invariant checking.
196 lines (87 loc) • 2.12 kB
Markdown
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) > [rc-js-util](./rc-js-util.md) > [CircularBuffer](./rc-js-util.circularbuffer.md)
## CircularBuffer class
Presents an array as if it were circular, going past the end or start loops around.
**Signature:**
```typescript
export declare class CircularBuffer<TValue>
```
## Remarks
Supports negative indexes.
## Constructors
<table><thead><tr><th>
Constructor
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[(constructor)(values)](./rc-js-util.circularbuffer._constructor_.md)
</td><td>
`protected`
</td><td>
Constructs a new instance of the `CircularBuffer` class
</td></tr>
</tbody></table>
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[size](./rc-js-util.circularbuffer.size.md)
</td><td>
`readonly`
</td><td>
number
</td><td>
</td></tr>
</tbody></table>
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[clone()](./rc-js-util.circularbuffer.clone.md)
</td><td>
</td><td>
</td></tr>
<tr><td>
[createEmpty(size)](./rc-js-util.circularbuffer.createempty.md)
</td><td>
`static`
</td><td>
</td></tr>
<tr><td>
[createOne(initialValues)](./rc-js-util.circularbuffer.createone.md)
</td><td>
`static`
</td><td>
</td></tr>
<tr><td>
[getSetValue(index, value)](./rc-js-util.circularbuffer.getsetvalue.md)
</td><td>
</td><td>
returns the value stored at the index and sets the provided value
</td></tr>
<tr><td>
[getValue(index)](./rc-js-util.circularbuffer.getvalue.md)
</td><td>
</td><td>
</td></tr>
<tr><td>
[setValue(index, value)](./rc-js-util.circularbuffer.setvalue.md)
</td><td>
</td><td>
</td></tr>
</tbody></table>