PUS Event Manager #19

Merged
muellerr merged 41 commits from pus-event-manager into main 2022-11-19 12:26:17 +01:00
Showing only changes of commit 01f500a409 - Show all commits

View File

@ -96,6 +96,14 @@ pub trait EventReceiver<Event: GenericEvent, AuxDataProvider = Params> {
fn receive(&mut self) -> Option<(Event, Option<AuxDataProvider>)>; fn receive(&mut self) -> Option<(Event, Option<AuxDataProvider>)>;
} }
pub trait ListenerTable<SendProviderError, Event: GenericEvent = EventU32, AuxDataProvider = Params>
{
fn get_listeners(
&mut self,
key: ListenerType,
) -> &[Listener<SendProviderError, Event, AuxDataProvider>];
}
/// Generic event manager implementation. /// Generic event manager implementation.
/// ///
/// # Generics /// # Generics
@ -107,6 +115,7 @@ pub trait EventReceiver<Event: GenericEvent, AuxDataProvider = Params> {
pub struct EventManager<SendProviderError, Event: GenericEvent = EventU32, AuxDataProvider = Params> pub struct EventManager<SendProviderError, Event: GenericEvent = EventU32, AuxDataProvider = Params>
{ {
listeners: HashMap<ListenerType, Vec<Listener<SendProviderError, Event, AuxDataProvider>>>, listeners: HashMap<ListenerType, Vec<Listener<SendProviderError, Event, AuxDataProvider>>>,
//listener_table: Box<dyn ListenerTable<SendProviderError, Event, AuxDataProvider>>,
event_receiver: Box<dyn EventReceiver<Event, AuxDataProvider>>, event_receiver: Box<dyn EventReceiver<Event, AuxDataProvider>>,
} }