Package lepl :: Package support :: Module lib :: Class CircularFifo
[hide private]
[frames] | no frames]

Class CircularFifo

source code

A FIFO queue with a fixed maximum size that silently discards data on overflow. It supports iteration for reading current contents and so can be used for a "latest window".

Might be able to use deque instead? This may be more efficient if the entire contents are read often (as is the case when depth gets deeper)?

Instance Methods [hide private]
__init__(self, size)
Stores up to size entries.
source code
append(self, value)
This returns a value on overflow, otherwise None.
source code
pop(self, index=0)
Remove and return the next item.
source code
__len__(self) source code
__iter__(self) source code
Clear the data (we just set the size to zero - this doesn't release any references).
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, size)

source code 
Stores up to size entries. Once full, appending a further value will discard (and return) the oldest still present.
Overrides: object.__init__