buf

package
v0.0.0-...-20810c9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 21, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Buffer

type Buffer[D any] struct {
	// contains filtered or unexported fields
}

func (*Buffer[D]) Add

func (b *Buffer[D]) Add(data ...D) int

func (*Buffer[D]) AddIndex

func (b *Buffer[D]) AddIndex(index ...int)

func (*Buffer[D]) AddIndexed

func (b *Buffer[D]) AddIndexed(data ...D)

func (*Buffer[D]) AddRelative

func (b *Buffer[D]) AddRelative(data []D, relative []int)

func (*Buffer[D]) Clear

func (b *Buffer[D]) Clear()

func (*Buffer[D]) CloneTo

func (b *Buffer[D]) CloneTo(target Buffer[D]) Buffer[D]

func (*Buffer[D]) Data

func (b *Buffer[D]) Data() []D

func (Buffer[D]) DataAt

func (b Buffer[D]) DataAt(index int) *D

func (Buffer[D]) DataCount

func (b Buffer[D]) DataCount() int

func (*Buffer[D]) DataSpan

func (b *Buffer[D]) DataSpan() DataSpan[D]

func (*Buffer[D]) DataSpanAt

func (b *Buffer[D]) DataSpanAt(start int) DataSpan[D]

func (Buffer[D]) Empty

func (b Buffer[D]) Empty() bool

func (Buffer[D]) GetBuffers

func (b Buffer[D]) GetBuffers() []Buffer[D]

func (*Buffer[D]) Index

func (b *Buffer[D]) Index() []int

func (Buffer[D]) IndexAt

func (b Buffer[D]) IndexAt(index int) int

func (Buffer[D]) IndexCount

func (b Buffer[D]) IndexCount() int

func (*Buffer[D]) IndexSpan

func (b *Buffer[D]) IndexSpan() IndexSpan[D]

func (*Buffer[D]) IndexSpanAt

func (b *Buffer[D]) IndexSpanAt(start int) IndexSpan[D]

func (*Buffer[D]) Init

func (b *Buffer[D]) Init(capacity int)

func (Buffer[D]) Remaining

func (b Buffer[D]) Remaining() int

func (*Buffer[D]) Reserve

func (b *Buffer[D]) Reserve(datas int, indices int)

func (*Buffer[D]) ReserveData

func (b *Buffer[D]) ReserveData(datas int)

func (*Buffer[D]) ReserveIndex

func (b *Buffer[D]) ReserveIndex(indices int)

func (*Buffer[D]) Reserved

func (b *Buffer[D]) Reserved(dataCount, indexCount int) (dataIndex int, data []D, index []int)

func (*Buffer[D]) ReservedNext

func (b *Buffer[D]) ReservedNext() *D

func (*Buffer[D]) ReservedNextIndex

func (b *Buffer[D]) ReservedNextIndex() *int

func (*Buffer[D]) Reset

func (vb *Buffer[D]) Reset(pos Position)

type BufferInit

type BufferInit[B any] func(buffer *B, capacity int)

type BufferReset

type BufferReset[B any] func(buffer *B, pos Position)

type Bufferable

type Bufferable[D any] interface {
	Empty() bool
	Remaining() int
	DataCount() int
	DataAt(index int) *D
	IndexCount() int
	IndexAt(index int) int
}

type Buffers

type Buffers[D any, B Bufferable[D]] struct {
	// contains filtered or unexported fields
}

func NewBuffers

func NewBuffers[D any, B Bufferable[D]](bufferCapacity int, buffers int, init BufferInit[B], reset BufferReset[B]) *Buffers[D, B]

func (*Buffers[D, B]) Add

func (b *Buffers[D, B]) Add() *B

func (*Buffers[D, B]) At

func (b *Buffers[D, B]) At(i int) *B

func (*Buffers[D, B]) Buffer

func (b *Buffers[D, B]) Buffer() *B

func (*Buffers[D, B]) BufferFor

func (b *Buffers[D, B]) BufferFor(count int) *B

func (*Buffers[D, B]) Capacity

func (b *Buffers[D, B]) Capacity() int

func (*Buffers[D, B]) Clear

func (b *Buffers[D, B]) Clear()

func (*Buffers[D, B]) Current

func (b *Buffers[D, B]) Current() int

func (*Buffers[D, B]) Empty

func (b *Buffers[D, B]) Empty() bool

func (*Buffers[D, B]) GetBuffers

func (b *Buffers[D, B]) GetBuffers() []B

func (*Buffers[D, B]) Len

func (b *Buffers[D, B]) Len() int

func (*Buffers[D, B]) Position

func (vbs *Buffers[D, B]) Position() Position

func (*Buffers[D, B]) Reserve

func (b *Buffers[D, B]) Reserve(buffers int)

func (*Buffers[D, B]) ReservedNext

func (b *Buffers[D, B]) ReservedNext() *B

func (*Buffers[D, B]) Reset

func (vbs *Buffers[D, B]) Reset(pos Position)

