|
Open Model Railroad Network (OpenMRN)
|
Event producer for range of bits (event pairs) that is non-autoritative. More...
#include <NonAuthoritativeEventProducer.hxx>
Public Member Functions | |
| BitRangeNonAuthoritativeEventP (Node *node, uint64_t event_base, uint32_t size, std::function< void(unsigned, bool)> state_callback=nullptr) | |
| Constructor. | |
| BitRangeNonAuthoritativeEventP (Node *node, uint64_t event_base_on, uint64_t event_base_off, uint32_t size, std::function< void(unsigned, bool)> state_callback=nullptr) | |
| Constructor. | |
| ~BitRangeNonAuthoritativeEventP () | |
| Destructor. | |
| void | send_query_consumer (unsigned bit, WriteHelper *writer, BarrierNotifiable *done) |
| Queries consumer and acquires the current state of the bit. | |
| 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). | |
| void | handle_event_report (const EventRegistryEntry &entry, EventReport *event, BarrierNotifiable *done) override |
| Handle an incoming event. | |
| void | handle_consumer_identified (const EventRegistryEntry &entry, EventReport *event, BarrierNotifiable *done) override |
| Handle an incoming consumer identified message. | |
| void | handle_identify_global (const EventRegistryEntry &entry, EventReport *event, BarrierNotifiable *done) override |
| Handle an incoming identify global or addressed message. | |
| void | handle_identify_producer (const EventRegistryEntry &entry, EventReport *event, BarrierNotifiable *done) override |
| Handle an incoming identify producer message. | |
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_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. | |
| virtual void | handle_identify_consumer (const EventRegistryEntry ®istry_entry, EventReport *event, BarrierNotifiable *done)=0 |
| Called on another node sending IdentifyConsumer. | |
Private Types | |
| enum | EventBaseType : unsigned { EVENT_BASE = 1 , EVENT_BASE_ON , EVENT_BASE_OFF } |
| Identifiers for the types of event range registration. More... | |
Private Member Functions | |
| DISALLOW_COPY_AND_ASSIGN (BitRangeNonAuthoritativeEventP) | |
Private Attributes | ||
| Node * | node_ | |
| Node ID that this producer is attached to. | ||
| union { | ||
| uint64_t eventBase_ | ||
| base event ID of the full range More... | ||
| uint64_t eventBaseOn_ | ||
| base event ID for "on" range More... | ||
| }; | ||
| uint64_t | eventBaseOff_ | |
| base event ID for "off" range | ||
| unsigned | size_ | |
| number of bits stored | ||
| std::function< void(unsigned, bool)> | stateCallback_ | |
| Callback method that will be invoked when a consumer identified message is received with a known state. | ||
Additional Inherited Members | |
Public Types inherited from openlcb::EventHandler | |
| using | EventReport = openlcb::EventReport |
| using | EventRegistryEntry = openlcb::EventRegistryEntry |
| using | EventId = openlcb::EventId |
Event producer for range of bits (event pairs) that is non-autoritative.
Definition at line 46 of file NonAuthoritativeEventProducer.hxx.
|
private |
Identifiers for the types of event range registration.
| Enumerator | |
|---|---|
| EVENT_BASE_ON | one unified range starting at eventBase_ |
| EVENT_BASE_OFF | on range starting at eventBaseOn_ |
Definition at line 171 of file NonAuthoritativeEventProducer.hxx.
|
inline |
Constructor.
Creates a new bit range producer.
| node | the node that the producer will be bound to |
| event_base | the starting event ID for the event range |
| size | The total event range size in "pairs" of events. Each pair of sequential events represents a single "bit" with a binary state. |
| state_callback | Callback method for delivering the results of a consumer identified. The first unsigned parameter represents the bit offset for the range and the second bool parameter indicates the state as true for valid and false for invalid |
Definition at line 61 of file NonAuthoritativeEventProducer.hxx.
|
inline |
Constructor.
Creates a new bit range producer.
| node | the node that the producer will be bound to |
| event_base_on | the starting event ID for the "on" event range |
| event_base_off | the starting event ID for the "off" event range |
| size | The total event range size in "pairs" of events. Each pair of sequential events represents a single "bit" with a binary state. |
| state_callback | Callback method for delivering the results of a consumer identified or event report. The first unsigned parameter represents the bit offset for the range and the second bool parameter indicates the state as true for valid and false for invalid. |
Definition at line 88 of file NonAuthoritativeEventProducer.hxx.
|
inline |
Destructor.
Definition at line 109 of file NonAuthoritativeEventProducer.hxx.
|
overridevirtual |
Handle an incoming consumer identified message.
| entry | reference to this entry in the event registry |
| event | event metadata |
| done | notifible to wakup when finished with the report processing |
Reimplemented from openlcb::EventHandler.
Definition at line 106 of file NonAuthoritativeEventProducer.cxx.
|
overridevirtual |
Handle an incoming event.
| entry | reference to this entry in the event registry |
| event | event metadata |
| done | notifible to wakup when finished with the report processing |
Implements openlcb::EventHandler.
Definition at line 61 of file NonAuthoritativeEventProducer.cxx.
|
overridevirtual |
Handle an incoming identify global or addressed message.
| entry | reference to this entry in the event registry |
| event | event metadata |
| done | notifible to wakup when finished with the report processing |
Implements openlcb::EventHandler.
Definition at line 168 of file NonAuthoritativeEventProducer.cxx.
|
overridevirtual |
Handle an incoming identify producer message.
| entry | reference to this entry in the event registry |
| event | event metadata |
| done | notifible to wakup when finished with the report processing |
Implements openlcb::EventHandler.
Definition at line 204 of file NonAuthoritativeEventProducer.cxx.
| void openlcb::BitRangeNonAuthoritativeEventP::send_query_consumer | ( | unsigned | bit, |
| WriteHelper * | writer, | ||
| BarrierNotifiable * | done | ||
| ) |
Queries consumer and acquires the current state of the bit.
| bit | bit pair offset from the base event ID of the range, (0 <= bit < size) |
| writer | object that will assist in the write transaction |
| done | notifible to wakup when finished |
Definition at line 46 of file NonAuthoritativeEventProducer.cxx.
| void openlcb::BitRangeNonAuthoritativeEventP::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).
| 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 | notifible to wakup when query is sent on the bus |
Definition at line 253 of file NonAuthoritativeEventProducer.cxx.
| uint64_t openlcb::BitRangeNonAuthoritativeEventP::eventBase_ |
base event ID of the full range
Definition at line 182 of file NonAuthoritativeEventProducer.hxx.
|
private |
base event ID for "off" range
Definition at line 185 of file NonAuthoritativeEventProducer.hxx.
| uint64_t openlcb::BitRangeNonAuthoritativeEventP::eventBaseOn_ |
base event ID for "on" range
Definition at line 183 of file NonAuthoritativeEventProducer.hxx.
|
private |
Node ID that this producer is attached to.
Definition at line 179 of file NonAuthoritativeEventProducer.hxx.
|
private |
number of bits stored
Definition at line 186 of file NonAuthoritativeEventProducer.hxx.
|
private |
Callback method that will be invoked when a consumer identified message is received with a known state.
Definition at line 190 of file NonAuthoritativeEventProducer.hxx.