Tanoda
DelayBuffer.cs
Go to the documentation of this file.
1
/******************************************************************************
2
* Copyright (C) Ultraleap, Inc. 2011-2020. *
3
* *
4
* Use subject to the terms of the Apache License 2.0 available at *
5
* http://www.apache.org/licenses/LICENSE-2.0, or another agreement *
6
* between Ultraleap and you, your company or other organization. *
7
******************************************************************************/
8
9
namespace
Leap.Unity
{
10
11
public
class
DelayBuffer
<T> {
12
13
private
RingBuffer<T>
_buffer;
14
16
public
RingBuffer<T>
Buffer
{
get
{
return
_buffer; } }
17
18
public
int
Count
{
get
{
return
_buffer.Count; } }
19
20
public
bool
IsFull
{
get
{
return
_buffer.IsFull; } }
21
22
public
bool
IsEmpty
{
get
{
return
_buffer.IsEmpty; } }
23
24
public
int
Capacity
{
get
{
return
_buffer.Capacity; } }
25
26
public
void
Clear
() { _buffer.Clear(); }
27
28
public
DelayBuffer
(
int
bufferSize) {
29
_buffer =
new
RingBuffer<T>
(bufferSize);
30
}
31
34
public
bool
Add
(T t, out T delayedT) {
35
bool
willOutputValue;
36
if
(_buffer.IsFull) {
37
willOutputValue =
true
;
38
delayedT = _buffer.GetOldest();
39
}
40
else
{
41
willOutputValue =
false
;
42
delayedT =
default
(T);
43
}
44
_buffer.Add(t);
45
return
willOutputValue;
46
}
47
48
}
49
50
}
Leap.Unity.DelayBuffer
Definition:
DelayBuffer.cs:11
Leap.Unity.DelayBuffer.Clear
void Clear()
Definition:
DelayBuffer.cs:26
Leap.Unity.DelayBuffer.IsEmpty
bool IsEmpty
Definition:
DelayBuffer.cs:22
Leap.Unity.DelayBuffer.DelayBuffer
DelayBuffer(int bufferSize)
Definition:
DelayBuffer.cs:28
Leap.Unity.DelayBuffer.IsFull
bool IsFull
Definition:
DelayBuffer.cs:20
Leap.Unity.DelayBuffer.Buffer
RingBuffer< T > Buffer
Returns the underlying Buffer object.
Definition:
DelayBuffer.cs:16
Leap.Unity.DelayBuffer.Capacity
int Capacity
Definition:
DelayBuffer.cs:24
Leap.Unity.DelayBuffer.Count
int Count
Definition:
DelayBuffer.cs:18
Leap.Unity.DelayBuffer.Add
bool Add(T t, out T delayedT)
Returns true if the buffer was full and out "delayedT" will contain the oldest value in the buffer,...
Definition:
DelayBuffer.cs:34
Leap.Unity.RingBuffer
Definition:
RingBuffer.cs:14
Leap.Unity
Definition:
AssetFolderPropertyDrawer.cs:15
Source
Assets
Plugins
LeapMotion
Core
Scripts
DataStructures
DelayBuffer.cs
Generated by
1.9.3