CircBuf

Inheritance diagram of CircBuf
class CircBuf(leng)[source]

A circular buffer of Python values.

Examples:

>>> cb = CircBuf(3)
>>> cb.is_empty()
1
>>> cb.put('first')
>>> cb.is_empty()
0
>>> cb.put('second')
>>> cb.put('third')
>>> cb.is_full()
1
>>> cb.put('fourth')
>>> cb.get()
'second'
>>> cb.get()
'third'
>>> cb.get()
'fourth'
>>> cb.is_empty()
1

Import from taurus.core.util.containers as:

from taurus.core.util.containers import CircBuf
get()[source]

Retrieves an item from a non-empty circular buffer.

is_empty()[source]

Returns true only if CircBuf has no items.

is_full()[source]

Returns true only if CircBuf has no space.

put(item)[source]

Puts an item onto a circular buffer.