Open Model Railroad Network (OpenMRN)
Loading...
Searching...
No Matches
openlcb::ByteRangeEventP Class Reference

TODO(balazs.racz): Add another class here, ByteRangeEventPC. More...

#include <EventHandlerTemplates.hxx>

Inheritance diagram for openlcb::ByteRangeEventP:
openlcb::ByteRangeEventC openlcb::SimpleEventHandler openlcb::EventHandler

Public Member Functions

 ByteRangeEventP (Node *node, uint64_t event_base, uint8_t *backing_store, unsigned size)
 Creates a new byte range producer.
 
void Update (unsigned byte, WriteHelper *writer, BarrierNotifiable *done)
 Requests the event associated with the current value of a specific byte to be produced (unconditionally).
 
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_consumer (const EventRegistryEntry &entry, EventReport *event, BarrierNotifiable *done) override
 Called on another node sending IdentifyConsumer.
 
void handle_identify_producer (const EventRegistryEntry &entry, EventReport *event, BarrierNotifiable *done) override
 Called on another node sending IdentifyProducer.
 
void handle_identify_global (const EventRegistryEntry &entry, EventReport *event, BarrierNotifiable *done) override
 Called on the need of sending out identification messages.
 
void handle_consumer_identified (const EventRegistryEntry &entry, EventReport *event, BarrierNotifiable *done) override
 Called on another node sending ConsumerIdentified for this event.
 
void handle_consumer_range_identified (const EventRegistryEntry &entry, EventReport *event, BarrierNotifiable *done) override
 Called on another node sending ConsumerRangeIdentified.
 
- Public Member Functions inherited from openlcb::ByteRangeEventC
 ByteRangeEventC (Node *node, uint64_t event_base, uint8_t *backing_store, unsigned size)
 Creates a new byte range listener.
 
void SendIdentified (WriteHelper *writer, BarrierNotifiable *done)
 Sends out a ConsumerRangeIdentified.
 
virtual void notify_changed (unsigned offset)
 This function is called by the handler when a data value overwrite event arrives.
 
- 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_producer_identified (const EventRegistryEntry &registry_entry, EventReport *event, BarrierNotifiable *done)
 Called on another node sending ProducerIdentified for this event.
 
virtual void handle_producer_range_identified (const EventRegistryEntry &registry_entry, EventReport *event, BarrierNotifiable *done)
 Called on another node sending ProducerRangeIdentified for this event.
 

Private Member Functions

uint64_t CurrentEventId (unsigned byte)
 Creates the eventid of the currently valid value of a given byte.
 

Additional Inherited Members

- Public Types inherited from openlcb::EventHandler
using EventReport = openlcb::EventReport
 
using EventRegistryEntry = openlcb::EventRegistryEntry
 
using EventId = openlcb::EventId
 
- Protected Member Functions inherited from openlcb::ByteRangeEventC
bool DecodeEventId (uint64_t event_id, uint8_t **data, uint8_t *value)
 takes an event ID and checks if we are responsible for it.
 
- Protected Attributes inherited from openlcb::ByteRangeEventC
uint64_t event_base_
 
Nodenode_
 
uint8_t * data_
 
unsigned size_
 

Detailed Description

TODO(balazs.racz): Add another class here, ByteRangeEventPC.

It should be in the middle between C and P: it should already have the export functionality of P but not remove the import functionality of C yet. Producer event handler for a sequence of bytes represented by a dense block of consecutive event IDs. Each byte has a consecutive block of 256 events.

Definition at line 889 of file EventHandlerTemplates.hxx.

Constructor & Destructor Documentation

◆ ByteRangeEventP()

openlcb::ByteRangeEventP::ByteRangeEventP ( Node node,
uint64_t  event_base,
uint8_t *  backing_store,
unsigned  size 
)

Creates a new byte range producer.

backing store points to memory of at least size bytes. This class will advertise producing size * 256 events contiguous from event_base. event_base will set byte 0 to value 0, event_base + 1 will set byte 0 to value 1, event_base + 256 will set byte 1 to value zero, event_base + 257 will set byte 1 to value 1, etc.

Definition at line 397 of file EventHandlerTemplates.cxx.

Member Function Documentation

◆ CurrentEventId()

uint64_t openlcb::ByteRangeEventP::CurrentEventId ( unsigned  byte)
private

Creates the eventid of the currently valid value of a given byte.

