TypedWritable¶
-
class TypedWritable¶
Bases:
TypedObjectBase class for objects that can be written to and read from Bam files.
See also
TypedObjectfor detailed instructions.Inheritance diagram
digraph inheritanced292861d55 { bgcolor=transparent; rankdir=BT; size="8.0, 12.0"; "DTOOL_SUPER_BASE" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=11,height=0.25,shape=box,style=""]; "TypedObject" [URL="acron.core.TypedObject.html#acron.core.TypedObject",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=11,height=0.25,shape=box,style="",target="_top",tooltip="/**"]; "DTOOL_SUPER_BASE" -> "TypedObject" [arrowsize=0.75,style=""]; "TypedWritable" [URL="acron.core.TypedWritable.html#acron.core.TypedWritable",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=11,height=0.25,shape=box,style="",target="_top",tooltip="/**"]; "TypedObject" -> "TypedWritable" [arrowsize=0.75,style=""]; }- static TypedWritable.__new__()¶
- TypedWritable.__reduce__()¶
- TypedWritable.__reduce_persist__()¶
- static TypedWritable.decode_raw_from_bam_stream()¶
Reads the bytes created by a previous call to
encode_to_bam_stream(), and extracts the single object on those bytes. Returns true on success, false on error.This variant sets the
TypedWritableandReferenceCountpointers separately; both are pointers to the same object. The reference count is not incremented; it is the caller’s responsibility to manage the reference count.Note that this method cannot be used to retrieve objects that do not inherit from
ReferenceCount, because these objects cannot persist beyond the lifetime of theBamReaderthat reads them. To retrieve these objects from a bam stream, you must construct aBamReaderdirectly.If you happen to know that the particular object in question inherits from
TypedWritableReferenceCountorAcronNode, consider calling the variant of decode_from_bam_stream() defined for those methods, which presents a simpler interface.
- TypedWritable.encode_to_bam_stream()¶
Converts the
TypedWritableobject into a single stream of data using aBamWriter, and returns that data as a bytes object. Returns an empty bytes object on failure.This is a convenience method particularly useful for cases when you are only serializing a single object. If you have many objects to process, it is more efficient to use the same
BamWriterto serialize all of them together.Converts the
TypedWritableobject into a single stream of data using aBamWriter, and stores that data in the indicated string. Returns true on success, false on failure.This is a convenience method particularly useful for cases when you are only serializing a single object. If you have many objects to process, it is more efficient to use the same
BamWriterto serialize all of them together.
- TypedWritable.fillin()¶
This internal function is intended to be called by each class’s make_from_bam() method to read in all of the relevant data from the
BamFilefor the new object. It is also called directly by theBamReaderto re-read the data for an object that has been placed on the stream for an update.
- TypedWritable.get_bam_modified()¶
Returns the current bam_modified counter. This counter is normally incremented automatically whenever the object is modified.
- static TypedWritable.get_class_type()¶
- TypedWritable.mark_bam_modified()¶
Increments the bam_modified counter, so that this object will be invalidated and retransmitted on any open bam streams. This should normally not need to be called by user code; it should be called internally when the object has been changed in a way that legitimately requires its retransmission to any connected clients.
- TypedWritable.write_datagram()¶
Writes the contents of this object to the datagram for shipping out to a Bam file.