Changeset 776 for trunk/sources/HeuristicLab.Core/StorableBase.cs
- Timestamp:
- 11/19/08 12:12:39 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Core/StorableBase.cs
r40 r776 26 26 27 27 namespace HeuristicLab.Core { 28 /// <summary> 29 /// The base class for all storable objects. 30 /// </summary> 28 31 public abstract class StorableBase : IStorable { 29 32 private Guid myGuid; 33 /// <summary> 34 /// Gets the Guid of the item. 35 /// </summary> 30 36 public Guid Guid { 31 37 get { return myGuid; } 32 38 } 33 39 40 /// <summary> 41 /// Initializes a new instance of the class <see cref="StorableBase"/> with a new <see cref="Guid"/>. 42 /// </summary> 34 43 protected StorableBase() { 35 44 myGuid = Guid.NewGuid(); 36 45 } 37 46 47 /// <summary> 48 /// Clones the current instance (deep clone). 49 /// </summary> 50 /// <remarks>Uses the <see cref="Auxiliary.Clone"/> method of the class <see cref="Auxiliary"/>.</remarks> 51 /// <returns>The clone.</returns> 38 52 public object Clone() { 39 53 return Auxiliary.Clone(this, new Dictionary<Guid, object>()); 40 54 } 55 /// <summary> 56 /// Clones the current instance with the <see cref="M:Activator.CreateInstance"/> 57 /// method of <see cref="Activator"/>. 58 /// </summary> 59 /// <param name="clonedObjects">All already cloned objects.</param> 60 /// <returns>The clone.</returns> 41 61 public virtual object Clone(IDictionary<Guid, object> clonedObjects) { 42 62 object clone = Activator.CreateInstance(this.GetType()); … … 45 65 } 46 66 67 /// <summary> 68 /// Saves the current instance as <see cref="XmlNode"/> in the specified <paramref name="document"/>. 69 /// </summary> 70 /// <remarks>The type of the current instance is saved as <see cref="XmlAttribute"/> with tag name 71 /// <c>Type</c>, the guid is also saved as an attribute with the tag name <c>GUID</c>.</remarks> 72 /// <param name="name">The (tag)name of the <see cref="XmlNode"/>.</param> 73 /// <param name="document">The <see cref="XmlDocument"/> where to save the data.</param> 74 /// <param name="persistedObjects">The dictionary of all already persisted objects. (Needed to avoid cycles.)</param> 75 /// <returns>The saved <see cref="XmlNode"/>.</returns> 47 76 public virtual XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid,IStorable> persistedObjects) { 48 77 XmlNode node = document.CreateNode(XmlNodeType.Element, name, null); … … 55 84 return node; 56 85 } 86 /// <summary> 87 /// Loads the persisted object from the specified <paramref name="node"/>. 88 /// </summary> 89 /// <remarks>Loads only guid; type,... already loaded by the <see cref="PersistenceManager"/>.</remarks> 90 /// <param name="node">The <see cref="XmlNode"/> where the object is saved.</param> 91 /// <param name="restoredObjects">The dictionary of all already restored objects. 92 /// (Needed to avoid cycles.)</param> 57 93 public virtual void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { 58 94 myGuid = new Guid(node.Attributes["GUID"].Value);
Note: See TracChangeset
for help on using the changeset viewer.