Public Member Functions | Public Attributes | Static Public Attributes | Private Member Functions | Private Attributes | List of all members
grepros.outputs.BagSink Class Reference
Inheritance diagram for grepros.outputs.BagSink:
Inheritance graph
[legend]

Public Member Functions

def __init__ (self, args=None, **kwargs)
 
def autodetect (cls, target)
 
def close (self)
 
def close_output (self)
 
def emit (self, topic, msg, stamp=None, match=None, index=None)
 
def size (self)
 
def validate (self)
 
- Public Member Functions inherited from grepros.outputs.Sink
def __enter__ (self)
 
def __exit__ (self, exc_type, exc_value, traceback)
 
def bind (self, source)
 
def emit_meta (self)
 
def flush (self)
 
def is_highlighting (self)
 
def thread_excepthook (self, text, exc)
 
- Public Member Functions inherited from grepros.outputs.RolloverSinkMixin
def ensure_rollover (self, topic, msg, stamp)
 
def format_output_meta (self)
 
def get_write_options (cls, label)
 
def make_filename (self)
 

Public Attributes

 filename
 
 valid
 
- Public Attributes inherited from grepros.outputs.Sink
 args
 
 source
 inputs.Source instance bound to this sink More...
 
 valid
 Result of validate() More...
 
- Public Attributes inherited from grepros.outputs.RolloverSinkMixin
 filename
 Current output file path. More...
 

Static Public Attributes

 DEFAULT_ARGS = dict(META=False, WRITE_OPTIONS={}, VERBOSE=False)
 Constructor argument defaults. More...
 
- Static Public Attributes inherited from grepros.outputs.Sink
 DEFAULT_ARGS = dict(META=False)
 Constructor argument defaults. More...
 
tuple FILE_EXTENSIONS = ()
 Auto-detection file extensions for subclasses, as (".ext", ) More...
 
- Static Public Attributes inherited from grepros.outputs.RolloverSinkMixin
 DEFAULT_ARGS = dict(VERBOSE=False, WRITE=None, WRITE_OPTIONS={})
 Constructor argument defaults. More...
 
string FILE_META_TEMPLATE = "{name} ({size})"
 
string MULTI_META_TEMPLATE = "\n- {name} ({size}, {mcount}, {tcount})"
 
list OPTIONS_TEMPLATES
 Command-line help templates for rollover options, as [(name, text with s label placeholder)]. More...
 
string START_META_TEMPLATE = "{mcount} in {tcount} to "
 

Private Member Functions

def _ensure_open (self)
 

Private Attributes

 _bag
 
 _close_printed
 
 _is_pathed
 
 _overwrite
 

Detailed Description

Writes messages to bagfile.

Definition at line 591 of file outputs.py.

Constructor & Destructor Documentation

◆ __init__()

def grepros.outputs.BagSink.__init__ (   self,
  args = None,
**  kwargs 
)
@param   args                 arguments as namespace or dictionary, case-insensitive;
                      or a single path as the ROS bagfile to write,
                      or a stream or {@link grepros.api.Bag Bag} instance to write to
@param   args.write           name of ROS bagfile to create or append to,
                      or a stream to write to
@param   args.write_options   {"overwrite": whether to overwrite existing file
                                    (default false),
                       "rollover-size": bytes limit for individual output files,
                       "rollover-count": message limit for individual output files,
                       "rollover-duration": time span limit for individual output files,
                                            as ROS duration or convertible seconds,
                       "rollover-template": output filename template, supporting
                                            strftime format codes like "%H-%M-%S"
                                            and "%(index)s" as output file index}
@param   args.meta            whether to emit metainfo
@param   args.verbose         whether to emit debug information
@param   kwargs               any and all arguments as keyword overrides, case-insensitive

Reimplemented from grepros.outputs.Sink.

Definition at line 597 of file outputs.py.

Member Function Documentation

◆ _ensure_open()

def grepros.outputs.BagSink._ensure_open (   self)
private
Opens output file if not already open.

Definition at line 691 of file outputs.py.

◆ autodetect()

def grepros.outputs.BagSink.autodetect (   cls,
  target 
)
Returns true if target is recognizable as a ROS bag.

Reimplemented from grepros.outputs.Sink.

Definition at line 722 of file outputs.py.

◆ close()

def grepros.outputs.BagSink.close (   self)
Closes output bag, if any, emits metainfo.

Reimplemented from grepros.outputs.Sink.

Definition at line 669 of file outputs.py.

◆ close_output()

def grepros.outputs.BagSink.close_output (   self)
Closes output bag, if any.

Reimplemented from grepros.outputs.RolloverSinkMixin.

Definition at line 677 of file outputs.py.

◆ emit()

def grepros.outputs.BagSink.emit (   self,
  topic,
  msg,
  stamp = None,
  match = None,
  index = None 
)
Writes message to output bagfile.

Reimplemented from grepros.outputs.Sink.

Definition at line 632 of file outputs.py.

◆ size()

def grepros.outputs.BagSink.size (   self)
Returns current file size in bytes, or None if size lookup failed.

Reimplemented from grepros.outputs.RolloverSinkMixin.

Definition at line 683 of file outputs.py.

◆ validate()

def grepros.outputs.BagSink.validate (   self)
Returns whether write options are valid and ROS environment set, emits error if not.

Reimplemented from grepros.outputs.Sink.

Definition at line 646 of file outputs.py.

Member Data Documentation

◆ _bag

grepros.outputs.BagSink._bag
private

Definition at line 625 of file outputs.py.

◆ _close_printed

grepros.outputs.BagSink._close_printed
private

Definition at line 627 of file outputs.py.

◆ _is_pathed

grepros.outputs.BagSink._is_pathed
private

Definition at line 628 of file outputs.py.

◆ _overwrite

grepros.outputs.BagSink._overwrite
private

Definition at line 626 of file outputs.py.

◆ DEFAULT_ARGS

grepros.outputs.BagSink.DEFAULT_ARGS = dict(META=False, WRITE_OPTIONS={}, VERBOSE=False)
static

Constructor argument defaults.

Definition at line 595 of file outputs.py.

◆ filename

grepros.outputs.BagSink.filename

Definition at line 701 of file outputs.py.

◆ valid

grepros.outputs.BagSink.valid

Definition at line 666 of file outputs.py.


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


grepros
Author(s): Erki Suurjaak
autogenerated on Sat Jan 6 2024 03:11:30