|
Open Model Railroad Network (OpenMRN)
|
Producer-Consumer event handler for a sequence of bits represented by a dense block of consecutive event IDs. More...
#include <EventHandlerTemplates.hxx>
Public Member Functions | |
| BitRangeEventPC (Node *node, uint64_t event_base, uint32_t *backing_store, unsigned size) | |
| Creates a new bit range listener. | |
| void | Set (unsigned bit, bool new_value, WriteHelper *writer, BarrierNotifiable *done) |
| Requests the event associated with the current value of the bit to be produced (unconditionally). | |
| bool | Get (unsigned bit) const |
| void | SendIdentified (WriteHelper *writer, BarrierNotifiable *done) |
| Sends out a ProducerRangeIdentified. | |
| void | handle_event_report (const EventRegistryEntry &entry, EventReport *event, BarrierNotifiable *done) override |
| Called on incoming EventReport messages. | |
| void | handle_identify_producer (const EventRegistryEntry &entry, EventReport *event, BarrierNotifiable *done) override |
| Called on another node sending IdentifyProducer. | |
| void | handle_identify_consumer (const EventRegistryEntry &entry, EventReport *event, BarrierNotifiable *done) override |
| Called on another node sending IdentifyConsumer. | |
| void | handle_identify_global (const EventRegistryEntry &entry, EventReport *event, BarrierNotifiable *done) override |
| Called on the need of sending out identification messages. | |
| unsigned | size () |
Public Member Functions inherited from openlcb::SimpleEventHandler | |
| IGNOREFN (handle_event_report) | |
| IGNOREFN (handle_consumer_identified) | |
| IGNOREFN (handle_consumer_range_identified) | |
| IGNOREFN (handle_producer_identified) | |
| IGNOREFN (handle_producer_range_identified) | |
| IGNOREFN (handle_identify_consumer) | |
| IGNOREFN (handle_identify_producer) | |
Public Member Functions inherited from openlcb::EventHandler | |
| virtual void | handle_consumer_identified (const EventRegistryEntry ®istry_entry, EventReport *event, BarrierNotifiable *done) |
| Called on another node sending ConsumerIdentified for this event. | |
| virtual void | handle_consumer_range_identified (const EventRegistryEntry ®istry_entry, EventReport *event, BarrierNotifiable *done) |
| Called on another node sending ConsumerRangeIdentified. | |
| virtual void | handle_producer_identified (const EventRegistryEntry ®istry_entry, EventReport *event, BarrierNotifiable *done) |
| Called on another node sending ProducerIdentified for this event. | |
| virtual void | handle_producer_range_identified (const EventRegistryEntry ®istry_entry, EventReport *event, BarrierNotifiable *done) |
| Called on another node sending ProducerRangeIdentified for this event. | |
Protected Member Functions | |
| void | HandleIdentifyBase (Defs::MTI mti_valid, EventReport *event, BarrierNotifiable *done) |
| void | GetBitAndMask (unsigned bit, uint32_t **data, uint32_t *mask) const |
Protected Attributes | |
| uint64_t | event_base_ |
| Node * | node_ |
| uint32_t * | data_ |
| unsigned | size_ |
Additional Inherited Members | |
Public Types inherited from openlcb::EventHandler | |
| using | EventReport = openlcb::EventReport |
| using | EventRegistryEntry = openlcb::EventRegistryEntry |
| using | EventId = openlcb::EventId |
Producer-Consumer event handler for a sequence of bits represented by a dense block of consecutive event IDs.
Definition at line 735 of file EventHandlerTemplates.hxx.
| openlcb::BitRangeEventPC::BitRangeEventPC | ( | Node * | node, |
| uint64_t | event_base, | ||
| uint32_t * | backing_store, | ||
| unsigned | size | ||
| ) |
Creates a new bit range listener.
backing store points to memory of at least size bits (round up to multiple of 32). This class will advertise producing and consuming size * 2 events contiguous from event_base. event_base will turn bit 0 on, event_base + 1 will turn bit 0 off, event_base + 2 will turn bit 1 on, event_base + 3 will turn bit 1 off, etc.
Definition at line 65 of file EventHandlerTemplates.cxx.
|
virtual |
Definition at line 77 of file EventHandlerTemplates.cxx.
| bool openlcb::BitRangeEventPC::Get | ( | unsigned | bit | ) | const |
Definition at line 92 of file EventHandlerTemplates.cxx.
|
protected |
Definition at line 82 of file EventHandlerTemplates.cxx.
|
overridevirtual |
Called on incoming EventReport messages.
| event | stores information about the incoming message. Filled: src_node, event. Mask is always 1 (filled in). state is not filled in. |
| registry_entry | gives the registry entry for which the current handler is being called. |
| done | must be notified when the processing is done. |
Implements openlcb::EventHandler.
Definition at line 169 of file EventHandlerTemplates.cxx.
|
overridevirtual |
Called on another node sending IdentifyConsumer.
| event | stores information about the incoming message. Filled: src_node, event, mask=1. Not filled: state. |
| registry_entry | gives the registry entry for which the current handler is being called. |
| done | must be notified when the processing is done. |
Implements openlcb::EventHandler.
Definition at line 210 of file EventHandlerTemplates.cxx.
|
overridevirtual |
Called on the need of sending out identification messages.
| event | is NULL. This happens on startup, or when a global or addressed IdentifyGlobal message arrives. Might have destination node id! |
| registry_entry | gives the registry entry for which the current handler is being called. |
| done | must be notified when the processing is done. |
Implements openlcb::EventHandler.
Definition at line 263 of file EventHandlerTemplates.cxx.
|
overridevirtual |
Called on another node sending IdentifyProducer.
| event | stores information about the incoming message. Filled: src_node, event, mask=1. Not filled: state. |
| registry_entry | gives the registry entry for which the current handler is being called. |
| done | must be notified when the processing is done. |
Implements openlcb::EventHandler.
Definition at line 204 of file EventHandlerTemplates.cxx.
|
protected |
Definition at line 215 of file EventHandlerTemplates.cxx.
| void openlcb::BitRangeEventPC::SendIdentified | ( | WriteHelper * | writer, |
| BarrierNotifiable * | done | ||
| ) |
Sends out a ProducerRangeIdentified.
Definition at line 280 of file EventHandlerTemplates.cxx.
| void openlcb::BitRangeEventPC::Set | ( | unsigned | bit, |
| bool | new_value, | ||
| WriteHelper * | writer, | ||
| BarrierNotifiable * | done | ||
| ) |
Requests the event associated with the current value of the bit to be produced (unconditionally).
| node | specifies the source node from which to produce the event. |
| bit | is the offset of the bit to set (0 <= bit < size) |
| new_value | is the new value of the bit |
| writer | is the output flow to be used. |
| done | is the notification callback. If it is NULL, the writer will be invoked inline and potentially block the calling thread. |
Definition at line 103 of file EventHandlerTemplates.cxx.
|
inline |
Definition at line 784 of file EventHandlerTemplates.hxx.
|
protected |
Definition at line 793 of file EventHandlerTemplates.hxx.
|
protected |
Definition at line 791 of file EventHandlerTemplates.hxx.
|
protected |
Definition at line 792 of file EventHandlerTemplates.hxx.
|
protected |
Definition at line 794 of file EventHandlerTemplates.hxx.