libtcspc.BatchFromBytes¶
- final class libtcspc.BatchFromBytes(event_type, *, buffer_provider=None)[source]¶
Bases:
NodeProcessor that copies batches of bytes into batches of typed events.
Input is a
BucketEventof an internal byte event type (std::byte). The processor copies the incoming bytes into a freshBucketEventofevent_type, drawing storage from the buffer provider. Any trailing bytes that do not make up a wholeevent_typeare buffered and combined with subsequent input.- Parameters:
event_type (EventType) – Element type of the output buckets. Must be a trivially-typed event.
buffer_provider (BucketSource or Param[PyBucketSource] or None) – Source of buckets used to hold each output batch. If
None, a defaultRecyclingBucketSourceforevent_typeis used. A runtimeParamof typePyBucketSourcebinds a Python bucket source at execution time.
Notes
Events handled:
BucketEventof byte event type: copy up to object boundary asBucketEventofevent_type; emit.All other event types: rejected at graph build time.
End of input: pass through. Raises an exception if any unconsumed bytes remain.
See also
- tcspc::batch_from_bytes()
The underlying C++ factory function.
UnbatchFromBytesThe inverse: emit typed events one at a time from byte batches.
ViewAsBytesView bucketed events as their in-memory bytes.