GlueGen v2.6.0-rc-20250712
GlueGen, Native Binding Generator for Java™ (public API).
com.jogamp.common.util.Ringbuffer< T > Interface Template Reference

Ring buffer interface, a.k.a circular buffer. More...

Inheritance diagram for com.jogamp.common.util.Ringbuffer< T >:
Collaboration diagram for com.jogamp.common.util.Ringbuffer< T >:

Public Member Functions

String toString ()
 Returns a short string representation incl. More...
 
void dump (PrintStream stream, String prefix)
 Debug functionality - Dumps the contents of the internal array. More...
 
int capacity ()
 Returns the net capacity of this ring buffer. More...
 
void clear ()
 Resets the read and write position according to an empty ring buffer and set all ring buffer slots to null. More...
 
void resetFull (T[] copyFrom) throws IllegalArgumentException
 Resets the read and write position according to a full ring buffer and fill all slots w/ elements of array copyFrom. More...
 
int size ()
 Returns the number of elements in this ring buffer. More...
 
int getFreeSlots ()
 Returns the number of free slots available to put. More...
 
boolean isEmpty ()
 Returns true if this ring buffer is empty, otherwise false. More...
 
boolean isFull ()
 Returns true if this ring buffer is full, otherwise false. More...
 
get ()
 Dequeues the oldest enqueued element if available, otherwise null. More...
 
getBlocking () throws InterruptedException
 Dequeues the oldest enqueued element. More...
 
peek ()
 Peeks the next element at the read position w/o modifying pointer, nor blocking. More...
 
peekBlocking () throws InterruptedException
 Peeks the next element at the read position w/o modifying pointer, but w/ blocking. More...
 
boolean put (T e)
 Enqueues the given element. More...
 
void putBlocking (T e) throws InterruptedException
 Enqueues the given element. More...
 
boolean putSame (boolean blocking) throws InterruptedException
 Enqueues the same element at it's write position, if not full. More...
 
void waitForFreeSlots (int count) throws InterruptedException
 Blocks until at least count free slots become available. More...
 
void growEmptyBuffer (T[] newElements) throws IllegalStateException, IllegalArgumentException
 Grows an empty ring buffer, increasing it's capacity about the amount. More...
 
void growFullBuffer (int amount) throws IllegalStateException, IllegalArgumentException
 Grows a full ring buffer, increasing it's capacity about the amount. More...
 

Detailed Description

Ring buffer interface, a.k.a circular buffer.

Caller can chose whether to block until get / put is able to proceed or not.

Caller can chose whether to pass an empty array and clear references at get, or using a preset array for circular access of same objects.

Synchronization and hence thread safety details belong to the implementation.

Definition at line 45 of file Ringbuffer.java.

Member Function Documentation

◆ capacity()

int com.jogamp.common.util.Ringbuffer< T >.capacity ( )

Returns the net capacity of this ring buffer.

Implemented in com.jogamp.common.util.LFRingbuffer< T >, and com.jogamp.common.util.SyncedRingbuffer< T >.

◆ clear()

void com.jogamp.common.util.Ringbuffer< T >.clear ( )

Resets the read and write position according to an empty ring buffer and set all ring buffer slots to null.

isEmpty() will return true after calling this method.

Implemented in com.jogamp.common.util.LFRingbuffer< T >, and com.jogamp.common.util.SyncedRingbuffer< T >.

Here is the caller graph for this function:

◆ dump()

void com.jogamp.common.util.Ringbuffer< T >.dump ( PrintStream  stream,
String  prefix 
)

Debug functionality - Dumps the contents of the internal array.

Implemented in com.jogamp.common.util.LFRingbuffer< T >, and com.jogamp.common.util.SyncedRingbuffer< T >.

Here is the caller graph for this function:

◆ get()

Dequeues the oldest enqueued element if available, otherwise null.

The returned ring buffer slot will be set to null to release the reference and move ownership to the caller.

Method is non blocking and returns immediately;.

Returns
the oldest put element if available, otherwise null.

Implemented in com.jogamp.common.util.LFRingbuffer< T >, and com.jogamp.common.util.SyncedRingbuffer< T >.

◆ getBlocking()

T com.jogamp.common.util.Ringbuffer< T >.getBlocking ( ) throws InterruptedException

Dequeues the oldest enqueued element.

The returned ring buffer slot will be set to null to release the reference and move ownership to the caller.

Methods blocks until an element becomes available via put.

Returns
the oldest put element
Exceptions
InterruptedException

Implemented in com.jogamp.common.util.LFRingbuffer< T >, and com.jogamp.common.util.SyncedRingbuffer< T >.

◆ getFreeSlots()

int com.jogamp.common.util.Ringbuffer< T >.getFreeSlots ( )

Returns the number of free slots available to put.


Implemented in com.jogamp.common.util.LFRingbuffer< T >, and com.jogamp.common.util.SyncedRingbuffer< T >.

◆ growEmptyBuffer()

void com.jogamp.common.util.Ringbuffer< T >.growEmptyBuffer ( T[]  newElements) throws IllegalStateException, IllegalArgumentException

Grows an empty ring buffer, increasing it's capacity about the amount.

Growing an empty ring buffer increases it's size about the amount, i.e. renders it not empty. The new elements are inserted at the read position, able to be read out via get() etc.

