Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
09/30/14 02:14:09 (10 years ago)
Author:
swagner
Message:

#2205: Worked on basic infrastructure for optimization networks

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/OptimizationNetworks/HeuristicLab.Optimization.Networks/3.3/InputOutputPort.cs

    r11401 r11406  
    7373    }
    7474
     75    public event EventHandler<OutputInputPortEventArgs<TIn, TOut>> ValueReceived;
     76    protected TOut OnValueReceived(TIn value) {
     77      var args = new OutputInputPortEventArgs<TIn, TOut>(value);
     78      var handler = ValueReceived;
     79      if (handler != null) handler(this, args);
     80      return args.Result;
     81    }
     82
    7583    protected void RegisterOutputInputPortEvents() {
    7684      outputInputPort.ValueSent += OutputInputPort_ValueSent;
     
    7987      outputInputPort.ValueSent -= OutputInputPort_ValueSent;
    8088    }
    81     protected void OutputInputPort_ValueSent(object sender, OutputInputPortEventArgs<TOut> e) {
    82       Value = OutputInputPort.Value;
    83       //TODO: switch threads to decouple value propagation and resulting action
    84       //TODO: clone value?
    85       //TODO: add computed result to event args
     89    protected void OutputInputPort_ValueSent(object sender, OutputInputPortEventArgs<TIn, TOut> e) {
     90      var value = (TIn)e.Value.Clone();
     91      Value = value;
     92      e.Result = OnValueReceived(value);
     93      //DISCUSS: clone value?
     94      //DISCUSS: switch threads to decouple value propagation and resulting action -> should be done in Node?
    8695    }
    8796  }
Note: See TracChangeset for help on using the changeset viewer.