Last change
on this file since 11713 was
11602,
checked in by swagner, 10 years ago
|
#2205: Continued working on programmable network items
- added VariableStore to all programmable network items
|
File size:
1.4 KB
|
Line | |
---|
1 | using HeuristicLab.Common;
|
---|
2 | using HeuristicLab.Core;
|
---|
3 | using HeuristicLab.Core.Networks;
|
---|
4 | using System;
|
---|
5 | using System.Threading;
|
---|
6 |
|
---|
7 | #region How to use the variable store?
|
---|
8 | // use "Vars" to access variables in the variable store (e.g. Vars.x = 5)
|
---|
9 | // use "Vars[string]" to access variables using runtime strings (e.g. Vars["x"] = 5)
|
---|
10 | // use "Vars.Contains(string)" to check if a variable exists
|
---|
11 | // use "Vars.Clear()" to remove all variables
|
---|
12 | // use "foreach (KeyValuePair<string, object> v in Vars) { ... }" to iterate over all variables
|
---|
13 | // use "Variables" to work with IEnumerable<T> extension methods on the variable store
|
---|
14 | #endregion
|
---|
15 |
|
---|
16 | namespace HeuristicLab.Networks.Programmable {
|
---|
17 | [Item("MyProgrammableNetwork", "A programmable network.")]
|
---|
18 | public class MyProgrammableNetwork : ProgrammableNetwork.CompiledProgrammableNetwork {
|
---|
19 | protected MyProgrammableNetwork(MyProgrammableNetwork original, Cloner cloner) : base(original, cloner) { }
|
---|
20 | public MyProgrammableNetwork(ProgrammableNetwork context) : base(context) { }
|
---|
21 |
|
---|
22 | public override IDeepCloneable Clone(Cloner cloner) {
|
---|
23 | return new MyProgrammableNetwork(this, cloner);
|
---|
24 | }
|
---|
25 |
|
---|
26 | public override void Initialize() {
|
---|
27 | base.Initialize();
|
---|
28 | // implement initialization here
|
---|
29 | }
|
---|
30 |
|
---|
31 | protected override void ProcessMessage(IMessage message, IMessagePort port, CancellationToken token) {
|
---|
32 | // implement processing of messages here
|
---|
33 | }
|
---|
34 | }
|
---|
35 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.