Last change
on this file since 584 was
584,
checked in by abeham, 16 years ago
|
merged communication framework to trunk (ticket #279)
|
File size:
1.4 KB
|
Line | |
---|
1 | using System;
|
---|
2 | using System.Collections.Generic;
|
---|
3 | using System.Text;
|
---|
4 | using HeuristicLab.Core;
|
---|
5 | using HeuristicLab.Data;
|
---|
6 | using HeuristicLab.Communication.Data;
|
---|
7 |
|
---|
8 | namespace HeuristicLab.Communication.Operators {
|
---|
9 | public class ProtocolInjector : OperatorBase {
|
---|
10 | public override string Description {
|
---|
11 | get { return "Injects a protocol into the data tree"; }
|
---|
12 | }
|
---|
13 |
|
---|
14 | public ProtocolInjector()
|
---|
15 | : base() {
|
---|
16 | AddVariableInfo(new VariableInfo("Protocol", "The protocol to be used for communication", typeof(Protocol), VariableKind.New));
|
---|
17 | AddVariable(new Variable("Protocol", new Protocol()));
|
---|
18 | AddVariableInfo(new VariableInfo("Dictionary", "The dictionary to translate received variables names", typeof(ItemDictionary<StringData, StringData>), VariableKind.New));
|
---|
19 | AddVariable(new Variable("Dictionary", new ItemDictionary<StringData, StringData>()));
|
---|
20 | }
|
---|
21 |
|
---|
22 | public override IView CreateView() {
|
---|
23 | return new ProtocolInjectorView(this);
|
---|
24 | }
|
---|
25 |
|
---|
26 | public override IOperation Apply(IScope scope) {
|
---|
27 | IDictionary<Guid, object> clonedObjects = new Dictionary<Guid, object>();
|
---|
28 | scope.AddVariable(new Variable(scope.TranslateName("Protocol"), (Protocol)GetVariable("Protocol").Value.Clone(clonedObjects)));
|
---|
29 | scope.AddVariable(new Variable(scope.TranslateName("Dictionary"), (ItemDictionary<StringData, StringData>)GetVariable("Dictionary").Value.Clone()));
|
---|
30 | return null;
|
---|
31 | }
|
---|
32 | }
|
---|
33 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.