35#ifndef _OPENLCB_NODEINITIALIZEFLOW_HXX_
36#define _OPENLCB_NODEINITIALIZEFLOW_HXX_
89 node()->iface()->global_message_write_flow(),
90 STATE(send_initialized));
93 Action send_initialized()
96 node()->iface()->global_message_write_flow());
98 NodeID id = node()->node_id();
104 b, b->data()->priority());
108 Action initialization_complete()
122 node()->iface()->dispatcher(),
STATE(initiate_local_identify));
125 Action initiate_local_identify()
128 b->set_done(done_.
reset(
this));
129 GenMessage *m = b->data();
132 m->dst.id = node()->node_id();
135 m->src.id = node()->node_id();
140 Action wait_for_local_identify()
171 Action send_init_request() {
174 b->set_done(bn_.
reset(
this));
#define STATE(_fn)
Turns a function name into an argument to be supplied to functions expecting a state.
A BarrierNotifiable allows to create a number of child Notifiable and wait for all of them to finish.
BarrierNotifiable * reset(Notifiable *done)
Resets the barrier. Returns &*this. Asserts that is_done().
virtual void send(MessageType *message, unsigned priority=UINT_MAX)=0
Entry point to the flow.
Collection of related state machines that pend on incoming messages.
Return type for a state flow callback.
Base class for state machines.
Service * service()
Return a pointer to the service I am bound to.
Action allocate_and_call(FlowInterface< Buffer< T > > *target_flow, Callback c, Pool *pool=nullptr)
Allocates a buffer from a pool and proceed to the next state when allocation is successful.
StateFlowBase()
Default constructor.
Action delete_this()
Terminates the flow and deletes *this.
void start_flow(Callback c)
Resets the flow to the specified state and starts it.
Buffer< T > * get_allocation_result(FlowInterface< Buffer< T > > *target_flow)
Takes the result of the asynchronous allocation.
Action call_immediately(Callback c)
Imediately call the next state upon return.
Action wait_and_call(Callback c)
Wait for resource to become available before proceeding to next state.
Action release_and_exit()
Terminates the processing of the current message.
State flow with a given typed input queue.
Base::Action Action
Allows using Action without having StateFlowBase:: prefix in front of it.
void send(MessageType *msg, unsigned priority=UINT_MAX) OVERRIDE
Sends a message to the state flow for processing.
Action call_immediately(Callback c)
Imediately call the next state upon return.
Abstract class representing an OpenLCB Interface.
MessageHandler * global_message_write_flow()
MessageDispatchFlow * dispatcher()
Node * first_local_node()
Node * next_local_node(NodeID previous)
Iterator helper on the local nodes map.
Performs upon-startup initialization of virtual nodes.
Action entry() OVERRIDE
Entry into the StateFlow activity.
Base class for NMRAnet nodes conforming to the asynchronous interface.
virtual void set_initialized()
Callback from the node initialization flow when the node finished initialization.
StateFlow that iterates through all local nodes and sends out node initialization complete for each o...
Node * nextNode_
Which node to send identify next. If nullptr, we're done.
#define CONSTANT_TRUE
We cannot compare constants to zero, so we use 1 and 2 as constant values for booleans.
#define OVERRIDE
Function attribute for virtual functions declaring that this funciton is overriding a funciton that s...
#define HASSERT(x)
Checks that the value of expression x is true, else terminates the current process.
string node_id_to_buffer(NodeID id)
Convenience function to render a 48-bit NMRAnet node ID into a new buffer.
uint64_t NodeID
48-bit NMRAnet Node ID type
void StartInitializationFlow(Node *node)
Helper function that sends a local virtual node to the static InitializeFlow.
@ MTI_EVENTS_IDENTIFY_ADDRESSED
request identify all of a node's events
@ MTI_INITIALIZATION_COMPLETE
initialization complete
@ WAIT_FOR_LOCAL_LOOPBACK
Specifies that the stack should wait for the local loopback processing before invoking the done notif...
Request to send to instruct InitializeFlow to perform the initialization function of a single virtual...