func (*Buffers[D, B]) SetCapacity

func (b *Buffers[D, B]) SetCapacity(capacity int)

type DataIterator

type DataIterator[D any, B Bufferable[D]] struct {
	// contains filtered or unexported fields
}

func NewDataIterator

func NewDataIterator[D any, B Bufferable[D]](iterable Iterable[D, B], beginning bool) DataIterator[D, B]

func (*DataIterator[D, B]) ClearLimit

func (i *DataIterator[D, B]) ClearLimit()

func (*DataIterator[D, B]) Current

func (i *DataIterator[D, B]) Current() *D

func (*DataIterator[D, B]) Flip

func (i *DataIterator[D, B]) Flip()

func (*DataIterator[D, B]) HasNext

func (i *DataIterator[D, B]) HasNext() bool

func (*DataIterator[D, B]) Limit

func (i *DataIterator[D, B]) Limit()

func (*DataIterator[D, B]) Next

func (i *DataIterator[D, B]) Next() *D

func (*DataIterator[D, B]) Reset

func (i *DataIterator[D, B]) Reset()

type DataSpan

type DataSpan[D any] struct {
	// contains filtered or unexported fields
}

A view into a buffer from when the span was created to the last data added to the buffer.

func NewDataSpan

func NewDataSpan[D any](buffer *Buffer[D], start int) DataSpan[D]

func (DataSpan[D]) At

func (s DataSpan[D]) At(i int) *D

func (DataSpan[D]) End

func (s DataSpan[D]) End() int

func (DataSpan[D]) Len

func (s DataSpan[D]) Len() int

func (DataSpan[D]) Start

func (s DataSpan[D]) Start() int

type HasBuffers

type HasBuffers[B any] interface {
	GetBuffers() []B
}

type IndexIterator

type IndexIterator[D any, B Bufferable[D]] struct {
	// contains filtered or unexported fields
}

func NewIndexIterator

func NewIndexIterator[D any, B Bufferable[D]](iterable Iterable[D, B], beginning bool) IndexIterator[D, B]

func (*IndexIterator[D, B]) ClearLimit

func (i *IndexIterator[D, B]) ClearLimit()

func (*IndexIterator[D, B]) Current

func (i *IndexIterator[D, B]) Current() int

func (*IndexIterator[D, B]) CurrentData

func (i *IndexIterator[D, B]) CurrentData() *D

func (*IndexIterator[D, B]) Flip

func (i *IndexIterator[D, B]) Flip()

func (*IndexIterator[D, B]) HasNext

func (i *IndexIterator[D, B]) HasNext() bool

func (*IndexIterator[D, B]) Limit

func (i *IndexIterator[D, B]) Limit()

func (*IndexIterator[D, B]) Next

func (i *IndexIterator[D, B]) Next() int

func (*IndexIterator[D, B]) NextData

func (i *IndexIterator[D, B]) NextData() *D

func (*IndexIterator[D, B]) Reset

func (i *IndexIterator[D, B]) Reset()

type IndexSpan

type IndexSpan[D any] struct {
	// contains filtered or unexported fields
}

A view into a buffer from when the span was created to the last index added to the buffer.

func NewIndexSpan

func NewIndexSpan[D any](buffer *Buffer[D], start int) IndexSpan[D]

func (IndexSpan[D]) At

func (s IndexSpan[D]) At(i int) *D

func (IndexSpan[D]) AtIndex

func (s IndexSpan[D]) AtIndex(i int) int

func (IndexSpan[D]) End

func (s IndexSpan[D]) End() int

func (IndexSpan[D]) Len

func (s IndexSpan[D]) Len() int

func (IndexSpan[D]) Start

func (s IndexSpan[D]) Start() int

type Iterable

type Iterable[D any, B Bufferable[D]] interface {
	Current() int
	Len() int
	At(index int) *B
}

type Position

type Position struct {
	// contains filtered or unexported fields
}

type Queue

type Queue[D any, B Bufferable[D]] struct {
	// contains filtered or unexported fields
}

func NewQueue

func NewQueue[D any, B Bufferable[D]](capacity int) *Queue[D, B]

func (*Queue[D, B]) Add

func (q *Queue[D, B]) Add(has HasBuffers[B])

func (*Queue[D, B]) At

func (q *Queue[D, B]) At(i int) *B

func (*Queue[D, B]) Clear

func (q *Queue[D, B]) Clear()

func (*Queue[D, B]) Current

func (q *Queue[D, B]) Current() int

func (*Queue[D, B]) GetBuffers

func (q *Queue[D, B]) GetBuffers() []B

func (*Queue[D, B]) Len

func (q *Queue[D, B]) Len() int

func (*Queue[D, B]) Position

func (q *Queue[D, B]) Position() Position

func (*Queue[D, B]) Reset

func (q *Queue[D, B]) Reset(pos Position)

func (*Queue[D, B]) ToBuffers

func (q *Queue[D, B]) ToBuffers() Buffers[D, B]

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL