Module fbp::fbp_node_network[][src]

Expand description

Node Network

A Flow Based Programming system typically involves both the creation of FBP nodes and using those nodes to form a network. The network is a set of nodes that link to other nodes by sending the output of one node to the input of another node. This relationship forms a directed acyclic graph of nodes.

This network should be represented as a first class object so that the entire network can be manipulated as a single unit. That is part of the job of the types in this file, to gather all of the FBP nodes running for an application into a structure that can be used to treat the network as a single unit.

There is also a need to define a representation of this network so that a set of nodes may be created from this representation to form a network of nodes that is able to perform the necessary processing. While using this representation will simplify using a network of nodes, it should be noted that it is not required to use the Flow Based Programming system in this crate. Thus, the usage of the representation (JSON) to create a network of nodes is controlled by a feature (fbp_network) for which the default is that the feature is not on. To use the representation feature one would add the dependency for this crate using a features parameter:

fbp = { version = “0.1.0”, features = [“fbp_network”] }

This fbp_network feature system uses a JSON representation which is basically a string. This requires that there be a way to create an FBP node from the string name of the node. That is what the make_nodes macro does. It creates an enum NodesEnum that will contain all of the all of the node struct names. The macro also creates an implementation of the NodeCreator trait for the NodesEnum that matches the enum which in turn will create a new node and then returns a clone of the FBPNodeContext struct associated with the Node. Given that all nodes MUST have a Box as one of their fields, the clone will still point to the same underlying struct in memory.

This ability will form the basis of how a network of nodes may be created from a JSON representation.

Structs

NetworkConfiguration

NodeNetwork

NodeNetworkItem