Changeset 3016 for trunk/sources/HeuristicLab.Persistence
- Timestamp:
- 03/14/10 00:42:28 (15 years ago)
- Location:
- trunk/sources/HeuristicLab.Persistence/3.3
- Files:
-
- 36 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/sources/HeuristicLab.Persistence/3.3/Auxiliary/TypeExtensions.cs ¶
r1779 r3016 4 4 namespace HeuristicLab.Persistence.Auxiliary { 5 5 6 /// <summary> 7 /// Extension methods for the <see cref="Type"/> class. 8 /// </summary> 6 9 public static class TypeExtensions { 7 10 11 /// <summary> 12 /// Get an assembly qualified name withough version information. 13 /// </summary> 14 /// <param name="type">The type.</param> 15 /// <returns>A full type name without version information.</returns> 8 16 public static string VersionInvariantName(this Type type) { 9 17 return TypeNameParser.Parse(type.AssemblyQualifiedName).ToString(false); -
TabularUnified trunk/sources/HeuristicLab.Persistence/3.3/Auxiliary/TypeName.cs ¶
r3004 r3016 7 7 8 8 namespace HeuristicLab.Persistence.Auxiliary { 9 9 10 10 /// <summary> 11 11 /// Contains a more modular representation of type names that can … … 16 16 public class TypeName { 17 17 18 /// <summary> 19 /// Gets or sets the namespace. 20 /// </summary> 21 /// <value>The namespace.</value> 18 22 [Storable] 19 23 public string Namespace { get; private set; } 20 24 25 /// <summary> 26 /// Gets or sets the name of the class. 27 /// </summary> 28 /// <value>The name of the class.</value> 21 29 [Storable] 22 30 public string ClassName { get; private set; } 23 31 32 /// <summary> 33 /// Gets or sets the generic args. 34 /// </summary> 35 /// <value>The generic args.</value> 24 36 [Storable] 25 37 public List<TypeName> GenericArgs { get; internal set; } 26 38 public bool IsGeneric { get { return GenericArgs.Count > 0; } } 27 39 40 /// <summary> 41 /// Gets or sets the memory magic (point or array declaration). 42 /// </summary> 43 /// <value>The memory magic.</value> 28 44 [Storable] 29 45 public string MemoryMagic { get; internal set; } 30 46 47 /// <summary> 48 /// Gets or sets the name of the assembly. 49 /// </summary> 50 /// <value>The name of the assembly.</value> 31 51 [Storable] 32 52 public string AssemblyName { get; internal set; } 33 53 54 /// <summary> 55 /// Gets or sets the assembly attribues. 56 /// </summary> 57 /// <value>The assembly attribues.</value> 34 58 [Storable] 35 59 public Dictionary<string, string> AssemblyAttribues { get; internal set; } 36 60 61 /// <summary> 62 /// Gets or sets a value indicating whether this instance is reference. 63 /// </summary> 64 /// <value> 65 /// <c>true</c> if this instance is reference; otherwise, <c>false</c>. 66 /// </value> 37 67 [Storable] 38 68 public bool IsReference { get; internal set; } 39 69 70 71 72 /// <summary> 73 /// Initializes a new instance of the <see cref="TypeName"/> class. 74 /// </summary> 75 /// <param name="nameSpace">The namespace.</param> 76 /// <param name="className">Name of the class.</param> 40 77 internal TypeName(string nameSpace, string className) { 41 78 Namespace = nameSpace; … … 46 83 } 47 84 48 /// <param name="full">include assembly properties and generic parameters</param> 85 86 /// <summary> 87 /// Returns a <see cref="System.String"/> that represents this instance. 88 /// </summary> 89 /// <param name="full">if set to <c>true</c> includes full informatoin 90 /// about generic parameters and assembly properties.</param> 91 /// <returns> 92 /// A <see cref="System.String"/> that represents this instance. 93 /// </returns> 49 94 public string ToString(bool full) { 50 95 return ToString(full, true); … … 52 97 53 98 54 /// <param name="full">include assembly properties and generic parameters</param> 99 /// <summary> 100 /// Returns a <see cref="System.String"/> that represents this instance. 101 /// </summary> 102 /// <param name="includeAssembly">if set to <c>true</c> include assembly properties and generic parameters.</param> 103 /// <returns> 104 /// A <see cref="System.String"/> that represents this instance. 105 /// </returns> 55 106 public string ToString(bool full, bool includeAssembly) { 56 107 StringBuilder sb = new StringBuilder(); … … 80 131 } 81 132 133 134 /// <summary> 135 /// Returns a <see cref="System.String"/> that represents this instance. 136 /// </summary> 137 /// <returns> 138 /// A <see cref="System.String"/> that represents this instance. 139 /// </returns> 82 140 public override string ToString() { 83 141 return ToString(true); … … 88 146 /// Lexicographically compare version information and make sure type and assembly 89 147 /// names are identical. This function recursively checks generic type arguments. 90 /// </summary> 148 /// </summary> 149 /// <param name="typeName">Name of the type.</param> 150 /// <returns> 151 /// <c>true</c> if is newer than the specified type name; otherwise, <c>false</c>. 152 /// </returns> 91 153 public bool IsNewerThan(TypeName typeName) { 92 154 try { … … 117 179 /// recursively checks generic type arguments. 118 180 /// </summary> 181 /// <param name="typeName">Name of the type.</param> 182 /// <returns> 183 /// <c>true</c> if the specified type names are compatible; otherwise, <c>false</c>. 184 /// </returns> 119 185 public bool IsCompatible(TypeName typeName) { 120 186 try { -
TabularUnified trunk/sources/HeuristicLab.Persistence/3.3/Auxiliary/TypeNameParser.cs ¶
r3004 r3016 7 7 namespace HeuristicLab.Persistence.Auxiliary { 8 8 9 /// <summary> 10 /// Error during type name parsing, thrown by <see cref="TypeNameParser"/>. 11 /// </summary> 9 12 public class ParseError : Exception { 13 14 /// <summary> 15 /// Initializes a new instance of the <see cref="ParseError"/> class. 16 /// </summary> 17 /// <param name="message">The message.</param> 10 18 public ParseError(string message) : base(message) { } 11 19 } 12 13 20 14 21 /// <summary> 15 22 /// Parse a .NET type name using the following grammar: 16 23 /// 17 /// < para><code>24 /// <code> 18 25 /// TypeSpec := SimpleTypeSpec '&'? 19 /// </code></para>20 26 /// 21 /// <para><code>22 27 /// SimpleTypeSpec := (IDENTIFIER '.')* 23 28 /// (IDENTIFIER '+')* … … 26 31 /// (\*|(\d+\.\.\d+|\d+\.\.\.|(|\*)(,(|\*))∗))* 27 32 /// (',\s*' IDENTIFIER (',\s*' AssemblyProperty)* )? 28 /// </code></para>29 33 /// 30 /// <para><code>31 34 /// Generics := '[' SimpleTypeSpec ']' (',[' SimpleTypeSpec ']') 32 /// </code></para>33 35 /// 34 /// <para><code>35 36 /// AssemblyProperty := 'Version=' Version 36 37 /// | 'PublicKey(Token)?=[a-fA-F0-9]+' 37 38 /// | 'Culture=[a-zA-F0-9]+' 38 /// </code></para>39 39 /// 40 /// <para><code>41 40 /// Version := \d+\.\d+\.\d+\.\d+ 42 /// </code></para>43 41 /// 44 /// <para><code>45 42 /// IDENTIFIER = [_a-zA-Z][_a-ZA-Z0-9]* 46 /// </code> </para>43 /// </code> 47 44 /// </summary> 48 45 public class TypeNameParser { … … 135 132 } 136 133 134 /// <summary> 135 /// Parses the specified typename string as obtained by 136 /// <c>System.Object.GetType().FullName"</c>. 137 /// </summary> 138 /// <param name="s">The typename string.</param> 139 /// <returns>A <see cref="TypeName"/> representing the type name.</returns> 137 140 public static TypeName Parse(string s) { 138 141 TypeNameParser p = new TypeNameParser(s); -
TabularUnified trunk/sources/HeuristicLab.Persistence/3.3/Core/Configuration.cs ¶
r3004 r3016 9 9 /// Defines the set of primitive and composite serializers that are to be used 10 10 /// for a certain seraial format. The configuration can be obtained from the 11 /// <c ode>ConfigurationService</code>.11 /// <c>ConfigurationService</c>. 12 12 /// </summary> 13 13 [StorableClass(StorableClassType.MarkedOnly)] … … 21 21 private readonly Dictionary<Type, ICompositeSerializer> compositeSerializerCache; 22 22 23 /// <summary> 24 /// Gets the format. 25 /// </summary> 26 /// <value>The format.</value> 23 27 [Storable] 24 28 public IFormat Format { get; private set; } … … 28 32 } 29 33 34 /// <summary> 35 /// Initializes a new instance of the <see cref="Configuration"/> class. 36 /// </summary> 37 /// <param name="format">The format.</param> 38 /// <param name="primitiveSerializers">The primitive serializers.</param> 39 /// <param name="compositeSerializers">The composite serializers.</param> 30 40 public Configuration(IFormat format, 31 41 IEnumerable<IPrimitiveSerializer> primitiveSerializers, … … 43 53 } 44 54 55 /// <summary> 56 /// Gets the primitive serializers. 57 /// </summary> 58 /// <value>The primitive serializers.</value> 45 59 public IEnumerable<IPrimitiveSerializer> PrimitiveSerializers { 46 60 get { return primitiveSerializers.Values; } 47 61 } 48 62 63 /// <summary> 64 /// Gets the composite serializers. 65 /// </summary> 66 /// <value>An enumerable of composite serializers.</value> 49 67 public IEnumerable<ICompositeSerializer> CompositeSerializers { 50 68 get { return compositeSerializers; } 51 69 } 52 70 71 /// <summary> 72 /// Gets the primitive serializer. 73 /// </summary> 74 /// <param name="type">The type.</param> 75 /// <returns>The appropriate primitive serializer for the type.</returns> 53 76 public IPrimitiveSerializer GetPrimitiveSerializer(Type type) { 54 77 IPrimitiveSerializer primitiveSerializer; … … 57 80 } 58 81 82 /// <summary> 83 /// Gets the composite serializer for a given type. 84 /// </summary> 85 /// <param name="type">The type.</param> 86 /// <returns>The first matching composite serializer for the type.</returns> 59 87 public ICompositeSerializer GetCompositeSerializer(Type type) { 60 88 if (compositeSerializerCache.ContainsKey(type)) -
TabularUnified trunk/sources/HeuristicLab.Persistence/3.3/Core/ConfigurationService.cs ¶
r3004 r3016 40 40 public List<IFormat> Formats { get; private set; } 41 41 42 /// <summary> 43 /// Gets the singleton instance. 44 /// </summary> 45 /// <value>The singleton instance.</value> 42 46 public static ConfigurationService Instance { 43 47 get { … … 57 61 } 58 62 63 /// <summary> 64 /// Loads the settings. 65 /// </summary> 59 66 public void LoadSettings() { 60 67 LoadSettings(false); 61 68 } 62 69 70 /// <summary> 71 /// Loads the settings. 72 /// </summary> 73 /// <param name="throwOnError">if set to <c>true</c> throw on error.</param> 63 74 public void LoadSettings(bool throwOnError) { 64 75 try { … … 73 84 } 74 85 86 /// <summary> 87 /// Tries to load the settings (i.e custom configurations). 88 /// </summary> 75 89 protected void TryLoadSettings() { 76 90 if (String.IsNullOrEmpty(Properties.Settings.Default.CustomConfigurations) || … … 91 105 } 92 106 107 /// <summary> 108 /// Saves the settings (i.e custom configurations). 109 /// </summary> 93 110 protected void SaveSettings() { 94 111 Serializer serializer = new Serializer( … … 137 154 } 138 155 156 /// <summary> 157 /// Sorts the composite serializers according to their priority. 158 /// </summary> 139 159 protected void SortCompositeSerializers() { 140 160 CompositeSerializers.Sort(new PriortiySorter()); 141 161 } 142 162 163 /// <summary> 164 /// Discovers serializers from an assembly. 165 /// </summary> 166 /// <param name="a">An Assembly.</param> 143 167 protected void DiscoverFrom(Assembly a) { 144 168 try { … … 194 218 /// <summary> 195 219 /// Get the default (automatically discovered) configuration for a certain format. 196 /// </summary> 220 /// </summary> 221 /// <param name="format">The format.</param> 222 /// <returns>The default (auto discovered) configuration.</returns> 197 223 public Configuration GetDefaultConfig(IFormat format) { 198 224 Dictionary<Type, IPrimitiveSerializer> primitiveConfig = new Dictionary<Type, IPrimitiveSerializer>(); … … 218 244 /// Get a configuration for a certain format. This returns a custom configuration 219 245 /// if defined, otherwise returns the default (automatically discovered) configuration. 220 /// </summary> 246 /// </summary> 247 /// <param name="format">The format.</param> 248 /// <returns>A Configuration</returns> 221 249 public Configuration GetConfiguration(IFormat format) { 222 250 if (customConfigurations.ContainsKey(format)) … … 227 255 /// <summary> 228 256 /// Define a new custom configuration for a ceratin format. 229 /// </summary> 257 /// </summary> 258 /// <param name="configuration">The new configuration.</param> 230 259 public void DefineConfiguration(Configuration configuration) { 231 260 customConfigurations[configuration.Format] = configuration; -
TabularUnified trunk/sources/HeuristicLab.Persistence/3.3/Core/DeSerializer.cs ¶
r3005 r3016 71 71 /// that contains information about the serializers to use 72 72 /// for every type and their type ids. 73 /// </summary> 73 /// </summary> 74 /// <param name="typeCache">The type cache.</param> 74 75 public Deserializer( 75 76 IEnumerable<TypeMapping> typeCache) { … … 83 84 } 84 85 85 private Dictionary<Type, object> serializerInstances = new Dictionary<Type, object>(); 86 86 private Dictionary<Type, object> serializerInstances = new Dictionary<Type, object>(); 87 88 /// <summary> 89 /// Adds additionaly type information. 90 /// </summary> 91 /// <param name="typeMapping">The new type mapping.</param> 87 92 public void AddTypeInfo(TypeMapping typeMapping) { 88 93 if (typeIds.ContainsKey(typeMapping.Id)) … … 109 114 /// <summary> 110 115 /// Process the token stream and deserialize an instantate a new object graph. 111 /// </summary> 116 /// </summary> 117 /// <param name="tokens">The tokens.</param> 118 /// <returns>A fresh object filled with fresh data.</returns> 112 119 public object Deserialize(IEnumerable<ISerializationToken> tokens) { 113 120 foreach (ISerializationToken token in tokens) { -
TabularUnified trunk/sources/HeuristicLab.Persistence/3.3/Core/FormatBase.cs ¶
r3004 r3016 9 9 [StorableClass(StorableClassType.Empty)] 10 10 public abstract class FormatBase<SerialDataFormat> : IFormat<SerialDataFormat> where SerialDataFormat : ISerialData { 11 11 12 /// <summary> 13 /// Gets the format's name. 14 /// </summary> 15 /// <value>The format's name.</value> 12 16 public abstract string Name { get; } 13 14 17 15 18 /// <summary> -
TabularUnified trunk/sources/HeuristicLab.Persistence/3.3/Core/GeneratorBase.cs ¶
r3005 r3016 13 13 /// <summary> 14 14 /// Base class for serialization generators. Provides a common entry point 15 /// <c ode>Format</code> and dispatches to different abstract methods for15 /// <c>Format</c> and dispatches to different abstract methods for 16 16 /// every token type. 17 /// </summary> 17 /// </summary> 18 /// <typeparam name="T">The type of the serialization format.</typeparam> 18 19 public abstract class GeneratorBase<T> { 19 20 21 /// <summary> 22 /// Processes a serialization token and formats the specified token. 23 /// </summary> 24 /// <param name="token">The token.</param> 25 /// <returns>An object suitable for serialziation</returns> 20 26 public T Format(ISerializationToken token) { 21 27 Type type = token.GetType(); … … 39 45 } 40 46 47 /// <summary> 48 /// Formats the specified begin token. 49 /// </summary> 50 /// <param name="beginToken">The begin token.</param> 51 /// <returns>The token in serialized form.</returns> 41 52 protected abstract T Format(BeginToken beginToken); 53 54 /// <summary> 55 /// Formats the specified end token. 56 /// </summary> 57 /// <param name="endToken">The end token.</param> 58 /// <returns>The token in serialized form.</returns> 42 59 protected abstract T Format(EndToken endToken); 60 61 /// <summary> 62 /// Formats the specified primitive token. 63 /// </summary> 64 /// <param name="primitiveToken">The primitive token.</param> 65 /// <returns>The token in serialized form.</returns> 43 66 protected abstract T Format(PrimitiveToken primitiveToken); 67 68 /// <summary> 69 /// Formats the specified reference token. 70 /// </summary> 71 /// <param name="referenceToken">The reference token.</param> 72 /// <returns>The token in serialized form.</returns> 44 73 protected abstract T Format(ReferenceToken referenceToken); 74 75 /// <summary> 76 /// Formats the specified null reference token. 77 /// </summary> 78 /// <param name="nullReferenceToken">The null reference token.</param> 79 /// <returns>The token in serialized form.</returns> 45 80 protected abstract T Format(NullReferenceToken nullReferenceToken); 81 82 /// <summary> 83 /// Formats the specified meta info begin token. 84 /// </summary> 85 /// <param name="metaInfoBeginToken">The meta info begin token.</param> 86 /// <returns>The token in serialized form.</returns> 46 87 protected abstract T Format(MetaInfoBeginToken metaInfoBeginToken); 88 89 /// <summary> 90 /// Formats the specified meta info end token. 91 /// </summary> 92 /// <param name="metaInfoEndToken">The meta info end token.</param> 93 /// <returns>The token in serialized form.</returns> 47 94 protected abstract T Format(MetaInfoEndToken metaInfoEndToken); 95 96 /// <summary> 97 /// Formats the specified type token. 98 /// </summary> 99 /// <param name="typeToken">The type token.</param> 100 /// <returns>The token in serialized form.</returns> 48 101 protected abstract T Format(TypeToken typeToken); 49 102 -
TabularUnified trunk/sources/HeuristicLab.Persistence/3.3/Core/PersistenceException.cs ¶
r2106 r3016 8 8 namespace HeuristicLab.Persistence.Core { 9 9 10 /// <summary> 11 /// Exception thrown by components inside the persistence framework. 12 /// </summary> 10 13 [Serializable] 11 14 public class PersistenceException : Exception { 15 16 /// <summary> 17 /// Initializes a new instance of the <see cref="PersistenceException"/> class. 18 /// </summary> 12 19 public PersistenceException() : base() { } 20 21 /// <summary> 22 /// Initializes a new instance of the <see cref="PersistenceException"/> class. 23 /// </summary> 24 /// <param name="message">The message.</param> 13 25 public PersistenceException(string message) : base(message) { } 14 public PersistenceException(string message, Exception innerException) : base(message, innerException) { } 26 27 /// <summary> 28 /// Initializes a new instance of the <see cref="PersistenceException"/> class. 29 /// </summary> 30 /// <param name="message">The message.</param> 31 /// <param name="innerException">The inner exception.</param> 32 public PersistenceException(string message, Exception innerException) : 33 base(message, innerException) { } 34 35 /// <summary> 36 /// Initializes a new instance of the <see cref="PersistenceException"/> class. 37 /// </summary> 38 /// <param name="message">The message.</param> 39 /// <param name="innerExceptions">The inner exceptions.</param> 15 40 public PersistenceException(string message, IEnumerable<Exception> innerExceptions) 16 41 : base(message) { … … 21 46 } 22 47 } 48 49 /// <summary> 50 /// Returns a <see cref="System.String"/> that represents this instance. 51 /// </summary> 52 /// <returns> 53 /// A <see cref="System.String"/> that represents this instance. 54 /// </returns> 55 /// <PermissionSet> 56 /// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" PathDiscovery="*AllFiles*"/> 57 /// </PermissionSet> 23 58 public override string ToString() { 24 59 var sb = new StringBuilder() -
TabularUnified trunk/sources/HeuristicLab.Persistence/3.3/Core/PrimitiveSerializerBase.cs ¶
r3004 r3016 9 9 /// directly to a single datatype and directly produce a serializable object. 10 10 /// </summary> 11 /// <typeparam name="Source">The source type.</typeparam> 12 /// <typeparam name="SerialData">The serialized type.</typeparam> 11 13 [StorableClass(StorableClassType.Empty)] 12 14 public abstract class PrimitiveSerializerBase<Source, SerialData> : … … 14 16 where SerialData : ISerialData { 15 17 18 /// <summary> 19 /// Formats the specified object. 20 /// </summary> 21 /// <param name="o">The object.</param> 22 /// <returns>A serialized version of the object.</returns> 16 23 public abstract SerialData Format(Source o); 17 24 18 public abstract Source Parse(SerialData t); 25 /// <summary> 26 /// Parses the specified serialized data back into an object. 27 /// </summary> 28 /// <param name="t">The serial data.</param> 29 /// <returns>A newly created object representing the serialized data.</returns> 30 public abstract Source Parse(SerialData data); 19 31 32 /// <summary> 33 /// Gets the type of the serial data. 34 /// </summary> 35 /// <value>The type of the serial data.</value> 20 36 public Type SerialDataType { get { return typeof(SerialData); } } 21 37 38 /// <summary> 39 /// Gets the type of the source. 40 /// </summary> 41 /// <value>The type of the source.</value> 22 42 public Type SourceType { get { return typeof(Source); } } 23 43 44 /// <summary> 45 /// Formats the specified object. 46 /// </summary> 47 /// <param name="o">The object.</param> 48 /// <returns>A serialized version of the object.</returns> 24 49 ISerialData IPrimitiveSerializer.Format(object o) { 25 50 return Format((Source)o); 26 51 } 27 52 53 /// <summary> 54 /// Parses the specified serialized data back into an object. 55 /// </summary> 56 /// <param name="t">The serial data.</param> 57 /// <returns>A newly created object representing the serialized data.</returns> 28 58 object IPrimitiveSerializer.Parse(ISerialData o) { 29 59 return Parse((SerialData)o); 30 60 } 31 61 62 /// <summary> 63 /// Returns a <see cref="System.String"/> that represents this instance. 64 /// </summary> 65 /// <returns> 66 /// A <see cref="System.String"/> that represents this instance. 67 /// </returns> 32 68 public override string ToString() { 33 69 return new StringBuilder() -
TabularUnified trunk/sources/HeuristicLab.Persistence/3.3/Core/Serializer.cs ¶
r3007 r3016 51 51 private readonly List<Exception> exceptions; 52 52 53 /// <summary> 54 /// Gets or sets a value indicating whether to interleave type information 55 /// while serializing an object. 56 /// 57 /// Alternatively the type information can be obtained through the 58 /// <see cref="TypeCache"/> Property after serialization is done. 59 /// </summary> 60 /// <value> 61 /// <c>true</c> if type information should be interleaved; otherwise, <c>false</c>. 62 /// </value> 53 63 public bool InterleaveTypeInformation { get; set; } 54 64 … … 56 66 /// Contains a mapping of type id to type and serializer. 57 67 /// </summary> 68 /// <value>The type cache.</value> 58 69 public List<TypeMapping> TypeCache { 59 70 get { … … 99 110 requiredFiles = new List<string>(files.Keys); 100 111 } 101 112 113 /// <summary> 114 /// Initializes a new instance of the <see cref="Serializer"/> class. 115 /// </summary> 116 /// <param name="obj">The object to serialize.</param> 117 /// <param name="configuration">The configuration.</param> 102 118 public Serializer(object obj, Configuration configuration) : 103 119 this(obj, configuration, "ROOT") { } 104 120 121 /// <summary> 122 /// Initializes a new instance of the <see cref="Serializer"/> class. 123 /// </summary> 124 /// <param name="obj">The object to serialize.</param> 125 /// <param name="configuration">The configuration.</param> 126 /// <param name="rootName">Name of the root token.</param> 105 127 public Serializer(object obj, Configuration configuration, string rootName) 106 128 : this(obj, configuration, rootName, false) { } 107 129 130 /// <summary> 131 /// Initializes a new instance of the <see cref="Serializer"/> class. 132 /// </summary> 133 /// <param name="obj">The object to serialize.</param> 134 /// <param name="configuration">The configuration.</param> 135 /// <param name="rootName">Name of the root token.</param> 108 136 /// <param name="isTestRun">Try to complete the whole object graph, 109 137 /// don't stop at the first exception</param> … … 119 147 } 120 148 149 /// <summary> 150 /// Returns an enumerator that iterates through a collection. 151 /// </summary> 152 /// <returns> 153 /// An <see cref="T:System.Collections.IEnumerator"/> object that can be used to 154 /// iterate through the collection. 155 /// </returns> 121 156 IEnumerator IEnumerable.GetEnumerator() { 122 157 return GetEnumerator(); 123 158 } 124 159 160 /// <summary> 161 /// Returns an enumerator that iterates through the serialization tokens. 162 /// </summary> 163 /// <returns> 164 /// A <see cref="T:System.Collections.Generic.IEnumerator`1"/> that can be used to 165 /// iterate through serialization tokens. 166 /// </returns> 125 167 public IEnumerator<ISerializationToken> GetEnumerator() { 126 168 var enumerator = Serialize(new DataMemberAccessor(rootName, null, () => obj, null)); … … 267 309 yield return new EndToken(name, typeId, id); 268 310 } 269 270 311 } 271 272 273 312 } -
TabularUnified trunk/sources/HeuristicLab.Persistence/3.3/Core/Tag.cs ¶
r3004 r3016 8 8 /// </summary> 9 9 public class Tag { 10 11 /// <summary> 12 /// Gets the name. 13 /// </summary> 14 /// <value>The name.</value> 10 15 public string Name { get; private set; } 16 17 /// <summary> 18 /// Gets the value. 19 /// </summary> 20 /// <value>The value.</value> 11 21 public object Value { get; set; } 12 22 23 /// <summary> 24 /// Initializes a new instance of the <see cref="Tag"/> class. 25 /// </summary> 26 /// <param name="name">The name.</param> 27 /// <param name="value">The value.</param> 13 28 public Tag(string name, object value) { 14 29 Name = name; … … 16 31 } 17 32 33 /// <summary> 34 /// Initializes a new instance of the <see cref="Tag"/> class 35 /// whithout a name. 36 /// </summary> 37 /// <param name="value">The value.</param> 18 38 public Tag(object value) { 19 39 Name = null; -
TabularUnified trunk/sources/HeuristicLab.Persistence/3.3/Core/Tokens/BeginToken.cs ¶
r3004 r3016 8 8 /// </summary> 9 9 public class BeginToken : CompositeTokenBase { 10 11 /// <summary> 12 /// Initializes a new instance of the <see cref="BeginToken"/> class. 13 /// </summary> 14 /// <param name="name">The token name.</param> 15 /// <param name="typeId">The type id.</param> 16 /// <param name="id">The object id.</param> 10 17 public BeginToken(string name, int typeId, int? id) : base(name, typeId, id) { } 11 18 } -
TabularUnified trunk/sources/HeuristicLab.Persistence/3.3/Core/Tokens/CompositeTokenBase.cs ¶
r3004 r3016 3 3 4 4 /// <summary> 5 /// Common base class of <c ode>BeginToken</code> and <code>EndToken</code>5 /// Common base class of <c>BeginToken</c> and <c>EndToken</c> 6 6 /// that surround a composite element. 7 7 /// </summary> 8 8 public abstract class CompositeTokenBase : SerializationTokenBase { 9 10 /// <summary> 11 /// The type's id. 12 /// </summary> 9 13 public readonly int TypeId; 14 15 16 /// <summary> 17 /// The object's id for references in case it is a reference type. 18 /// </summary> 10 19 public readonly int? Id; 20 21 /// <summary> 22 /// Initializes a new instance of the <see cref="CompositeTokenBase"/> class. 23 /// </summary> 24 /// <param name="name">The name.</param> 25 /// <param name="typeId">The type id.</param> 26 /// <param name="id">The object id.</param> 11 27 public CompositeTokenBase(string name, int typeId, int? id) 12 28 : base(name) { -
TabularUnified trunk/sources/HeuristicLab.Persistence/3.3/Core/Tokens/EndToken.cs ¶
r3004 r3016 7 7 /// </summary> 8 8 public class EndToken : CompositeTokenBase { 9 10 /// <summary> 11 /// Initializes a new instance of the <see cref="EndToken"/> class. 12 /// </summary> 13 /// <param name="name">The name.</param> 14 /// <param name="typeId">The type id.</param> 15 /// <param name="id">The object id.</param> 9 16 public EndToken(string name, int typeId, int? id) : base(name, typeId, id) { } 10 17 } -
TabularUnified trunk/sources/HeuristicLab.Persistence/3.3/Core/Tokens/MetaInfoBeginToken.cs ¶
r3004 r3016 2 2 3 3 namespace HeuristicLab.Persistence.Core.Tokens { 4 4 5 /// <summary> 6 /// Start of meta information. 7 /// </summary> 5 8 public class MetaInfoBeginToken : ISerializationToken { } 6 9 -
TabularUnified trunk/sources/HeuristicLab.Persistence/3.3/Core/Tokens/MetaInfoEndToken.cs ¶
r1566 r3016 3 3 namespace HeuristicLab.Persistence.Core.Tokens { 4 4 5 /// <summary> 6 /// End of meta info. 7 /// </summary> 5 8 public class MetaInfoEndToken : ISerializationToken { } 6 9 -
TabularUnified trunk/sources/HeuristicLab.Persistence/3.3/Core/Tokens/NulLReferenceToken.cs ¶
r3004 r3016 2 2 3 3 namespace HeuristicLab.Persistence.Core.Tokens { 4 4 5 /// <summary> 6 /// Describes a reference to <c>null</c>. 7 /// </summary> 5 8 public class NullReferenceToken : SerializationTokenBase { 9 10 /// <summary> 11 /// Initializes a new instance of the <see cref="NullReferenceToken"/> class. 12 /// </summary> 13 /// <param name="name">The token name.</param> 6 14 public NullReferenceToken(string name) : base(name) { } 7 15 } -
TabularUnified trunk/sources/HeuristicLab.Persistence/3.3/Core/Tokens/PrimitiveToken.cs ¶
r3004 r3016 7 7 /// </summary> 8 8 public class PrimitiveToken : SerializationTokenBase { 9 10 /// <summary> 11 /// The type's id. 12 /// </summary> 9 13 public readonly int TypeId; 14 15 /// <summary> 16 /// The object's id. 17 /// </summary> 10 18 public readonly int? Id; 19 20 /// <summary> 21 /// The serialized data. 22 /// </summary> 11 23 public readonly ISerialData SerialData; 24 25 /// <summary> 26 /// Initializes a new instance of the <see cref="PrimitiveToken"/> class. 27 /// </summary> 28 /// <param name="name">The name.</param> 29 /// <param name="typeId">The type's id.</param> 30 /// <param name="id">The onbject's id.</param> 31 /// <param name="serialData">The serialized data.</param> 12 32 public PrimitiveToken(string name, int typeId, int? id, ISerialData serialData) 13 33 : base(name) { -
TabularUnified trunk/sources/HeuristicLab.Persistence/3.3/Core/Tokens/ReferenceToken.cs ¶
r3004 r3016 8 8 /// </summary> 9 9 public class ReferenceToken : SerializationTokenBase { 10 /// <summary> 11 /// The refereced object's id. 12 /// </summary> 10 13 public readonly int Id; 14 15 /// <summary> 16 /// Initializes a new instance of the <see cref="ReferenceToken"/> class. 17 /// </summary> 18 /// <param name="name">The name.</param> 19 /// <param name="id">The referenced object's id.</param> 11 20 public ReferenceToken(string name, int id) 12 21 : base(name) { -
TabularUnified trunk/sources/HeuristicLab.Persistence/3.3/Core/Tokens/SerializationTokenBase.cs ¶
r3004 r3016 4 4 5 5 namespace HeuristicLab.Persistence.Core.Tokens { 6 6 7 /// <summary> 8 /// Common base class for all serialization tokens. 9 /// </summary> 7 10 public abstract class SerializationTokenBase : ISerializationToken { 11 12 /// <summary> 13 /// The token's name. 14 /// </summary> 8 15 public readonly string Name; 16 17 /// <summary> 18 /// Initializes a new instance of the <see cref="SerializationTokenBase"/> class. 19 /// </summary> 20 /// <param name="name">The token name.</param> 9 21 public SerializationTokenBase(string name) { 10 22 Name = name; 11 23 } 24 25 /// <summary> 26 /// Returns a <see cref="System.String"/> that represents this instance. 27 /// </summary> 28 /// <returns> 29 /// A <see cref="System.String"/> that represents this instance. 30 /// </returns> 12 31 public override string ToString() { 13 32 StringBuilder sb = new StringBuilder(); -
TabularUnified trunk/sources/HeuristicLab.Persistence/3.3/Core/Tokens/TypeToken.cs ¶
r3005 r3016 7 7 namespace HeuristicLab.Persistence.Core.Tokens { 8 8 9 /// <summary> 10 /// A token containing type information and mapping. 11 /// </summary> 9 12 public class TypeToken : ISerializationToken { 13 14 /// <summary> 15 /// The type id. 16 /// </summary> 10 17 public readonly int Id; 18 19 /// <summary> 20 /// The type's full name. 21 /// </summary> 11 22 public readonly string TypeName; 23 24 /// <summary> 25 /// The full type name of the serialized used to 26 /// serialize the type. 27 /// </summary> 12 28 public readonly string Serializer; 13 29 30 /// <summary> 31 /// Initializes a new instance of the <see cref="TypeToken"/> class. 32 /// </summary> 33 /// <param name="id">The type id.</param> 34 /// <param name="typeName">Full name of the type.</param> 35 /// <param name="serializer">The full name of the serializer 36 /// used to serialize the type.</param> 14 37 public TypeToken(int id, string typeName, string serializer) { 15 38 Id = id; -
TabularUnified trunk/sources/HeuristicLab.Persistence/3.3/Core/TypeMapping.cs ¶
r3004 r3016 8 8 public class TypeMapping { 9 9 10 /// <summary> 11 /// The type's id. 12 /// </summary> 10 13 public readonly int Id; 14 15 /// <summary> 16 /// The type's full name. 17 /// </summary> 11 18 public readonly string TypeName; 19 20 21 /// <summary> 22 /// The full name of the serializes used to serialize the 23 /// <see cref="TypeName"/>. 24 /// </summary> 12 25 public readonly string Serializer; 13 26 27 /// <summary> 28 /// Initializes a new instance of the <see cref="TypeMapping"/> class. 29 /// </summary> 30 /// <param name="id">The type's id.</param> 31 /// <param name="typeName">The type's full name.</param> 32 /// <param name="serializer">The full name of the serializer use to 33 /// serialize this type.</param> 14 34 public TypeMapping(int id, string typeName, string serializer) { 15 35 Id = id; … … 18 38 } 19 39 40 /// <summary> 41 /// Creates a dictionary that conatins all properties 42 /// and values of this instance. 43 /// </summary> 44 /// <returns>A dictionary containing all properties 45 /// and values of this instance.</returns> 20 46 public Dictionary<string, object> GetDict() { 21 47 return new Dictionary<string, object> { -
TabularUnified trunk/sources/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable/DataMemberAccessor.cs ¶
r3004 r3016 12 12 public class DataMemberAccessor { 13 13 14 /// <summary> 15 /// The function to get the value of the data member. 16 /// </summary> 14 17 public readonly Func<object> Get; 18 19 /// <summary> 20 /// The function to set the value of the data member. 21 /// </summary> 15 22 public readonly Action<object> Set; 23 24 /// <summary> 25 /// The name of the data member. 26 /// </summary> 16 27 public readonly string Name; 28 29 /// <summary> 30 /// The default value of the data member, can remain <c>null</c> 31 /// if no default value. If left null, this will also leave the 32 /// default value for value types (e.g. 0 for <c>int</c>). 33 /// </summary> 17 34 public readonly object DefaultValue; 18 35 19 36 20 37 /// <summary> 21 /// Create a DataMemberAccessor from a FieldInfo or PropertyInfo for the give object. 38 /// Create a <see cref="DataMemberAccessor"/> from a FieldInfo or 39 /// PropertyInfo for the give object. 22 40 /// </summary> 41 /// <param name="memberInfo">The member info.</param> 42 /// <param name="name">The name.</param> 43 /// <param name="defaultvalue">The defaultvalue.</param> 44 /// <param name="obj">The object.</param> 23 45 public DataMemberAccessor(MemberInfo memberInfo, string name, object defaultvalue, object obj) { 24 46 Name = name; … … 45 67 /// Wrap existing getter and setter functions. 46 68 /// </summary> 69 /// <param name="name">The name.</param> 70 /// <param name="defaultValue">The default value.</param> 71 /// <param name="getter">The getter.</param> 72 /// <param name="setter">The setter.</param> 47 73 public DataMemberAccessor(string name, object defaultValue, 48 74 Func<object> getter, Action<object> setter) { … … 52 78 Set = setter; 53 79 } 54 80 55 81 /// <summary> 56 82 /// Create an empty accessor that just encapsulates an object 57 83 /// without access. 58 84 /// </summary> 85 /// <param name="o">The object</param> 59 86 public DataMemberAccessor(object o) { 60 87 Name = null; … … 68 95 /// without access. 69 96 /// </summary> 97 /// <param name="o">The object</param> 98 /// <param name="name">The object's name.</param> 70 99 public DataMemberAccessor(object o, string name) { 71 100 Name = name; … … 75 104 } 76 105 106 /// <summary> 107 /// Returns a <see cref="System.String"/> that represents this instance. 108 /// </summary> 109 /// <returns> 110 /// A <see cref="System.String"/> that represents this instance. 111 /// </returns> 77 112 public override string ToString() { 78 113 return String.Format("DataMemberAccessor({0}, {1}, {2}, {3})", -
TabularUnified trunk/sources/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable/StorableAttribute.cs ¶
r2994 r3016 9 9 10 10 /// <summary> 11 /// Mark the member of a class to be considered by the <c ode>StorableSerializer</code>.12 /// The class must be marked as <c ode>[StorableClass(StorableClassType.Empty)]</code> and the13 /// <c ode>StorableClassType</code> should be set to <code>MarkedOnly</code> for11 /// Mark the member of a class to be considered by the <c>StorableSerializer</c>. 12 /// The class must be marked as <c>[StorableClass(StorableClassType.Empty)]</c> and the 13 /// <c>StorableClassType</c> should be set to <c>MarkedOnly</c> for 14 14 /// this attribute to kick in. 15 15 /// </summary> … … 22 22 /// <summary> 23 23 /// An optional name for this member that will be used during serialization. 24 ///25 24 /// This allows to rename a field/property in code but still be able to read 26 25 /// the old serialized format. 27 26 /// </summary> 27 /// <value>The name.</value> 28 28 public string Name { get; set; } 29 29 … … 34 34 /// deserialization. 35 35 /// </summary> 36 /// <value>The default value.</value> 36 37 public object DefaultValue { get; set; } 37 38 39 /// <summary> 40 /// Returns a <see cref="System.String"/> that represents this instance. 41 /// </summary> 42 /// <returns> 43 /// A <see cref="System.String"/> that represents this instance. 44 /// </returns> 38 45 public override string ToString() { 39 46 StringBuilder sb = new StringBuilder(); … … 60 67 BindingFlags.DeclaredOnly; 61 68 69 /// <summary> 70 /// Encapsulate information about storable members of a class 71 /// that have the storable attribute set. 72 /// </summary> 62 73 public sealed class StorableMemberInfo { 74 75 /// <summary> 76 /// Gets the [Storable] attribute itself. 77 /// </summary> 78 /// <value>The [Storable] attribute.</value> 63 79 public StorableAttribute Attribute { get; private set; } 80 81 /// <summary> 82 /// Gets the .NET reflection MemberInfo. 83 /// </summary> 84 /// <value>The member info.</value> 64 85 public MemberInfo MemberInfo { get; private set; } 86 87 88 /// <summary> 89 /// Gets disentangled name (i.e. unique access name regardless of 90 /// type hierarchy. 91 /// </summary> 92 /// <value>The disentangled name.</value> 65 93 public string DisentangledName { get; private set; } 94 95 96 /// <summary> 97 /// Gets the fully qualified member name. 98 /// </summary> 99 /// <value>The the fully qualified member name.</value> 66 100 public string FullyQualifiedMemberName { 67 101 get { … … 73 107 } 74 108 } 75 public StorableMemberInfo(StorableAttribute attribute, MemberInfo memberInfo) { 109 110 internal StorableMemberInfo(StorableAttribute attribute, MemberInfo memberInfo) { 76 111 this.Attribute = attribute; 77 112 this.MemberInfo = memberInfo; 78 113 } 114 115 /// <summary> 116 /// Returns a <see cref="System.String"/> that represents this instance. 117 /// </summary> 118 /// <returns> 119 /// A <see cref="System.String"/> that represents this instance. 120 /// </returns> 79 121 public override string ToString() { 80 122 return new StringBuilder() … … 82 124 .Append(MemberInfo).Append('}').ToString(); 83 125 } 84 public void SetDisentangledName(string name) { 126 127 internal void SetDisentangledName(string name) { 85 128 DisentangledName = Attribute.Name ?? name; 86 129 } 130 131 /// <summary> 132 /// Gets the delcaring type of the property. 133 /// </summary> 134 /// <returns></returns> 87 135 public Type GetPropertyDeclaringBaseType() { 88 136 return ((PropertyInfo)MemberInfo).GetGetMethod(true).GetBaseDefinition().DeclaringType; … … 90 138 } 91 139 92 sealed class TypeQuery {140 private sealed class TypeQuery { 93 141 public Type Type { get; private set; } 94 142 public bool Inherited { get; private set; } … … 99 147 } 100 148 101 sealed class MemberCache : Dictionary<TypeQuery, IEnumerable<StorableMemberInfo>> { }149 private sealed class MemberCache : Dictionary<TypeQuery, IEnumerable<StorableMemberInfo>> { } 102 150 103 151 private static MemberCache memberCache = new MemberCache(); … … 106 154 /// <summary> 107 155 /// Get all fields and properties of a class that have the 108 /// <code>[Storable]</code> attribute set. 109 /// </summary> 156 /// <c>[Storable]</c> attribute set. 157 /// </summary> 158 /// <param name="type">The type.</param> 159 /// <returns>An enumerable of StorableMemberInfos.</returns> 110 160 public static IEnumerable<StorableMemberInfo> GetStorableMembers(Type type) { 111 161 return GetStorableMembers(type, true); … … 114 164 /// <summary> 115 165 /// Get all fields and properties of a class that have the 116 /// <code>[Storable]</code> attribute set. 117 /// </summary> 118 /// <param name="inherited">should storable members from base classes be included</param> 166 /// <c>[Storable]</c> attribute set. 167 /// </summary> 168 /// <param name="type">The type.</param> 169 /// <param name="inherited">should storable members from base classes be included</param> 170 /// <returns>An enumerable of StorableMemberInfos</returns> 119 171 public static IEnumerable<StorableMemberInfo> GetStorableMembers(Type type, bool inherited) { 120 172 lock (memberCache) { … … 144 196 /// Get the associated accessors for all storable memebrs. 145 197 /// </summary> 146 /// <param name="obj"> </param>147 /// <returns> </returns>198 /// <param name="obj">The object</param> 199 /// <returns>An enumerable of storable accessors.</returns> 148 200 public static IEnumerable<DataMemberAccessor> GetStorableAccessors(object obj) { 149 201 foreach (var memberInfo in GetStorableMembers(obj.GetType())) -
TabularUnified trunk/sources/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable/StorableClassAttribute.cs ¶
r2994 r3016 48 48 49 49 /// <summary> 50 /// Mark a class to be considered by the <c ode>StorableSerializer</code>.50 /// Mark a class to be considered by the <c>StorableSerializer</c>. 51 51 /// </summary> 52 52 [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] … … 60 60 61 61 /// <summary> 62 /// Mark a class to be serialize by the <c ode>StorableSerizlier</code>62 /// Mark a class to be serialize by the <c>StorableSerizlier</c> 63 63 /// </summary> 64 64 public StorableClassAttribute(StorableClassType type) { … … 70 70 /// or conatins proper parameterization through the storable attribute. 71 71 /// </summary> 72 /// <param name="type"></param> 73 /// <param name="recusrive"></param> 74 /// <returns></returns> 72 /// <param name="type">The type.</param> 73 /// <param name="recusrive">if set to <c>true</c> recusrively checks class hierarchy.</param> 74 /// <returns> 75 /// <c>true</c> if the specified type is a storable type; otherwise, <c>false</c>. 76 /// </returns> 75 77 public static bool IsStorableType(Type type, bool recusrive) { 76 78 if (IsEmptyType(type, recusrive)) … … 91 93 92 94 95 /// <summary> 96 /// Determines whether the specified type has no fields or properties except 97 /// readonly properties or constant fields. 98 /// </summary> 99 /// <param name="type">The type.</param> 100 /// <param name="recursive">if set to <c>true</c> recursively check class hierarchy.</param> 101 /// <returns> 102 /// <c>true</c> if the specified type is empty; otherwise, <c>false</c>. 103 /// </returns> 93 104 public static bool IsEmptyType(Type type, bool recursive) { 94 105 foreach (MemberInfo memberInfo in type.GetMembers(allDeclaredMembers)) { -
TabularUnified trunk/sources/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable/StorableConstructorAttribute.cs ¶
r2994 r3016 11 11 /// <summary> 12 12 /// Indicate that this constructor should be used instead of the default constructor 13 /// when the <c ode>StorableSerializer</code> instantiates this class during13 /// when the <c>StorableSerializer</c> instantiates this class during 14 14 /// deserialization. 15 15 /// 16 /// The constructor must take exactly one <c ode>bool</code> argument that will be17 /// set to <c ode>true</code> during deserialization.16 /// The constructor must take exactly one <c>bool</c> argument that will be 17 /// set to <c>true</c> during deserialization. 18 18 /// </summary> 19 19 [AttributeUsage(AttributeTargets.Constructor, Inherited = false, AllowMultiple = false)] … … 28 28 29 29 /// <summary> 30 /// Get a designated storable constructor for a type or <code>null</code>. 31 /// </summary> 30 /// Get a designated storable constructor for a type or <c>null</c>. 31 /// </summary> 32 /// <param name="type">The type.</param> 33 /// <returns>The <see cref="ConstructorInfo"/> of the storable constructor or <c>null</c></returns> 32 34 public static ConstructorInfo GetStorableConstructor(Type type) { 33 35 lock (constructorCache) { -
TabularUnified trunk/sources/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable/StorableHookAttribute.cs ¶
r3010 r3016 16 16 /// <summary> 17 17 /// Mark methods that should be called at certain times during 18 /// serialization/deserialization by the <c ode>StorableSerializer</code>.18 /// serialization/deserialization by the <c>StorableSerializer</c>. 19 19 /// </summary> 20 20 [AttributeUsage(AttributeTargets.Method, Inherited = false, AllowMultiple = true)] … … 32 32 33 33 private readonly HookType hookType; 34 /// <summary> 35 /// Gets the type of the hook. 36 /// </summary> 37 /// <value>The type of the hook.</value> 34 38 public HookType HookType { 35 39 get { return hookType; } … … 38 42 39 43 /// <summary> 40 /// Mark method as <c ode>StorableSerializer</code> hook to be run41 /// at the <c ode>HookType</code> time.44 /// Mark method as <c>StorableSerializer</c> hook to be run 45 /// at the <c>HookType</c> time. 42 46 /// </summary> 43 /// <param name="hookType"> </param>47 /// <param name="hookType">Type of the hook.</param> 44 48 public StorableHookAttribute(HookType hookType) { 45 49 this.hookType = hookType; … … 56 60 57 61 /// <summary> 58 /// Invoke <code>hookType</code> hook on <code>obj</code>. 59 /// </summary> 62 /// Invoke <c>hookType</c> hook on <c>obj</c>. 63 /// </summary> 64 /// <param name="hookType">Type of the hook.</param> 65 /// <param name="obj">The object.</param> 60 66 public static void InvokeHook(HookType hookType, object obj) { 61 67 if (obj == null) -
TabularUnified trunk/sources/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable/StorableSerializer.cs ¶
r2994 r3016 11 11 /// <summary> 12 12 /// Intended for serialization of all custom classes. Classes should have the 13 /// <c ode>[StorableClass(StorableClassType.Empty)]</code> attribute set and a serialization mode set.13 /// <c>[StorableClass(StorableClassType.Empty)]</c> attribute set and a serialization mode set. 14 14 /// Optionally selected fields and properties can be marked with the 15 /// <c ode>[Storable]</code> attribute.15 /// <c>[Storable]</c> attribute. 16 16 /// </summary> 17 17 [StorableClass(StorableClassType.Empty)] -
TabularUnified trunk/sources/HeuristicLab.Persistence/3.3/Default/DebugString/DebugString.cs ¶
r3002 r3016 9 9 10 10 namespace HeuristicLab.Persistence.Default.DebugString { 11 11 12 /// <summary> 13 /// Simple write-only format for debugging purposes. 14 /// </summary> 12 15 [StorableClass(StorableClassType.MarkedOnly)] 13 16 public class DebugString : ISerialData { 14 17 18 /// <summary> 19 /// Gets or sets the data. 20 /// </summary> 21 /// <value>The data.</value> 15 22 [Storable] 16 23 public string Data { get; set; } … … 18 25 private DebugString() { } 19 26 27 /// <summary> 28 /// Initializes a new instance of the <see cref="DebugString"/> class. 29 /// </summary> 30 /// <param name="s">The string.</param> 20 31 public DebugString(string s) { 21 32 Data = s; -
TabularUnified trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/XmlFormat.cs ¶
r2994 r3016 5 5 namespace HeuristicLab.Persistence.Default.Xml { 6 6 7 /// <summary> 8 /// A simple XML format, that can be used to either stream 9 /// or save to a file. 10 /// </summary> 7 11 [StorableClass(StorableClassType.Empty)] 8 12 public class XmlFormat : FormatBase<XmlString> { -
TabularUnified trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/XmlGenerator.cs ¶
r3005 r3016 33 33 34 34 35 /// <summary> 36 /// Initializes a new instance of the <see cref="XmlGenerator"/> class. 37 /// </summary> 35 38 public XmlGenerator() { 36 39 Depth = 0; … … 198 201 /// Serialize an object into a file. 199 202 /// 200 /// The XML configuration is obtained from the <c ode>ConfigurationService</code>.203 /// The XML configuration is obtained from the <c>ConfigurationService</c>. 201 204 /// The file is actually a ZIP file. 202 205 /// Compression level is set to 5 and needed assemblies are not included. … … 209 212 /// Serialize an object into a file. 210 213 /// 211 /// The XML configuration is obtained from the <c ode>ConfigurationService</code>.214 /// The XML configuration is obtained from the <c>ConfigurationService</c>. 212 215 /// Needed assemblies are not included. 213 216 /// </summary> -
TabularUnified trunk/sources/HeuristicLab.Persistence/3.3/HeuristicLabPersistencePlugin.cs.frame ¶
r2754 r3016 3 3 namespace HeuristicLab.Persistence { 4 4 5 /// <summary> 6 /// The plugin for HeuriticLab.Persistence 7 /// </summary> 5 8 [Plugin("HeuristicLab.Persistence", "3.3.0.$WCREV$")] 6 9 [PluginFile("HeuristicLab.Persistence-3.3.dll", PluginFileType.Assembly)] -
TabularUnified trunk/sources/HeuristicLab.Persistence/3.3/Interfaces/ICompositeSerializer.cs ¶
r2993 r3016 5 5 namespace HeuristicLab.Persistence.Interfaces { 6 6 7 /// <summary> 8 /// A composite serializer does not directly transform an object into its 9 /// serialized form. It merely decomposes into other objects, that can 10 /// later be used to recompose the same object. 11 /// </summary> 7 12 public interface ICompositeSerializer { 8 13 9 14 /// <summary> 10 15 /// Defines the Priorty of this composite serializer. Higher number means 11 /// higher prioriy. Negative numbers are fallback serializers. 16 /// higher prioriy. Negative numbers are fallback serializers that are 17 /// disabled by default. 18 /// 12 19 /// All default generic composite serializers have priority 100. Specializations 13 20 /// have priority 200 so they will be tried first. Priorities are … … 18 25 /// <summary> 19 26 /// Determines for every type whether the composite serializer is applicable. 20 /// </summary> 27 /// </summary> 28 /// <param name="type">The type.</param> 29 /// <returns> 30 /// <c>true</c> if this instance can serialize the specified type; otherwise, <c>false</c>. 31 /// </returns> 21 32 bool CanSerialize(Type type); 22 33 … … 25 36 /// ICompositeSerializer. 26 37 /// </summary> 38 /// <param name="type">The type.</param> 39 /// <returns>A string justifying why type cannot be serialized.</returns> 27 40 string JustifyRejection(Type type); 28 41 29 42 /// <summary> 30 /// Generate MetaInfo necessary for instance creation. (i.e. 31 /// array dimensions). 32 /// </summary> 43 /// Generate MetaInfo necessary for instance creation. (e.g. dimensions 44 /// necessary for array creation (see <see cref="ArraySerializer"/>). 45 /// </summary> 46 /// <param name="obj">An object.</param> 47 /// <returns>An enumerable of <see cref="Tag"/>s.</returns> 33 48 IEnumerable<Tag> CreateMetaInfo(object obj); 34 49 35 50 /// <summary> 36 /// Decompose an object into KeyValuePairs, the Keycan be null,51 /// Decompose an object into <see cref="Tag"/>s, the tag name can be null, 37 52 /// the order in which elements are generated is guaranteed to be 38 53 /// the same as they will be supplied to the Populate method. 39 /// </summary> 54 /// </summary> 55 /// <param name="obj">An object.</param> 56 /// <returns>An enumerable of <see cref="Tag"/>s.</returns> 40 57 IEnumerable<Tag> Decompose(object obj); 41 58 … … 43 60 /// Create an instance of the object using the provided meta information. 44 61 /// </summary> 45 /// <param name="type"></param> 46 /// <returns></returns> 62 /// <param name="type">A type.</param> 63 /// <param name="metaInfo">The meta information.</param> 64 /// <returns>A fresh instance of the provided type.</returns> 47 65 object CreateInstance(Type type, IEnumerable<Tag> metaInfo); 48 66 49 67 /// <summary> 50 /// Compose an object from the KeyValuePairs previously generated 51 /// in DeCompose. The order in which the values are supplied is 52 /// the same as they where generated. Keys might be null. 53 /// </summary> 68 /// Fills an object with values from the previously generated <see cref="Tag"/>s 69 /// in Decompose. The order in which the values are supplied is 70 /// the same as they where generated. <see cref="Tag"/> names might be null. 71 /// </summary> 72 /// <param name="instance">An empty object instance.</param> 73 /// <param name="tags">The tags.</param> 74 /// <param name="type">The type.</param> 54 75 void Populate(object instance, IEnumerable<Tag> tags, Type type); 55 76 } -
TabularUnified trunk/sources/HeuristicLab.Persistence/3.3/Interfaces/IFormat.cs ¶
r1564 r3016 8 8 /// </summary> 9 9 public interface IFormat { 10 11 /// <summary> 12 /// Gets the name. 13 /// </summary> 14 /// <value>The name.</value> 10 15 string Name { get; } 16 17 /// <summary> 18 /// Gets the type of the serial data. 19 /// </summary> 20 /// <value>The type of the serial data.</value> 11 21 Type SerialDataType { get; } 12 22 } -
TabularUnified trunk/sources/HeuristicLab.Persistence/3.3/Interfaces/IPrimitiveSerializer.cs ¶
r1823 r3016 9 9 /// </summary> 10 10 public interface IPrimitiveSerializer { 11 12 /// <summary> 13 /// Gets the type of the serial data. 14 /// </summary> 15 /// <value>The type of the serial data.</value> 11 16 Type SerialDataType { get; } 17 18 /// <summary> 19 /// Gets the source type. 20 /// </summary> 21 /// <value>The type of the source.</value> 12 22 Type SourceType { get; } 23 24 /// <summary> 25 /// Creates a serialized representation of the provided object. 26 /// </summary> 27 /// <param name="o">The object.</param> 28 /// <returns>A serialized version of the object.</returns> 13 29 ISerialData Format(object o); 14 object Parse(ISerialData o); 30 31 32 /// <summary> 33 /// Creates a fresh object instance using the serializes data.. 34 /// </summary> 35 /// <param name="data">The data.</param> 36 /// <returns>A fresh object instance.</returns> 37 object Parse(ISerialData data); 15 38 } 16 39 … … 20 43 /// of implementing this interface. 21 44 /// </summary> 45 /// <typeparam name="Source">The source type.</typeparam> 46 /// <typeparam name="SerialData">The serialized data type.</typeparam> 22 47 public interface IPrimitiveSerializer<Source, SerialData> : IPrimitiveSerializer where SerialData : ISerialData { 48 49 /// <summary> 50 /// Creates a serialized version of the provided object. 51 /// </summary> 52 /// <param name="o">The object.</param> 53 /// <returns>A serialized version of the object.</returns> 23 54 SerialData Format(Source o); 24 Source Parse(SerialData t); 55 56 57 /// <summary> 58 /// Creates a fresh object instance from the serialized data 59 /// </summary> 60 /// <param name="data">The data.</param> 61 /// <returns>A fresh object instance.</returns> 62 Source Parse(SerialData data); 25 63 } 26 64
Note: See TracChangeset
for help on using the changeset viewer.