Parameters
newElementsarray of new full elements the empty buffer shall grow about.
Exceptions
IllegalStateExceptionif buffer is not empty
IllegalArgumentExceptionif newElements is null

Implemented in com.jogamp.common.util.LFRingbuffer< T >, and com.jogamp.common.util.SyncedRingbuffer< T >.

◆ growFullBuffer()

void com.jogamp.common.util.Ringbuffer< T >.growFullBuffer ( int  amount) throws IllegalStateException, IllegalArgumentException

Grows a full ring buffer, increasing it's capacity about the amount.

Growing a full ring buffer leaves the size intact, i.e. renders it not full. New null elements are inserted at the write position, able to be written to via put(Object) etc.

Parameters
amountthe amount of elements the buffer shall grow about
Exceptions
IllegalStateExceptionif buffer is not full
IllegalArgumentExceptionif amount is < 0

Implemented in com.jogamp.common.util.LFRingbuffer< T >, and com.jogamp.common.util.SyncedRingbuffer< T >.

◆ isEmpty()

boolean com.jogamp.common.util.Ringbuffer< T >.isEmpty ( )

Returns true if this ring buffer is empty, otherwise false.

Implemented in com.jogamp.common.util.LFRingbuffer< T >, and com.jogamp.common.util.SyncedRingbuffer< T >.

Here is the caller graph for this function:

◆ isFull()

boolean com.jogamp.common.util.Ringbuffer< T >.isFull ( )

Returns true if this ring buffer is full, otherwise false.

Implemented in com.jogamp.common.util.LFRingbuffer< T >, and com.jogamp.common.util.SyncedRingbuffer< T >.

Here is the caller graph for this function:

◆ peek()

Peeks the next element at the read position w/o modifying pointer, nor blocking.

Returns
null if empty, otherwise the element which would be read next.

Implemented in com.jogamp.common.util.LFRingbuffer< T >, and com.jogamp.common.util.SyncedRingbuffer< T >.

◆ peekBlocking()

T com.jogamp.common.util.Ringbuffer< T >.peekBlocking ( ) throws InterruptedException

Peeks the next element at the read position w/o modifying pointer, but w/ blocking.

Returns
null if empty, otherwise the element which would be read next.

Implemented in com.jogamp.common.util.LFRingbuffer< T >, and com.jogamp.common.util.SyncedRingbuffer< T >.

◆ put()

boolean com.jogamp.common.util.Ringbuffer< T >.put ( e)

Enqueues the given element.

Returns true if successful, otherwise false in case buffer is full.

Method is non blocking and returns immediately;.

Implemented in com.jogamp.common.util.LFRingbuffer< T >, and com.jogamp.common.util.SyncedRingbuffer< T >.

◆ putBlocking()

void com.jogamp.common.util.Ringbuffer< T >.putBlocking ( e) throws InterruptedException

Enqueues the given element.

Method blocks until a free slot becomes available via get.

Exceptions
InterruptedException

Implemented in com.jogamp.common.util.LFRingbuffer< T >, and com.jogamp.common.util.SyncedRingbuffer< T >.

◆ putSame()

boolean com.jogamp.common.util.Ringbuffer< T >.putSame ( boolean  blocking) throws InterruptedException

Enqueues the same element at it's write position, if not full.

Returns true if successful, otherwise false in case buffer is full.

If blocking is true, method blocks until a free slot becomes available via get.

Parameters
blockingif true, wait until a free slot becomes available via get.
Exceptions
InterruptedException

Implemented in com.jogamp.common.util.LFRingbuffer< T >, and com.jogamp.common.util.SyncedRingbuffer< T >.

◆ resetFull()

void com.jogamp.common.util.Ringbuffer< T >.resetFull ( T[]  copyFrom) throws IllegalArgumentException

Resets the read and write position according to a full ring buffer and fill all slots w/ elements of array copyFrom.

Array's copyFrom elements will be copied into the internal array, hence it's length must be equal to capacity().

Parameters
copyFromMandatory array w/ length capacity() to be copied into the internal array.
Exceptions
IllegalArgumentExceptionif copyFrom is null.
IllegalArgumentExceptionif copyFrom's length is different from capacity().

Implemented in com.jogamp.common.util.LFRingbuffer< T >, and com.jogamp.common.util.SyncedRingbuffer< T >.

Here is the caller graph for this function:

◆ size()

Returns the number of elements in this ring buffer.

Implemented in com.jogamp.common.util.LFRingbuffer< T >, and com.jogamp.common.util.SyncedRingbuffer< T >.

Here is the caller graph for this function:

◆ toString()

String com.jogamp.common.util.Ringbuffer< T >.toString ( )

Returns a short string representation incl.

size/capacity and internal r/w index (impl. dependent).

Implemented in com.jogamp.common.util.LFRingbuffer< T >, and com.jogamp.common.util.SyncedRingbuffer< T >.

◆ waitForFreeSlots()

void com.jogamp.common.util.Ringbuffer< T >.waitForFreeSlots ( int  count) throws InterruptedException

Blocks until at least count free slots become available.

Exceptions
InterruptedException

Implemented in com.jogamp.common.util.LFRingbuffer< T >, and com.jogamp.common.util.SyncedRingbuffer< T >.


The documentation for this interface was generated from the following file: