Index: /branches/New Persistence Exploration/Persistence/Persistence/Default/ViewOnly/ViewOnlyFormat.cs
===================================================================
--- /branches/New Persistence Exploration/Persistence/Persistence/Default/ViewOnly/ViewOnlyFormat.cs	(revision 1429)
+++ /branches/New Persistence Exploration/Persistence/Persistence/Default/ViewOnly/ViewOnlyFormat.cs	(revision 1429)
@@ -0,0 +1,162 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using HeuristicLab.Persistence.Interfaces;
+using HeuristicLab.Persistence.Default.Xml;
+using HeuristicLab.Persistence.Core;
+
+namespace HeuristicLab.Persistence.Default.ViewOnly {
+
+  public class ViewOnlyFormat : Format {
+    public override string Name { get { return "ViewOnly"; } }
+    public static ViewOnlyFormat Instance = new ViewOnlyFormat();
+  }
+
+  public abstract class ValueType2ViewFormatter : IFormatter {
+    public abstract Type Type { get; }
+    public IFormat Format { get { return ViewOnlyFormat.Instance; } }
+    public object DoFormat(object o) { return o; }
+    public object Parse(object o) {
+      throw new NotImplementedException();
+    }
+  }
+
+  public class String2ViewFormatter : ValueType2ViewFormatter {
+    public override Type Type { get { return typeof(string); } }
+  }
+
+  public class Bool2ViewFormatter : ValueType2ViewFormatter {
+    public override Type Type { get { return typeof(bool); } }
+  }
+
+  public class Int2ViewFormatter : ValueType2ViewFormatter {
+    public override Type Type { get { return typeof(int); } }
+  }
+
+  public class Double2ViewFormatter : ValueType2ViewFormatter {
+    public override Type Type { get { return typeof(double); } }
+  }
+
+  public class DateTime2ViewFormatter : ValueType2ViewFormatter {
+    public override Type Type { get { return typeof(DateTime); } }
+  }
+
+  public class Type2ViewFormatter : ValueType2ViewFormatter {
+    public override Type Type { get { return typeof(Type); } }
+  }
+
+  //public class ToStringDecomposer : IDecomposer {
+  // should not be used by default
+  public class ToStringDecomposer {
+    public bool CanDecompose(Type type) { return true; }
+    public IEnumerable<Tag> DeCompose(object obj) {
+      yield return new Tag(obj.ToString());
+    }
+
+    public object CreateInstance(Type type) {
+      throw new NotImplementedException();
+    }
+
+    public object Populate(object instance, IEnumerable<Tag> tags, Type type) {
+      throw new NotImplementedException();
+    }
+
+  }
+
+
+  public class ViewOnlyGenerator : Generator<string> {
+
+    private bool isSepReq;
+    private bool showRefs;
+
+    public ViewOnlyGenerator() : this(false) { }
+
+    public ViewOnlyGenerator(bool showRefs) {
+      isSepReq = false;
+      this.showRefs = showRefs;
+    }    
+
+    protected override string Format(BeginToken beginToken) {
+      StringBuilder sb = new StringBuilder();      
+      if (isSepReq)
+        sb.Append(", ");
+      if ( ! string.IsNullOrEmpty(beginToken.Name) ) {
+        sb.Append(beginToken.Name);
+        if ( beginToken.Id != null && showRefs ) {
+          sb.Append('[');
+          sb.Append(beginToken.Id);
+          sb.Append(']');
+        }        
+      }
+      sb.Append("(");
+      isSepReq = false;
+      return sb.ToString();
+    }
+
+    protected override string Format(EndToken endToken) {
+      isSepReq = true;     
+      return ")";
+    }
+
+    protected override string Format(PrimitiveToken primitiveToken) {
+      StringBuilder sb = new StringBuilder();      
+      if (isSepReq)
+        sb.Append(", ");
+      if ( ! string.IsNullOrEmpty(primitiveToken.Name) ) {
+        sb.Append(primitiveToken.Name);
+        if ( primitiveToken.Id != null && showRefs ) {
+          sb.Append('[');
+          sb.Append(primitiveToken.Id);
+          sb.Append(']');
+        }
+        sb.Append('=');
+      }
+      sb.Append(primitiveToken.SerialData);
+      isSepReq = true;      
+      return sb.ToString();  
+    }
+
+    protected override string Format(ReferenceToken referenceToken) {
+      StringBuilder sb = new StringBuilder();
+      if (isSepReq)
+        sb.Append(", ");
+      if ( ! string.IsNullOrEmpty(referenceToken.Name) ) {
+        sb.Append(referenceToken.Name);
+        sb.Append('=');
+      }
+      sb.Append('{');
+      sb.Append(referenceToken.Id);
+      sb.Append('}');
+      isSepReq = true;      
+      return sb.ToString();
+    }
+
+    protected override string Format(NullReferenceToken nullReferenceToken) {
+      StringBuilder sb = new StringBuilder();
+      if (isSepReq)
+        sb.Append(", ");
+      if (!string.IsNullOrEmpty(nullReferenceToken.Name)) {
+        sb.Append(nullReferenceToken.Name);
+        sb.Append('=');
+      }
+      sb.Append("<null>");
+      isSepReq = true;
+      return sb.ToString();
+    }
+
+    public static string Serialize(object o) {
+      return Serialize(o, ConfigurationService.Instance.GetDefaultConfig(ViewOnlyFormat.Instance));
+    }
+
+    public static string Serialize(object o, Configuration configuration) {
+      Serializer s = new Serializer(o, configuration);      
+      ViewOnlyGenerator generator = new ViewOnlyGenerator();
+      StringBuilder sb = new StringBuilder();
+      foreach (ISerializationToken token in s) {
+        sb.Append(generator.Format(token));        
+      }
+      return sb.ToString();
+    }
+  }
+}
Index: /branches/New Persistence Exploration/Persistence/Persistence/HeuristicLab.Persistence-3.3.csproj
===================================================================
--- /branches/New Persistence Exploration/Persistence/Persistence/HeuristicLab.Persistence-3.3.csproj	(revision 1428)
+++ /branches/New Persistence Exploration/Persistence/Persistence/HeuristicLab.Persistence-3.3.csproj	(revision 1429)
@@ -64,4 +64,5 @@
     <Compile Include="Default\Decomposers\StorableDecomposer.cs" />
     <Compile Include="Default\Decomposers\TypeDecomposer.cs" />
