Example #1
0
 public void Connect <TParentProtocol, TChildProtocol>(
     AbstractProtocolHandler <TParentProtocol> parentHandler,
     AbstractProtocolHandler <TChildProtocol> childHandler)
     where TParentProtocol : AbstractProtocol
     where TChildProtocol : AbstractProtocol
 {
     CheckKeyExist("Connect", parentHandler);
     CheckKeyExist("Connect", childHandler);
     AddChild(map[parentHandler], map[childHandler], typeof(TChildProtocol));
 }
Example #2
0
 public void Connect <TParentProtocol>(
     AbstractProtocolHandler <TParentProtocol> parentHandler,
     ProtocolTree childTree)
     where TParentProtocol : AbstractProtocol
 {
     CheckKeyExist("Connect", parentHandler);
     AttachErrorHandler(childTree);
     foreach (var nodekvp in childTree.root.children)
     {
         AddChild(map[parentHandler], nodekvp.Value, nodekvp.Key);
     }
 }
Example #3
0
        public void Register <TProtocol>(AbstractProtocolHandler <TProtocol> protocolHandler)
            where TProtocol : AbstractProtocol
        {
            if (map.ContainsKey(protocolHandler))
            {
                return;
            }
            var treeNode = new ProtocolTreeNode {
                protocolHandler = protocolHandler
            };

            AttachErrorHandler(treeNode);
            map.Add(protocolHandler, treeNode);
            protocolHandler.RequestSendToDownstream += (protocol, data) =>
            {
                protocol.innerObject = data;
                treeNode.PassThrough(protocol);
            };
        }
 public static void ConnectToLeaf <TParentProtocol, TLeafProtocol>(
     this ProtocolTree tree,
     AbstractProtocolHandler <TParentProtocol> parent,
     LeafProtocolHandler <TLeafProtocol> leaf)
     where TParentProtocol : AbstractProtocol
     where TLeafProtocol : LeafDataProtocol => tree.Connect(parent, leaf.helper);
Example #5
0
 public void Entry <TProtocol>(AbstractProtocolHandler <TProtocol> protocolHandler)
     where TProtocol : AbstractProtocol
 {
     CheckKeyExist("Entry", protocolHandler);
     AddChild(root, map[protocolHandler], typeof(TProtocol));
 }