Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/27/09 14:18:39 (16 years ago)
Author:
epitzer
Message:

Convert persistence of Core plugin to new persistence framework. The target framework has been upgraded from 2.0 to 3.5 and events during persistence are not generated anymore. (#603)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Core/3.3/OperatorLibrary.cs

    r1529 r1667  
    2424using System.Text;
    2525using System.Xml;
     26using HeuristicLab.Persistence.Default.Decomposers.Storable;
    2627
    2728namespace HeuristicLab.Core {
     
    3031  /// </summary>
    3132  public class OperatorLibrary : ItemBase, IOperatorLibrary, IEditable {
     33
     34    [Storable]
    3235    private IOperatorGroup myGroup;
    3336    /// <summary>
     
    7376      return clone;
    7477    }
    75 
    76     #region Persistence Methods
    77     /// <summary>
    78     /// Saves the current instance as <see cref="XmlNode"/> in the specified <paramref name="document"/>.
    79     /// </summary>
    80     /// <remarks>Calls <see cref="StorableBase.GetXmlNode"/> of base class <see cref="ItemBase"/>.<br/>
    81     /// The operator group is saved as a child node with the tag name <c>OperatorGroup</c>.</remarks>
    82     /// <param name="name">The (tag)name of the <see cref="XmlNode"/>.</param>
    83     /// <param name="document">The <see cref="XmlDocument"/> where to save the data.</param>
    84     /// <param name="persistedObjects">The dictionary of all already persisted objects.
    85     /// (Needed to avoid cycles.)</param>
    86     /// <returns>The saved <see cref="XmlNode"/>.</returns>
    87     public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid,IStorable> persistedObjects) {
    88       XmlNode node = base.GetXmlNode(name, document, persistedObjects);
    89       node.AppendChild(PersistenceManager.Persist("OperatorGroup", Group, document, persistedObjects));
    90       return node;
    91     }
    92     /// <summary>
    93     /// Loads the persisted operator library from the specified <paramref name="node"/>.
    94     /// </summary>
    95     /// <remarks>Calls <see cref="StorableBase.Populate"/> of base class <see cref="ItemBase"/>.<br/>
    96     /// See <see cref="GetXmlNode"/> for further information on how the data must be saved.</remarks>
    97     /// <param name="node">The <see cref="XmlNode"/> where the operator library is saved.</param>
    98     /// <param name="restoredObjects">The dictionary of all already restored objects.
    99     /// (Needed to avoid cycles.)</param>
    100     public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) {
    101       base.Populate(node, restoredObjects);
    102       myGroup = (IOperatorGroup)PersistenceManager.Restore(node.SelectSingleNode("OperatorGroup"), restoredObjects);
    103     }
    104     #endregion
    10578  }
    10679}
Note: See TracChangeset for help on using the changeset viewer.