IEventStream
- class carb.events.IEventStream
Bases:
pybind11_objectMethods
__init__(*args, **kwargs)create_subscription_to_pop(self, fn[, ...])Subscribes to event dispatching on the stream.
create_subscription_to_pop_by_type(self, ...)Subscribes to event dispatching on the stream.
create_subscription_to_push(self, fn[, ...])Subscribes to pushing events into stream.
create_subscription_to_push_by_type(self, ...)Subscribes to pushing events into stream.
dispatch(self[, event_type, sender, payload])Dispatch
Eventimmediately without putting it into stream.get_subscription_to_pop_order(self, name)get_subscription_to_push_order(self, name)get_subscriptions_to_pop(self)Get subscriptions to pop.
Get subscriptions to push.
next_event([order, name])Async wait for next event.
next_event_by_type(event_type[, order, name])Async wait for next event of particular type.
pop(self)Pop event.
pump(self)Pump event stream.
push(self[, event_type, sender, payload])Push
Eventinto stream.set_subscription_to_pop_order(self, name, order)Set subscription to pop order by name of subscription.
set_subscription_to_push_order(self, name, order)Set subscription to push order by name of subscription.
try_pop(self)Try pop event.
Attributes
event_countGets the name of the
EventStream.- __init__(*args, **kwargs)
- create_subscription_to_pop(self: carb.events._events.IEventStream, fn: Callable[[carb.events._events.IEvent], None], order: int = 0, name: str = None) carb.events._events.ISubscription
Subscribes to event dispatching on the stream.
See
Subscriptionfor more information on subscribing mechanism.- Parameters
fn – The callback to be called on event dispatch.
order – An integer order specifier. Lower numbers are called first. Negative numbers are allowed. Default is 0.
name – The name of the subscription for profiling. If no name is provided one is generated from the traceback of the calling function.
- Returns
The subscription holder.
- create_subscription_to_pop_by_type(self: carb.events._events.IEventStream, event_type: int, fn: Callable[[carb.events._events.IEvent], None], order: int = 0, name: str = None) carb.events._events.ISubscription
Subscribes to event dispatching on the stream.
See
Subscriptionfor more information on subscribing mechanism.- Parameters
event_type – Event type to listen to.
fn – The callback to be called on event dispatch.
order – An integer order specifier. Lower numbers are called first. Negative numbers are allowed. Default is 0.
name – The name of the subscription for profiling. If no name is provided one is generated from the traceback of the calling function.
- Returns
The subscription holder.
- create_subscription_to_push(self: carb.events._events.IEventStream, fn: Callable[[carb.events._events.IEvent], None], order: int = 0, name: str = None) carb.events._events.ISubscription
Subscribes to pushing events into stream.
See
Subscriptionfor more information on subscribing mechanism.- Parameters
fn – The callback to be called on event push.
order – An integer order specifier. Lower numbers are called first. Negative numbers are allowed. Default is 0.
name – The name of the subscription for profiling. If no name is provided one is generated from the traceback of the calling function.
- Returns
The subscription holder.
- create_subscription_to_push_by_type(self: carb.events._events.IEventStream, event_type: int, fn: Callable[[carb.events._events.IEvent], None], order: int = 0, name: str = None) carb.events._events.ISubscription
Subscribes to pushing events into stream.
See
Subscriptionfor more information on subscribing mechanism.- Parameters
event_type – Event type to listen to.
fn – The callback to be called on event push.
order – An integer order specifier. Lower numbers are called first. Negative numbers are allowed. Default is 0.
name – The name of the subscription for profiling. If no name is provided one is generated from the traceback of the calling function.
- Returns
The subscription holder.
- dispatch(self: carb.events._events.IEventStream, event_type: int = 0, sender: int = 0, payload: dict = {}) None
Dispatch
Eventimmediately without putting it into stream.
- get_subscription_to_pop_order(self: carb.events._events.IEventStream, name: str) object
- get_subscription_to_push_order(self: carb.events._events.IEventStream, name: str) object
- get_subscriptions_to_pop(self: carb.events._events.IEventStream) tuple
Get subscriptions to pop. Return tuple with all subscriptions.
- get_subscriptions_to_push(self: carb.events._events.IEventStream) tuple
Get subscriptions to push. Return tuple with all subscriptions.
- async next_event(order: int = 0, name: str = '')
Async wait for next event.
- async next_event_by_type(event_type: int, order: int = 0, name: str = '')
Async wait for next event of particular type.
- pop(self: carb.events._events.IEventStream) carb.events._events.IEvent
Pop event.
This function blocks execution until there is an event to pop.
- Returns
(
Event) object. You own this object, it can be stored.
- pump(self: carb.events._events.IEventStream) None
Pump event stream.
Dispatches all events in a stream.
- push(self: carb.events._events.IEventStream, event_type: int = 0, sender: int = 0, payload: dict = {}) None
Push
Eventinto stream.
- set_subscription_to_pop_order(self: carb.events._events.IEventStream, name: str, order: int) bool
Set subscription to pop order by name of subscription.
- set_subscription_to_push_order(self: carb.events._events.IEventStream, name: str, order: int) bool
Set subscription to push order by name of subscription.
- try_pop(self: carb.events._events.IEventStream) carb.events._events.IEvent
Try pop event.
- Returns
Pops (
Event`) if stream is not empty or return `None.
- property name
Gets the name of the
EventStream.- Returns
The name of the event stream.