public void DoAbbreviatedSimplePushTest() { PortManagementFacade pmf = Setup(out in0, out in1, out out0, out out1, out facadeIn0, out facadeIn1, out facadeOut0, out facadeOut1, out entryPoint0, out entryPoint1); facadeIn0.WriteAction = InputPortManager.DataWriteAction.Push; facadeIn0.ReadSource = InputPortManager.DataReadSource.BufferOrPull; facadeOut0.ComputeFunction = new Action(() => { facadeOut0.Buffer = facadeIn0.Value; }); facadeIn0.SetDependents(facadeOut0); entryPoint0.OwnerPut("Data0"); entryPoint0.OwnerPut("Data1"); //Console.WriteLine(out0.Take(null) + " taken."); //Console.WriteLine(out0.Take(null) + " taken."); //Console.WriteLine(out1.Take(null) + " taken."); //Console.WriteLine(out1.Take(null) + " taken."); }
public OneInOneOutPushPullTransform(IModel model, string name, string description, Guid guid) { m_output = new SimpleOutputPort(null, "Output", Guid.NewGuid(), this, null, null); m_input = new SimpleInputPort(null, "Input", Guid.NewGuid(), this, null); m_input.PortDataPresented += new PortDataEvent(delegate(object data, IPort where) { Console.WriteLine(data.ToString() + " presented to " + where.Name); }); PortManagementFacade pmf = new PortManagementFacade(this); m_ipm = pmf.ManagerFor(m_input); m_opm = pmf.ManagerFor(m_output); m_ipm.WriteAction = InputPortManager.DataWriteAction.Push; // When a value is written into the input buffer, we push the resultant transform out the output port. m_ipm.DataBufferPersistence = InputPortManager.BufferPersistence.None; // The input buffer is re-read with every pull. m_ipm.ReadSource = InputPortManager.DataReadSource.Pull; // We'll always pull a new value. m_ipm.SetDependents(m_opm); // A new value written to ipm impacts opm. m_opm.ComputeFunction = new Action(ComputeFuction); m_opm.DataBufferPersistence = PortManager.BufferPersistence.None; // Output value is always recomputed. }