Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes
rtshell.simpkl_log.SimplePickleLog Class Reference

Simple pickle-based log object. More...

Inheritance diagram for rtshell.simpkl_log.SimplePickleLog:
Inheritance graph
[legend]

List of all members.

Public Member Functions

def __init__
def __str__
def read
def rewind
def seek
def write

Static Public Attributes

int BUFFER_SIZE = 256
int DATA = 2
int FP = 3
int INDEX = 0
int PREV = 4
int TS = 1

Private Member Functions

def _backup_one
def _close
def _eof
def _get_cur_pos
def _get_end
def _get_start
def _init_log
def _open
def _read
def _read_number
def _read_single_entry
def _read_to_timestamp
def _seek_to_index
def _seek_to_timestamp
def _set_eof_pos
def _set_start
def _update_cur_pos
def _write

Private Attributes

 _buf_start
 _cur_pos
 _end
 _file
 _fn
 _is_open
 _meta
 _mode
 _next
 _prev_pos
 _start
 _write_ind

Detailed Description

Simple pickle-based log object.

Its support for the full log interface is rudimentary and slow (although writing and simple reading should be fast enough).

The simple pickle-based format is as follows (each entry is serialised): Port specification (in the metadata block) [Data entries: (Index, Time stamp, Data)]

Definition at line 57 of file simpkl_log.py.


Constructor & Destructor Documentation

def rtshell.simpkl_log.SimplePickleLog.__init__ (   self,
  filename = '',
  args,
  kwargs 
)

Definition at line 67 of file simpkl_log.py.


Member Function Documentation

Reimplemented from rtshell.ilog.Log.

Definition at line 78 of file simpkl_log.py.

Reverses in the log one entry.

Definition at line 127 of file simpkl_log.py.

Reimplemented from rtshell.ilog.Log.

Definition at line 144 of file simpkl_log.py.

def rtshell.simpkl_log.SimplePickleLog._eof (   self) [private]

Reimplemented from rtshell.ilog.Log.

Definition at line 159 of file simpkl_log.py.

Get the current position in the log.

Should be implemented by implementation objects. Called by the
@ref position property.

Reimplemented from rtshell.ilog.Log.

Definition at line 162 of file simpkl_log.py.

Get the position of the last entry in the log.

Should be implemented by implementation objects. Called by the
@ref end property.

Reimplemented from rtshell.ilog.Log.

Definition at line 172 of file simpkl_log.py.

Get the position of the first entry in the log.

Should be implemented by implementation objects. Called by the
@ref start property.

Reimplemented from rtshell.ilog.Log.

Definition at line 166 of file simpkl_log.py.

Definition at line 176 of file simpkl_log.py.

def rtshell.simpkl_log.SimplePickleLog._open (   self) [private]

Reimplemented from rtshell.ilog.Log.

Definition at line 209 of file simpkl_log.py.

def rtshell.simpkl_log.SimplePickleLog._read (   self) [private]
Read a single entry from the log.

Definition at line 224 of file simpkl_log.py.

def rtshell.simpkl_log.SimplePickleLog._read_number (   self,
  number 
) [private]

Definition at line 235 of file simpkl_log.py.

Definition at line 299 of file simpkl_log.py.

def rtshell.simpkl_log.SimplePickleLog._read_to_timestamp (   self,
  timestamp 
) [private]

Definition at line 265 of file simpkl_log.py.

def rtshell.simpkl_log.SimplePickleLog._seek_to_index (   self,
  ind 
) [private]
Seeks forward or backward in the log to find the given index.

Definition at line 322 of file simpkl_log.py.

def rtshell.simpkl_log.SimplePickleLog._seek_to_timestamp (   self,
  ts 
) [private]
Seeks forward or backward in the log to find the given timestamp.

Definition at line 345 of file simpkl_log.py.

Sets the current position to the end-of-file value.

Definition at line 367 of file simpkl_log.py.

Definition at line 377 of file simpkl_log.py.

def rtshell.simpkl_log.SimplePickleLog._update_cur_pos (   self,
  val 
) [private]
Updates the current pos from a data entry.

Definition at line 394 of file simpkl_log.py.

def rtshell.simpkl_log.SimplePickleLog._write (   self,
  data 
) [private]
Pickle some data and write it to the file.

Definition at line 402 of file simpkl_log.py.

def rtshell.simpkl_log.SimplePickleLog.read (   self,
  timestamp = None,
  number = None 
)
Read entries from the log.

If a time limit is given, all entries until that time limit is
reached will be read.

If a number is given, that number of entries will be returned.
This option overrides the time limit option.

If EOF is hit before the requested entries are read, what was
read will be returned and @ref eof will return True.

If neither option is given, the next value will be returned.

Returns a list of tuples, [(index, timestamp, data), ...].

Reimplemented from rtshell.ilog.Log.

Definition at line 100 of file simpkl_log.py.

Rewind the log to the first entry.

Reimplemented from rtshell.ilog.Log.

Definition at line 108 of file simpkl_log.py.

def rtshell.simpkl_log.SimplePickleLog.seek (   self,
  timestamp = None,
  index = None 
)
Rewind or fast-forward the log.

If the timestamp or index is earlier than the current position, the log
will be rewound. If it is later, the log will be fast-forwarded.

When the log is rewound, it will go back to the first entry before
the given timestamp or index. If an entry exactly matches the given
timestamp or index, the log position will be at that entry, meaning
that the next value read will be that entry.

When a log is fast-forwarded, it will go to the first entry after the
given timestamp or index. If an entry exactly matches the given
timestamp or index, the log position will be at that entry, meaning
that the next value read will be that entry.

Reimplemented from rtshell.ilog.Log.

Definition at line 118 of file simpkl_log.py.

def rtshell.simpkl_log.SimplePickleLog.write (   self,
  timestamp,
  data 
)
Writes an entry to the log.

The timestamp is necessary to allow reading back data at the
same rate as it was recorded. It must be an object that
supports comparisons using <, <=, =, >= and >. ilog.EntryTS
provides a suitable object.

Reimplemented from rtshell.ilog.Log.

Definition at line 82 of file simpkl_log.py.


Member Data Documentation

Definition at line 176 of file simpkl_log.py.

Definition at line 67 of file simpkl_log.py.

Definition at line 67 of file simpkl_log.py.

Definition at line 209 of file simpkl_log.py.

Definition at line 67 of file simpkl_log.py.

Definition at line 67 of file simpkl_log.py.

Reimplemented from rtshell.ilog.Log.

Definition at line 176 of file simpkl_log.py.

Reimplemented from rtshell.ilog.Log.

Definition at line 108 of file simpkl_log.py.

Definition at line 67 of file simpkl_log.py.

Definition at line 67 of file simpkl_log.py.

Definition at line 67 of file simpkl_log.py.

Definition at line 67 of file simpkl_log.py.

Definition at line 65 of file simpkl_log.py.

Definition at line 61 of file simpkl_log.py.

Definition at line 62 of file simpkl_log.py.

Definition at line 59 of file simpkl_log.py.

Definition at line 63 of file simpkl_log.py.

Definition at line 60 of file simpkl_log.py.


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


rtshell
Author(s): Geoffrey Biggs
autogenerated on Fri Aug 28 2015 12:55:12