Public Member Functions | |
def | __del__ |
def | __enter__ |
def | __exit__ |
def | __init__ |
def | __iter__ |
def | __str__ |
def | close |
def | end |
def | eof |
def | finalise |
def | metadata |
def | metadata |
def | mode |
def | name |
def | next |
def | open |
def | pos |
def | read |
def | rewind |
def | seek |
def | start |
def | write |
Private Member Functions | |
def | _close |
def | _eof |
def | _finalise |
def | _get_cur_pos |
def | _get_end |
def | _get_start |
def | _open |
def | _vb_print |
Private Attributes | |
_meta | |
_mode | |
_vb |
def rtshell.ilog.Log.__init__ | ( | self, | |
mode = 'r' , |
|||
meta = None , |
|||
verbose = False , |
|||
args, | |||
kwargs | |||
) |
Base constructor. The log will be opened on construction. It should be closed manually, as Python does not guarantee that __del__() will be called. @param mode Permissions. Specificy 'r' for read, 'w' for write or 'rw' for read/write. Not all logs support all permissions. Read/write permissions are particularly uncommon. @param meta A block of data to write into the log. Implementations are free to deal with this any way they wish, as long as it can be retrieved in read mode. However, there is no requirement that it can be changed after opening the log for writing. Users should set it before opening the log. @param verbose Print verbose output to stderr.
def rtshell.ilog.Log.__del__ | ( | self | ) |
def rtshell.ilog.Log.__enter__ | ( | self | ) |
def rtshell.ilog.Log.__exit__ | ( | self, | |
exc_type, | |||
exc_val, | |||
exc_tb | |||
) |
def rtshell.ilog.Log.__iter__ | ( | self | ) |
def rtshell.ilog.Log.__str__ | ( | self | ) |
Reimplemented in rtshell.simpkl_log.SimplePickleLog, and rtshell.text_log.TextLog.
def rtshell.ilog.Log._close | ( | self | ) | [private] |
Reimplemented in rtshell.simpkl_log.SimplePickleLog, and rtshell.text_log.TextLog.
def rtshell.ilog.Log._eof | ( | self | ) | [private] |
Reimplemented in rtshell.simpkl_log.SimplePickleLog.
def rtshell.ilog.Log._finalise | ( | self | ) | [private] |
def rtshell.ilog.Log._get_cur_pos | ( | self | ) | [private] |
Get the current position in the log. Should be implemented by implementation objects. Called by the @ref position property.
Reimplemented in rtshell.simpkl_log.SimplePickleLog, and rtshell.text_log.TextLog.
def rtshell.ilog.Log._get_end | ( | self | ) | [private] |
Get the position of the last entry in the log. Should be implemented by implementation objects. Called by the @ref end property.
Reimplemented in rtshell.simpkl_log.SimplePickleLog.
def rtshell.ilog.Log._get_start | ( | self | ) | [private] |
Get the position of the first entry in the log. Should be implemented by implementation objects. Called by the @ref start property.
Reimplemented in rtshell.simpkl_log.SimplePickleLog.
def rtshell.ilog.Log._open | ( | self | ) | [private] |
Reimplemented in rtshell.simpkl_log.SimplePickleLog, and rtshell.text_log.TextLog.
def rtshell.ilog.Log._vb_print | ( | self, | |
string | |||
) | [private] |
def rtshell.ilog.Log.close | ( | self, | |
finalise = True |
|||
) |
def rtshell.ilog.Log.end | ( | self | ) |
def rtshell.ilog.Log.eof | ( | self | ) |
def rtshell.ilog.Log.finalise | ( | self | ) |
Prepare the log to be closed. Any cleaning up that needs to be done before closing the log should be done here. This function is called just before closing the log by @ref close. If using the context manager statement (the 'with' statement), it will be called automatically, unless an exception has occured. It is not required for objects implementing the Log interface to implement this function.
def rtshell.ilog.Log.metadata | ( | self | ) |
def rtshell.ilog.Log.metadata | ( | self, | |
metadata | |||
) |
def rtshell.ilog.Log.mode | ( | self | ) |
def rtshell.ilog.Log.name | ( | self | ) |
def rtshell.ilog.Log.next | ( | self | ) |
def rtshell.ilog.Log.open | ( | self | ) |
def rtshell.ilog.Log.pos | ( | self | ) |
def rtshell.ilog.Log.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 in rtshell.simpkl_log.SimplePickleLog.
def rtshell.ilog.Log.rewind | ( | self | ) |
Rewind the log to the first entry.
Reimplemented in rtshell.simpkl_log.SimplePickleLog.
def rtshell.ilog.Log.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 in rtshell.simpkl_log.SimplePickleLog.
def rtshell.ilog.Log.start | ( | self | ) |
def rtshell.ilog.Log.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 in rtshell.simpkl_log.SimplePickleLog, and rtshell.text_log.TextLog.
rtshell::ilog.Log::_meta [private] |
Reimplemented in rtshell.simpkl_log.SimplePickleLog.
rtshell::ilog.Log::_mode [private] |
Reimplemented in rtshell.simpkl_log.SimplePickleLog, and rtshell.text_log.TextLog.
rtshell::ilog.Log::_vb [private] |