Definition at line 416 of file EventHandlerTemplates.cxx.

◆ handle_consumer_identified()

void openlcb::ByteRangeEventP::handle_consumer_identified ( const EventRegistryEntry registry_entry,
EventReport event,
BarrierNotifiable done 
)
overridevirtual

Called on another node sending ConsumerIdentified for this event.

Parameters
eventstores information about the incoming message. Filled: event_id, mask=1, src_node, state.
registry_entrygives the registry entry for which the current handler is being called.
donemust be notified when the processing is done.

Reimplemented from openlcb::EventHandler.

Definition at line 474 of file EventHandlerTemplates.cxx.

◆ handle_consumer_range_identified()

void openlcb::ByteRangeEventP::handle_consumer_range_identified ( const EventRegistryEntry registry_entry,
EventReport event,
BarrierNotifiable done 
)
overridevirtual

Called on another node sending ConsumerRangeIdentified.

Parameters
eventstores information about the incoming message. Filled: event id, mask (!= 1), src_node. Not filled: state.
registry_entrygives the registry entry for which the current handler is being called.
donemust be notified when the processing is done.

@TODO(balazs.racz): We should respond with the correct signal aspect for each offset that we offer.

Reimplemented from openlcb::EventHandler.

Definition at line 486 of file EventHandlerTemplates.cxx.

◆ handle_event_report()

void openlcb::ByteRangeEventP::handle_event_report ( const EventRegistryEntry registry_entry,
EventReport event,
BarrierNotifiable done 
)
overridevirtual

Called on incoming EventReport messages.

Parameters
eventstores information about the incoming message. Filled: src_node, event. Mask is always 1 (filled in). state is not filled in.
registry_entrygives the registry entry for which the current handler is being called.
donemust be notified when the processing is done.

Reimplemented from openlcb::ByteRangeEventC.

Definition at line 403 of file EventHandlerTemplates.cxx.

◆ handle_identify_consumer()

void openlcb::ByteRangeEventP::handle_identify_consumer ( const EventRegistryEntry registry_entry,
EventReport event,
BarrierNotifiable done 
)
overridevirtual

Called on another node sending IdentifyConsumer.

Parameters
eventstores information about the incoming message. Filled: src_node, event, mask=1. Not filled: state.
registry_entrygives the registry entry for which the current handler is being called.
donemust be notified when the processing is done.

Reimplemented from openlcb::ByteRangeEventC.

Definition at line 409 of file EventHandlerTemplates.cxx.

◆ handle_identify_global()

void openlcb::ByteRangeEventP::handle_identify_global ( const EventRegistryEntry registry_entry,
EventReport event,
BarrierNotifiable done 
)
overridevirtual

Called on the need of sending out identification messages.

Parameters
eventis NULL. This happens on startup, or when a global or addressed IdentifyGlobal message arrives. Might have destination node id!
registry_entrygives the registry entry for which the current handler is being called.
donemust be notified when the processing is done.

Reimplemented from openlcb::ByteRangeEventC.

Definition at line 443 of file EventHandlerTemplates.cxx.

◆ handle_identify_producer()

void openlcb::ByteRangeEventP::handle_identify_producer ( const EventRegistryEntry registry_entry,
EventReport event,
BarrierNotifiable done 
)
overridevirtual

Called on another node sending IdentifyProducer.

Parameters
eventstores information about the incoming message. Filled: src_node, event, mask=1. Not filled: state.
registry_entrygives the registry entry for which the current handler is being called.
donemust be notified when the processing is done.

Implements openlcb::EventHandler.

Definition at line 421 of file EventHandlerTemplates.cxx.

◆ SendIdentified()

void openlcb::ByteRangeEventP::SendIdentified ( WriteHelper writer,
BarrierNotifiable done 
)

Sends out a ProducerRangeIdentified.

Definition at line 456 of file EventHandlerTemplates.cxx.

◆ Update()

void openlcb::ByteRangeEventP::Update ( unsigned  byte,
WriteHelper writer,
BarrierNotifiable done 
)

Requests the event associated with the current value of a specific byte to be produced (unconditionally).

Parameters
byteis the offset of the value to produce (0 <= byte < size)
writeris the output flow to be used.
doneis the notification callback. Must not be NULL.

Definition at line 464 of file EventHandlerTemplates.cxx.


The documentation for this class was generated from the following files: