Public Member Functions | Private Member Functions | Private Attributes
rtshell.ilog.Log Class Reference

Log interface. More...

Inheritance diagram for rtshell.ilog.Log:
Inheritance graph
[legend]

List of all members.

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

Detailed Description

Log interface.

All loggers must conform to this.

Definition at line 135 of file ilog.py.


Constructor & Destructor Documentation

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.

Definition at line 136 of file ilog.py.

def rtshell.ilog.Log.__del__ (   self)

Definition at line 159 of file ilog.py.


Member Function Documentation

Definition at line 162 of file ilog.py.

def rtshell.ilog.Log.__exit__ (   self,
  exc_type,
  exc_val,
  exc_tb 
)

Definition at line 165 of file ilog.py.

def rtshell.ilog.Log.__iter__ (   self)

Definition at line 172 of file ilog.py.

def rtshell.ilog.Log.__str__ (   self)

Reimplemented in rtshell.simpkl_log.SimplePickleLog, and rtshell.text_log.TextLog.

Definition at line 181 of file ilog.py.

def rtshell.ilog.Log._close (   self) [private]

Reimplemented in rtshell.simpkl_log.SimplePickleLog, and rtshell.text_log.TextLog.

Definition at line 322 of file ilog.py.

def rtshell.ilog.Log._eof (   self) [private]

Reimplemented in rtshell.simpkl_log.SimplePickleLog.

Definition at line 325 of file ilog.py.

def rtshell.ilog.Log._finalise (   self) [private]

Definition at line 328 of file ilog.py.

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.

Definition at line 331 of file ilog.py.

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.

Definition at line 349 of file ilog.py.

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.

Definition at line 340 of file ilog.py.

def rtshell.ilog.Log._open (   self) [private]

Reimplemented in rtshell.simpkl_log.SimplePickleLog, and rtshell.text_log.TextLog.

Definition at line 358 of file ilog.py.

def rtshell.ilog.Log._vb_print (   self,
  string 
) [private]
Print verbose information when self._vb is True.

Definition at line 361 of file ilog.py.

def rtshell.ilog.Log.close (   self,
  finalise = True 
)
Closes the log.

@param finalise Whether the log should be finalised before closing.
        Defaults to True.

Definition at line 258 of file ilog.py.

def rtshell.ilog.Log.end (   self)
The position of the final entry in the log.

A tuple of (index, timestamp).

Definition at line 185 of file ilog.py.

def rtshell.ilog.Log.eof (   self)
True if the log has reached the end.

Definition at line 194 of file ilog.py.

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.

Definition at line 242 of file ilog.py.

def rtshell.ilog.Log.metadata (   self)
Return the metadata from the log (if any).

Definition at line 199 of file ilog.py.

def rtshell.ilog.Log.metadata (   self,
  metadata 
)

Definition at line 204 of file ilog.py.

def rtshell.ilog.Log.mode (   self)
The mode of the log.

Definition at line 208 of file ilog.py.

def rtshell.ilog.Log.name (   self)
The name of the log.

Definition at line 213 of file ilog.py.

def rtshell.ilog.Log.next (   self)

Definition at line 175 of file ilog.py.

def rtshell.ilog.Log.open (   self)
Opens the log.

Definition at line 238 of file ilog.py.

def rtshell.ilog.Log.pos (   self)
The current position in the log.

A tuple of (index, timestamp).

This points at the current position - i.e. the entry most recently
read.

Definition at line 218 of file ilog.py.

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.

Definition at line 280 of file ilog.py.

def rtshell.ilog.Log.rewind (   self)
Rewind the log to the first entry.

Reimplemented in rtshell.simpkl_log.SimplePickleLog.

Definition at line 299 of file ilog.py.

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.

Definition at line 303 of file ilog.py.

def rtshell.ilog.Log.start (   self)
The position of the first entry in the log.

A tuple of (index, timestamp).

Definition at line 230 of file ilog.py.

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.

Definition at line 269 of file ilog.py.


Member Data Documentation

Reimplemented in rtshell.simpkl_log.SimplePickleLog.

Definition at line 151 of file ilog.py.

Reimplemented in rtshell.simpkl_log.SimplePickleLog, and rtshell.text_log.TextLog.

Definition at line 151 of file ilog.py.

Definition at line 151 of file ilog.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