PyFoam.Basics.RingBuffer module

A ring-buffer data structure

class PyFoam.Basics.RingBuffer.RingBuffer(nr=1000)[source]

Bases: object

A data structure that stores a number N of elements. The N+1-element overwrites the first and so on ....

__dict__ = mappingproxy({'dump': <function RingBuffer.dump>, '__dict__': <attribute '__dict__' of 'RingBuffer' objects>, '__init__': <function RingBuffer.__init__>, '__doc__': 'A data structure that stores a number N of elements. The\n N+1-element overwrites the first and so on ....', 'last': <function RingBuffer.last>, '__module__': 'PyFoam.Basics.RingBuffer', 'insert': <function RingBuffer.insert>, '__weakref__': <attribute '__weakref__' of 'RingBuffer' objects>})
__init__(nr=1000)[source]
Parameters:nr – Number of elements to store
__module__ = 'PyFoam.Basics.RingBuffer'
__weakref__

list of weak references to the object (if defined)

dump()[source]
Returns:A list with all the values in the ring buffer in the correct order

(starting with the oldest)

insert(dings)[source]

Inserts am element into the ring-buffer

last()[source]
Returns:the latest element in the buffer, None if

nothing was inserted into the buffer