- Timestamp:
- 11/23/15 18:47:21 (9 years ago)
- Location:
- branches/PersistenceOverhaul/HeuristicLab.Persistence
- Files:
-
- 19 edited
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
branches/PersistenceOverhaul/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable/StorableAttribute.cs
r12012 r13347 21 21 22 22 using System; 23 using System.Reflection; 23 24 using System.Text; 24 25 … … 37 38 Inherited = false)] 38 39 public class StorableAttribute : Attribute { 40 public static bool IsStorable(MemberInfo memberInfo) { 41 return Attribute.IsDefined(memberInfo, typeof(StorableAttribute), false); 42 } 43 public static StorableAttribute GetStorableAttribute(MemberInfo memberInfo) { 44 return (StorableAttribute)Attribute.GetCustomAttribute(memberInfo, typeof(StorableAttribute), false); 45 } 39 46 40 47 /// <summary> -
branches/PersistenceOverhaul/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable/StorableClassAttribute.cs
r12012 r13347 36 36 public StorableClassType Type { get; private set; } 37 37 38 public Guid Guid { get; private set; } 39 public bool Released { get; set; } 40 38 41 /// <summary> 39 42 /// Mark a class to be serialize by the <c>StorableSerizlier</c> 40 43 /// </summary> 41 44 /// <param name="type">The storable class type.</param> 42 public StorableClassAttribute(StorableClassType type ) {45 public StorableClassAttribute(StorableClassType type, string guid) { 43 46 Type = type; 47 Guid = new Guid(guid); 48 Released = false; 44 49 } 45 50 … … 61 66 } 62 67 68 public static StorableClassAttribute GetStorableClassAttribute(Type type) { 69 return (StorableClassAttribute)Attribute.GetCustomAttribute(type, typeof(StorableClassAttribute), false); 70 } 71 63 72 } 64 73 } -
branches/PersistenceOverhaul/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable/StorableConstructorAttribute.cs
r12012 r13347 21 21 22 22 using System; 23 using System.Reflection; 23 24 24 25 namespace HeuristicLab.Persistence.Default.CompositeSerializers.Storable { … … 34 35 /// </summary> 35 36 [AttributeUsage(AttributeTargets.Constructor, Inherited = false, AllowMultiple = false)] 36 public sealed class StorableConstructorAttribute : Attribute { } 37 public sealed class StorableConstructorAttribute : Attribute { 38 public static bool IsStorableConstructor(ConstructorInfo constructorInfo) { 39 return Attribute.IsDefined(constructorInfo, typeof(StorableConstructorAttribute)); 40 } 41 } 37 42 } -
branches/PersistenceOverhaul/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable/StorableHookAttribute.cs
r12012 r13347 21 21 22 22 using System; 23 using System.Linq; 24 using System.Reflection; 23 25 24 26 namespace HeuristicLab.Persistence.Default.CompositeSerializers.Storable { … … 50 52 [AttributeUsage(AttributeTargets.Method, Inherited = false, AllowMultiple = true)] 51 53 public sealed class StorableHookAttribute : Attribute { 54 public static bool IsStorableHook(MethodInfo methodInfo) { 55 return Attribute.IsDefined(methodInfo, typeof(StorableHookAttribute), false); 56 } 57 public static StorableHookAttribute[] GetStorableHookAttributes(MethodInfo methodInfo) { 58 return Attribute.GetCustomAttributes(methodInfo, false).OfType<StorableHookAttribute>().ToArray(); 59 } 52 60 53 61 private readonly HookType hookType; -
branches/PersistenceOverhaul/HeuristicLab.Persistence/4.0/Core/ComponentInfo.cs
r13326 r13347 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 2Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/PersistenceOverhaul/HeuristicLab.Persistence/4.0/Core/Index.cs
r13326 r13347 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 2Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 33 33 34 34 public Index() { 35 indexes = new Dictionary<T, uint>();36 values = new Dictionary<uint, T>();37 nextIndex = 1;35 this.indexes = new Dictionary<T, uint>(); 36 this.values = new Dictionary<uint, T>(); 37 nextIndex = 0; 38 38 } 39 public Index(IEnumerable<T uple<uint, T>> values)39 public Index(IEnumerable<T> values) 40 40 : this() { 41 41 foreach (var value in values) { 42 this.indexes.Add(value .Item2, value.Item1);43 this.values.Add( value.Item1, value.Item2);42 this.indexes.Add(value, nextIndex); 43 this.values.Add(nextIndex, value); 44 44 nextIndex++; 45 45 } … … 47 47 48 48 public uint GetIndex(T value) { 49 uint index = 0; 50 indexes.TryGetValue(value, out index); 51 if (index == 0) { 49 uint index; 50 if (!indexes.TryGetValue(value, out index)) { 52 51 index = nextIndex; 53 52 nextIndex++; … … 60 59 return values[index]; 61 60 } 62 public IEnumerable<T uple<uint, T>> GetValues() {63 return values. Select(x => new Tuple<uint, T>(x.Key, x.Value));61 public IEnumerable<T> GetValues() { 62 return values.Values; 64 63 } 65 64 } -
branches/PersistenceOverhaul/HeuristicLab.Persistence/4.0/Core/Mapper.cs
r13326 r13347 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 2Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 23 23 using System.Collections.Generic; 24 24 using System.Linq; 25 using HeuristicLab.Persistence.Data;26 25 using HeuristicLab.PluginInfrastructure; 26 using Google.ProtocolBuffers; 27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 27 28 28 29 namespace HeuristicLab.Persistence { 29 public sealed class PersistenceMapper {30 private ShortIndex<ITransformer> transformers;30 public sealed class Mapper { 31 private Index<ITransformer> transformers; 31 32 private Dictionary<Type, TypeInfo> typeInfos; 32 private ShortIndex<Type> types;33 private Index<Type> types; 33 34 private Index<string> strings; 34 private Index< PersistenceData> data;35 private Dictionary<object, uint> dataCache;35 private Index<Box> boxes; 36 private Dictionary<object, uint> boxCache; 36 37 private Dictionary<uint, object> objectCache; 37 38 38 public long Nodes{ get; private set; }39 public long BoxCount { get; private set; } 39 40 40 public PersistenceMapper() {41 transformers = new ShortIndex<ITransformer>();41 public Mapper() { 42 transformers = new Index<ITransformer>(); 42 43 typeInfos = new Dictionary<Type, TypeInfo>(); 43 types = new ShortIndex<Type>();44 types = new Index<Type>(); 44 45 strings = new Index<string>(); 45 data = new Index<PersistenceData>();46 dataCache = new Dictionary<object, uint>(new ReferenceEqualityComparer<object>());46 boxes = new Index<Box>(); 47 boxCache = new Dictionary<object, uint>(new ReferenceEqualityComparer<object>()); 47 48 objectCache = new Dictionary<uint, object>(); 48 49 49 Nodes= 0;50 BoxCount = 0; 50 51 51 52 foreach (var transformer in ApplicationManager.Manager.GetInstances<ITransformer>().OrderBy(x => x.Order)) { 52 ushort id = transformers.GetIndex(transformer); 53 transformer.Initialize(id); 53 transformer.Initialize(transformers.GetIndex(transformer)); 54 54 } 55 55 } … … 57 57 public TypeInfo GetTypeInfo(Type type) { 58 58 TypeInfo typeInfo; 59 typeInfos.TryGetValue(type, out typeInfo); 60 if (typeInfo == null) { 61 var transformer = transformers.GetValues().Select(x => x.Item2).Where(x => x.CanTransformType(type)).FirstOrDefault(); 59 if (!typeInfos.TryGetValue(type, out typeInfo)) { 60 var transformer = transformers.GetValues().Where(x => x.CanTransformType(type)).FirstOrDefault(); 62 61 typeInfo = new TypeInfo(type, transformer); 63 62 typeInfos.Add(type, typeInfo); … … 72 71 } 73 72 74 public u short GetTypeId(Type type) {73 public uint GetTypeId(Type type) { 75 74 return types.GetIndex(type); 76 75 } 77 public Type GetType(u short typeId) {76 public Type GetType(uint typeId) { 78 77 return types.GetValue(typeId); 79 78 } … … 86 85 } 87 86 88 public void Cache(object o, PersistenceData data) { 89 dataCache.Add(o, this.data.GetIndex(data)); 87 public uint GetBoxId(object o) { 88 uint boxId; 89 if (boxCache.TryGetValue(o, out boxId)) return boxId; 90 91 if (o == null) 92 boxId = boxes.GetIndex(null); 93 else { 94 var type = o.GetType(); 95 var typeInfo = GetTypeInfo(type); 96 if (typeInfo.Transformer == null) throw new ArgumentException("Cannot serialize object of type " + o.GetType()); 97 BoxCount++; 98 typeInfo.Used++; 99 boxId = boxes.GetIndex(typeInfo.Transformer.ToBox(o, this)); 100 } 101 boxCache.Add(o, boxId); 102 return boxId; 90 103 } 91 public void Cache(PersistenceData data, object o) {92 object Cache.Add(this.data.GetIndex(data), o);93 }104 public object GetObject(uint boxId) { 105 object o; 106 if (objectCache.TryGetValue(boxId, out o)) return o; 94 107 95 public uint GetDataId(object o) { 96 if (o == null) return 0; 97 if (dataCache.ContainsKey(o)) return dataCache[o]; 98 99 var type = o.GetType(); 100 var typeInfo = GetTypeInfo(type); 101 if (typeInfo.Transformer == null) throw new ArgumentException("Cannot serialize object of type " + o.GetType()); 102 Nodes++; 103 typeInfo.Used++; 104 return data.GetIndex(typeInfo.Transformer.ToData(o, this)); 105 } 106 public object GetObject(uint dataId) { 107 if (dataId == 0) return null; 108 if (objectCache.ContainsKey(dataId)) return objectCache[dataId]; 109 var data = this.data.GetValue(dataId); 110 var transformer = transformers.GetValue(data.TransformerId); 111 return transformer.ToObject(data, this); 108 var box = this.boxes.GetValue(boxId); 109 if (box == null) 110 o = null; 111 else { 112 var transformer = transformers.GetValue(box.TransformerId); 113 o = transformer.ToObject(box, this); 114 } 115 objectCache.Add(boxId, o); 116 return o; 112 117 } 113 118 … … 116 121 } 117 122 118 public static PersistenceMapper mapper; 119 public static PersistenceBundle ToBundle(object o) { 120 mapper = new PersistenceMapper(); 121 var bundle = new PersistenceBundle(); 122 bundle.RootId = mapper.GetDataId(o); 123 bundle.TransformerGuids = mapper.transformers.GetValues().Select(x => new Tuple<ushort, Guid>(x.Item1, x.Item2.Guid)).ToArray(); 124 bundle.TypeNames = mapper.types.GetValues().Select(x => new Tuple<ushort, string>(x.Item1, x.Item2.AssemblyQualifiedName)).ToArray(); 125 bundle.Strings = mapper.strings.GetValues().ToArray(); 126 bundle.Data = mapper.data.GetValues().ToArray(); 127 return bundle; 123 public static Bundle ToBundle(object o) { 124 var mapper = new Mapper(); 125 var bundle = Bundle.CreateBuilder(); 126 bundle.RootBoxId = mapper.GetBoxId(o); 127 bundle.AddRangeTransformerGuids(mapper.transformers.GetValues().Select(x => x.Guid).Select(x => ByteString.CopyFrom(x.ToByteArray()))); 128 bundle.AddRangeTypeGuids(mapper.types.GetValues().Select(x => mapper.typeInfos[x].StorableClassAttribute.Guid).Select(x => ByteString.CopyFrom(x.ToByteArray()))); 129 bundle.AddRangeStrings(mapper.strings.GetValues()); 130 bundle.AddRangeBoxes(mapper.boxes.GetValues()); 131 return bundle.Build(); 128 132 } 129 public static object ToObject(PersistenceBundle bundle) { 130 mapper = new PersistenceMapper(); 131 mapper.types = new ShortIndex<Type>(bundle.TypeNames.Select(x => new Tuple<ushort, Type>(x.Item1, Type.GetType(x.Item2, true)))); 132 mapper.strings = new Index<string>(bundle.Strings); 133 mapper.data = new Index<PersistenceData>(bundle.Data); 134 mapper.transformers = new ShortIndex<ITransformer>( 135 bundle.TransformerGuids.Select(x => new Tuple<ushort, ITransformer>( 136 x.Item1, 137 mapper.transformers.GetValues().Select(y => y.Item2).Where(y => y.Guid == x.Item2).First()) 138 ) 139 ); 140 foreach (var type in mapper.types.GetValues().Select(x => x.Item2)) 133 public static object ToObject(Bundle bundle) { 134 var types = new Dictionary<Guid, Type>(); 135 foreach (var asm in AppDomain.CurrentDomain.GetAssemblies()) { 136 foreach (var t in asm.GetTypes().Where(x => StorableClassAttribute.IsStorableClass(x))) 137 types.Add(StorableClassAttribute.GetStorableClassAttribute(t).Guid, t); 138 } 139 140 var mapper = new Mapper(); 141 mapper.types = new Index<Type>(bundle.TypeGuidsList.Select(x => new Guid(x.ToByteArray())).Select(x => types[x])); 142 mapper.strings = new Index<string>(bundle.StringsList); 143 mapper.boxes = new Index<Box>(bundle.BoxesList); 144 mapper.transformers = new Index<ITransformer>(bundle.TransformerGuidsList.Select(x => new Guid(x.ToByteArray())).Select(x => mapper.transformers.GetValues().First(y => y.Guid == x))); 145 foreach (var type in mapper.types.GetValues()) 141 146 mapper.typeInfos.Add(type, new TypeInfo(type)); 142 147 143 return mapper.GetObject(bundle.Root Id);148 return mapper.GetObject(bundle.RootBoxId); 144 149 } 145 150 } -
branches/PersistenceOverhaul/HeuristicLab.Persistence/4.0/Core/ProtoBufSerializer.cs
r13326 r13347 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 2Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 21 21 22 22 using System.IO; 23 using HeuristicLab.Persistence.Data;24 23 25 24 namespace HeuristicLab.Persistence { 26 25 public sealed class ProtoBufSerializer : Serializer { 27 protected override void Serialize PersistenceBundle(PersistenceBundle bundle, Stream stream) {28 ProtoBuf.Serializer.Serialize<PersistenceBundle>(stream, bundle);26 protected override void SerializeBundle(Bundle bundle, Stream stream) { 27 bundle.WriteTo(stream); 29 28 } 30 29 31 protected override PersistenceBundle DeserializePersistenceBundle(Stream stream) {32 return ProtoBuf.Serializer.Deserialize<PersistenceBundle>(stream);30 protected override Bundle DeserializeBundle(Stream stream) { 31 return Bundle.ParseFrom(stream); 33 32 } 34 33 } -
branches/PersistenceOverhaul/HeuristicLab.Persistence/4.0/Core/ReferenceEqualityComparer.cs
r13326 r13347 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 2Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/PersistenceOverhaul/HeuristicLab.Persistence/4.0/Core/Serializer.cs
r13326 r13347 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 2Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 22 22 using System.IO; 23 23 using System.IO.Compression; 24 using HeuristicLab.Persistence.Data;25 24 26 25 namespace HeuristicLab.Persistence { 27 26 public abstract class Serializer : ISerializer { 28 27 public virtual void Serialize(object o, Stream stream) { 29 Serialize PersistenceBundle(PersistenceMapper.ToBundle(o), stream);28 SerializeBundle(Mapper.ToBundle(o), stream); 30 29 } 31 30 public virtual void Serialize(object o, string path) { … … 44 43 } 45 44 } 46 protected abstract void Serialize PersistenceBundle(PersistenceBundle bundle, Stream stream);45 protected abstract void SerializeBundle(Bundle bundle, Stream stream); 47 46 48 47 public virtual object Deserialize(Stream stream) { 49 return PersistenceMapper.ToObject(DeserializePersistenceBundle(stream));48 return Mapper.ToObject(DeserializeBundle(stream)); 50 49 } 51 50 public virtual object Deserialize(string path) { … … 63 62 } 64 63 } 65 protected abstract PersistenceBundle DeserializePersistenceBundle(Stream stream);64 protected abstract Bundle DeserializeBundle(Stream stream); 66 65 } 67 66 } -
branches/PersistenceOverhaul/HeuristicLab.Persistence/4.0/Core/StorableAttribute.cs
r13326 r13347 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 2Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/PersistenceOverhaul/HeuristicLab.Persistence/4.0/Core/StorableClassAttribute.cs
r13326 r13347 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 2Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 27 27 public sealed class StorableClassAttribute : Attribute { 28 28 public Guid Guid { get; private set; } 29 public int Version { get; set; }30 29 public bool Released { get; set; } 31 30 32 31 public StorableClassAttribute(string guid) { 33 32 Guid = new Guid(guid); 34 Version = 0;35 33 Released = false; 36 34 } -
branches/PersistenceOverhaul/HeuristicLab.Persistence/4.0/Core/Transformer.cs
r13326 r13347 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 2Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 21 21 22 22 using System; 23 using HeuristicLab.Persistence.Data;24 23 25 24 namespace HeuristicLab.Persistence { 26 internal abstract class Transformer Base: ITransformer {25 internal abstract class Transformer : ITransformer { 27 26 public Guid Guid { get; private set; } 28 public u short Id { get; private set; }29 public u short Order { get; private set; }27 public uint Id { get; private set; } 28 public uint Order { get; private set; } 30 29 31 protected Transformer Base() {30 protected Transformer() { 32 31 Guid = TransformerAttribute.GetGuid(this.GetType()); 33 32 Order = TransformerAttribute.GetOrder(this.GetType()); … … 35 34 } 36 35 37 public void Initialize(u short id) {36 public void Initialize(uint id) { 38 37 Id = id; 39 38 } 40 39 41 40 public abstract bool CanTransformType(Type type); 42 public abstract PersistenceData ToData(object o, PersistenceMapper mapper);43 public abstract object ToObject( PersistenceData data, PersistenceMapper mapper);41 public abstract Box ToBox(object o, Mapper mapper); 42 public abstract object ToObject(Box box, Mapper mapper); 44 43 } 45 44 } -
branches/PersistenceOverhaul/HeuristicLab.Persistence/4.0/Core/TransformerAttribute.cs
r13326 r13347 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 2Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 26 26 public sealed class TransformerAttribute : Attribute { 27 27 public Guid Guid { get; private set; } 28 public u short Order { get; private set; }28 public uint Order { get; private set; } 29 29 30 public TransformerAttribute(string guid, u short order) {30 public TransformerAttribute(string guid, uint order) { 31 31 Guid = new Guid(guid); 32 32 Order = order; … … 42 42 return GetTransformerAttribute(type).Guid; 43 43 } 44 public static u short GetOrder(Type type) {44 public static uint GetOrder(Type type) { 45 45 return GetTransformerAttribute(type).Order; 46 46 } -
branches/PersistenceOverhaul/HeuristicLab.Persistence/4.0/Core/TypeInfo.cs
r13326 r13347 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 2Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/PersistenceOverhaul/HeuristicLab.Persistence/4.0/HeuristicLab.Persistence-4.0.csproj
r13326 r13347 46 46 </ItemGroup> 47 47 <ItemGroup> 48 <Compile Include="Core\ComponentInfo.cs" /> 49 <Compile Include="Core\Index.cs" /> 50 <Compile Include="Core\Mapper.cs" /> 51 <Compile Include="Core\ProtoBufSerializer.cs" /> 52 <Compile Include="Core\ReferenceEqualityComparer.cs" /> 53 <Compile Include="Core\Serializer.cs" /> 54 <Compile Include="Core\Transformer.cs" /> 55 <Compile Include="Core\TransformerAttribute.cs" /> 56 <Compile Include="Core\TypeInfo.cs" /> 57 <Compile Include="ISerializer.cs" /> 58 <Compile Include="ITransformer.cs" /> 48 59 <Compile Include="Plugin.cs" /> 49 60 <Compile Include="Properties\AssemblyInfo.cs" /> … … 62 73 <Name>HeuristicLab.PluginInfrastructure-3.3</Name> 63 74 <Private>False</Private> 75 </ProjectReference> 76 <ProjectReference Include="..\3.3\HeuristicLab.Persistence-3.3.csproj"> 77 <Project>{102bc7d3-0ef9-439c-8f6d-96ff0fdb8e1b}</Project> 78 <Name>HeuristicLab.Persistence-3.3</Name> 64 79 </ProjectReference> 65 80 </ItemGroup> -
branches/PersistenceOverhaul/HeuristicLab.Persistence/4.0/ISerializer.cs
r13326 r13347 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 2Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/PersistenceOverhaul/HeuristicLab.Persistence/4.0/ITransformer.cs
r13326 r13347 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 2Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 21 21 22 22 using System; 23 using HeuristicLab.Persistence.Data;24 23 25 24 namespace HeuristicLab.Persistence { 26 25 public interface ITransformer { 27 26 Guid Guid { get; } 28 u short Id { get; }29 u short Order { get; }27 uint Id { get; } 28 uint Order { get; } 30 29 31 void Initialize(u short id);30 void Initialize(uint id); 32 31 33 32 bool CanTransformType(Type type); 34 PersistenceData ToData(object o, PersistenceMapper mapper);35 object ToObject( PersistenceData data, PersistenceMapper mapper);33 Box ToBox(object o, Mapper mapper); 34 object ToObject(Box box, Mapper mapper); 36 35 } 37 36 } -
branches/PersistenceOverhaul/HeuristicLab.Persistence/4.0/Plugin.cs.frame
r13326 r13347 29 29 [PluginFile("HeuristicLab.Persistence-4.0.dll", PluginFileType.Assembly)] 30 30 [PluginDependency("HeuristicLab.ProtobufCS", "2.4.1.473")] 31 [PluginDependency("HeuristicLab.Persistence", "3.3")] 31 32 public class HeuristicLabPersistencePlugin : PluginBase { } 32 33 } -
branches/PersistenceOverhaul/HeuristicLab.Persistence/4.0/Properties/AssemblyInfo.cs.frame
r13326 r13347 20 20 #endregion 21 21 22 using System; 22 23 using System.Reflection; 23 24 using System.Runtime.CompilerServices; … … 53 54 [assembly: AssemblyVersion("4.0.0.0")] 54 55 [assembly: AssemblyFileVersion("4.0.0.$WCREV$")] 56 57 [assembly: CLSCompliant(false)] -
branches/PersistenceOverhaul/HeuristicLab.Persistence/4.0/Protos/PersistenceMessages.proto
r13326 r13347 1 1 package HeuristicLab.Persistence; 2 2 3 message PersistenceBox { 4 required uint32 TransformerId = 1; 5 required uint32 TypeId = 2; 3 message Bundle { 4 repeated bytes transformer_guids = 1; 5 repeated bytes type_guids = 2; 6 repeated string strings = 3; 7 repeated Box boxes = 4; 8 required uint32 root_box_id = 5; 6 9 } 10 11 message Box { 12 optional uint32 transformer_id = 1; 13 optional uint32 type_id = 2; 14 15 extensions 100 to max; 16 } 17 18 // value boxes 19 message BoolBox { 20 extend Box { 21 required BoolBox bool = 100; 22 } 23 required bool value = 1; 24 } 25 message IntBox { 26 extend Box { 27 required IntBox int = 101; 28 } 29 required int32 value = 1; 30 } 31 message LongBox { 32 extend Box { 33 required LongBox long = 102; 34 } 35 required int64 value = 1; 36 } 37 message UnsignedIntBox { 38 extend Box { 39 required UnsignedIntBox unsigned_int = 103; 40 } 41 required uint32 value = 1; 42 } 43 message UnsignedLongBox { 44 extend Box { 45 required UnsignedLongBox unsigned_long = 104; 46 } 47 required uint64 value = 1; 48 } 49 message FloatBox { 50 extend Box { 51 required FloatBox float = 105; 52 } 53 required float value = 1; 54 } 55 message DoubleBox { 56 extend Box { 57 required DoubleBox double = 106; 58 } 59 required double value = 1; 60 } 61 message StringBox { 62 extend Box { 63 required StringBox string = 107; 64 } 65 required string value = 1; 66 } 67 message BytesBox { 68 extend Box { 69 required BytesBox bytes = 108; 70 } 71 required bytes value = 1; 72 } 73 74 // array boxes 75 message ArrayBox { 76 extend Box { 77 required ArrayBox array = 120; 78 } 79 optional uint32 element_type_id = 1; 80 81 extensions 100 to max; 82 } 83 message BoolArrayBox { 84 extend ArrayBox { 85 required BoolArrayBox bool_array = 100; 86 } 87 repeated bool values = 1 [packed = true]; 88 } 89 message IntArrayBox { 90 extend ArrayBox { 91 required IntArrayBox int_array = 101; 92 } 93 repeated int32 values = 1 [packed = true]; 94 } 95 96 // matrix boxes 97 message MatrixBox { 98 extend Box { 99 required MatrixBox matrix = 140; 100 } 101 optional uint32 element_type_id = 1; 102 repeated uint32 lengths = 2 [packed = true]; 103 104 extensions 100 to max; 105 } 106 message BoolMatrixBox { 107 extend MatrixBox { 108 required BoolMatrixBox bool_matrix = 100; 109 } 110 repeated bool values = 1 [packed = true]; 111 } 112 message IntMatrixBox { 113 extend MatrixBox { 114 required IntMatrixBox int_matrix = 101; 115 } 116 repeated int32 values = 1 [packed = true]; 117 } 118 119 // composite boxes 120 message DictionaryBox { 121 extend Box { 122 required DictionaryBox dictionary = 160; 123 } 124 repeated uint32 key_ids = 1 [packed = true]; 125 repeated uint32 value_ids = 2 [packed = true]; 126 required uint32 comparer_id = 3; 127 }
Note: See TracChangeset
for help on using the changeset viewer.