#include <Node.h>
Nodes accept inputs, produce outputs, and are event driven. Each Node keeps track of its own collection of EndpointID's which identify the set of communication endpoints it provides.
All Nodes will be derived from this superclass.
Algorithm for Connection Establishment:
1) Connection data format is established. Both the upstream node(s) and the downstream node(s) have to agree on the FormatModel. For now, this must be exactly the same FormatModel.
2) The Roster sends a message to Nodes to indicate the BufferGroup they will use. I.e., it gives a BufferGroupDescriptor. BufferGroup class methods can be used to map a BufferGroupDescriptor to shared memory. Depending on the amount of data involved in the FormatModel for the BufferGroup, a BufferGroup will not be implemented by shared memory, but just by message passing. I.e., if the FormatModel does not require much memory for each buffer, then message passing without shared memory is a good option.
3) Upstream nodes, in the Node superclass implementation, will keep track of a list of downstream nodes. On every "send" for a broadcast connection, the upstream node will send to that list of downstream nodes. This will be handled through the event looper for the Node. The event looper will have a particular event case which requests it to add a downstream node into a broadcast connection.
Public Member Functions | |
Node () | |
The Node constructor is responsible for registering the Node. | |
virtual | ~Node () |
Protected Member Functions | |
virtual status_t | StartProcessing () |
The event looper for this Node calls this method to initate processing by the Node in response to an event received from the Roster. | |
virtual void | BufferReceived (BufferDescriptor **bd) |
Method called by event looper for the Node when a buffer of data is received for the Node. | |
virtual status_t | StopProcessing () |
In response to an event received from the Roster, the event looper for this Node calls StopProcessing. | |
virtual status_t | GetState (NodeState *state) |
Either Started or Stopped. | |
virtual status_t | GetParameters (muscle::Message *parameters) |
These methods can be called while the Node is Started or Stopped. | |
virtual status_t | SetParameters (muscle::Message parameters) |
virtual status_t | OpenConnection (EndpointID eid, muscle::Message *requestedFormatModel) |
Attempt to open a connection with the node, on a particular communication end point. | |
virtual status_t | CloseConnection (EndpointID eid) |
Private Attributes | |
NodeState | m_nodeState |
|
The Node constructor is responsible for registering the Node. (See the Roster method RegisterNode.) The event looper for the Node will be started once the Node constructor is finished. |
|
|
|
Method called by event looper for the Node when a buffer of data is received for the Node. The buffer will not only contain information for processing by the Node, but also information regarding which Node input it is intended for. Messages that may be sent to a Node:
START_PROCESSING |
|
|
|
These methods can be called while the Node is Started or Stopped. The intent of these methods is to enable the Roster to Get or Set the parameters of the Node. |
|
Either Started or Stopped. It will be Started if StartProcessing has been called (without a call to StopProcessing), and Stopped if StopProcessing has been called (without a call to StartProcessing). |
|
Attempt to open a connection with the node, on a particular communication end point. Connections can only be made between Nodes which are in the Stopped state.
|
|
|
|
The event looper for this Node calls this method to initate processing by the Node in response to an event received from the Roster. Immediately after the event is sent from the Roster to have StartProcessing called, the Roster will indicate the state of the Node is "Starting". After StartProcessing has completed, an event will be sent to the Roster indicating that the Node is Started, and the Roster will reflect this state change. |
|
In response to an event received from the Roster, the event looper for this Node calls StopProcessing. Immediately after this event is sent from the Roster to this Node, the Roster indicates the state of this node is "Stopping". After StopProcessing is finished execution an event is sent to the roster. After this latter event is received by the Roster, the state of this Node indicated by the Roster is Stopped. |
|
|