Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/GenericWrapper.cs @ 10778

Last change on this file since 10778 was 9835, checked in by bburlacu, 11 years ago

#1772: Merged remaining trunk changes into the EvolutionaryTracking branch.

File size: 871 bytes
Line 
1using HeuristicLab.Common;
2using HeuristicLab.Core;
3using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
4
5namespace HeuristicLab.EvolutionaryTracking {
6  [Item("Generic wrapper", "Wrapper class for non-item HeuristicLab objects")]
7  [StorableClass]
8  public class GenericWrapper<T> : Item where T : class, IDeepCloneable {
9    [Storable]
10    public T Content { get; private set; }
11
12    public GenericWrapper(T content) {
13      Content = content;
14    }
15
16    [StorableConstructor]
17    private GenericWrapper(bool serializing) : base(serializing) { }
18
19    private GenericWrapper(GenericWrapper<T> original, Cloner cloner)
20      : base(original, cloner) {
21      this.Content = cloner.Clone(Content);
22    }
23
24    public override IDeepCloneable Clone(Cloner cloner) {
25      return new GenericWrapper<T>(this, cloner);
26    }
27  }
28}
Note: See TracBrowser for help on using the repository browser.