+    <Compile Include="Default\ViewOnly\ViewOnlyFormat.cs" />
     <Compile Include="Default\Xml\Compact\IntArray2XmlFormatters.cs" />
     <Compile Include="Default\Xml\Compact\DoubleArray2XmlFormatters.cs" />
Index: /branches/New Persistence Exploration/Persistence/Test/NewSerializationTest.cs
===================================================================
--- /branches/New Persistence Exploration/Persistence/Test/NewSerializationTest.cs	(revision 1428)
+++ /branches/New Persistence Exploration/Persistence/Test/NewSerializationTest.cs	(revision 1429)
@@ -6,4 +6,5 @@
 using HeuristicLab.Persistence.Default.Xml;
 using HeuristicLab.Persistence.Interfaces;
+using HeuristicLab.Persistence.Default.ViewOnly;
 
 namespace HeuristicLab.Persistence.Test {
@@ -154,7 +155,9 @@
       r.dict.Add("two", 2);
       r.dict.Add("three", 3);
-      XmlGenerator.Serialize(r, "test");            
+      XmlGenerator.Serialize(r, "test");      
       object o = XmlParser.DeSerialize("test");
-      Console.Out.WriteLine(Util.AutoFormat(o, true));      
+      Console.Out.WriteLine(Util.AutoFormat(o, true));
+      Console.WriteLine(ViewOnlyGenerator.Serialize(r));
+      Console.WriteLine(ViewOnlyGenerator.Serialize(o));
     }
 
