public DataStructure TightUnmarshalNestedObject(BinaryReader dis, BooleanStream bs) { if (bs.ReadBoolean()) { byte dataType = dis.ReadByte(); BaseDataStreamMarshaller dsm = GetDataStreamMarshallerForType(dataType); DataStructure data = dsm.CreateObject(); if (data.IsMarshallAware() && bs.ReadBoolean()) { dis.ReadInt32(); dis.ReadByte(); BooleanStream bs2 = new BooleanStream(); bs2.Unmarshal(dis); dsm.TightUnmarshal(this, data, dis, bs2); } else { dsm.TightUnmarshal(this, data, dis, bs); } return(data); } return(null); }
public int TightMarshalNestedObject1(DataStructure o, BooleanStream bs) { bs.WriteBoolean(o != null); if (null == o) { return(0); } if (o.IsMarshallAware()) { MarshallAware ma = (MarshallAware)o; byte[] sequence = ma.GetMarshalledForm(this); bs.WriteBoolean(sequence != null); if (sequence != null) { return(1 + sequence.Length); } } byte type = o.GetDataStructureType(); if (type == 0) { throw new IOException("No valid data structure type for: " + o + " of type: " + o.GetType()); } BaseDataStreamMarshaller dsm = GetDataStreamMarshallerForType(type); Tracer.Debug("Marshalling type: " + type + " with structure: " + o); return(1 + dsm.TightMarshal1(this, o, bs)); }
public void TightMarshalNestedObject2(DataStructure o, BinaryWriter ds, BooleanStream bs) { if (!bs.ReadBoolean()) { return; } byte type = o.GetDataStructureType(); ds.Write(type); if (o.IsMarshallAware() && bs.ReadBoolean()) { MarshallAware ma = (MarshallAware)o; byte[] sequence = ma.GetMarshalledForm(this); ds.Write(sequence, 0, sequence.Length); } else { BaseDataStreamMarshaller dsm; lock (this.marshalLock) { dsm = GetDataStreamMarshallerForType(type); } dsm.TightMarshal2(this, o, ds, bs); } }
public void TightMarshalNestedObject2(DataStructure o, BinaryWriter ds, BooleanStream bs) { if (!bs.ReadBoolean()) { return; } byte type = o.GetDataStructureType(); ds.Write(type); if (o.IsMarshallAware() && bs.ReadBoolean()) { MarshallAware ma = (MarshallAware)o; byte[] sequence = ma.GetMarshalledForm(this); ds.Write(sequence, 0, sequence.Length); } else { BaseDataStreamMarshaller dsm = (BaseDataStreamMarshaller)dataMarshallers[type & 0xFF]; if (dsm == null) { throw new IOException("Unknown data type: " + type); } dsm.TightMarshal2(this, o, ds, bs); } }
public int TightMarshalNestedObject1(DataStructure o, BooleanStream bs) { bs.WriteBoolean(o != null); if (o == null) { return(0); } if (o.IsMarshallAware()) { MarshallAware ma = (MarshallAware)o; byte[] sequence = ma.GetMarshalledForm(this); bs.WriteBoolean(sequence != null); if (sequence != null) { return(1 + sequence.Length); } } byte type = o.GetDataStructureType(); if (type == 0) { throw new IOException("No valid data structure type for: " + o + " of type: " + o.GetType()); } BaseDataStreamMarshaller dsm = (BaseDataStreamMarshaller)dataMarshallers[type & 0xFF]; if (dsm == null) { throw new IOException("Unknown data type: " + type); } //Console.WriteLine("Marshalling type: " + type + " with structure: " + o); return(1 + dsm.TightMarshal1(this, o, bs)); }
public DataStructure TightUnmarshalNestedObject(BinaryReader dis, BooleanStream bs) { if (bs.ReadBoolean()) { byte dataType = dis.ReadByte(); BaseDataStreamMarshaller dsm = (BaseDataStreamMarshaller)dataMarshallers[dataType & 0xFF]; if (dsm == null) { throw new IOException("Unknown data type: " + dataType); } DataStructure data = dsm.CreateObject(); if (data.IsMarshallAware() && bs.ReadBoolean()) { dis.ReadInt32(); dis.ReadByte(); BooleanStream bs2 = new BooleanStream(); bs2.Unmarshal(dis); dsm.TightUnmarshal(this, data, dis, bs2); // TODO: extract the sequence from the dis and associate it. // MarshallAware ma = (MarshallAware)data // ma.setCachedMarshalledForm(this, sequence); } else { dsm.TightUnmarshal(this, data, dis, bs); } return(data); } else { return(null); } }
public void TightMarshalNestedObject2(DataStructure o, BinaryWriter ds, BooleanStream bs) { if(!bs.ReadBoolean()) { return; } byte type = o.GetDataStructureType(); ds.Write(type); if(o.IsMarshallAware() && bs.ReadBoolean()) { MarshallAware ma = (MarshallAware) o; byte[] sequence = ma.GetMarshalledForm(this); ds.Write(sequence, 0, sequence.Length); } else { BaseDataStreamMarshaller dsm = GetDataStreamMarshallerForType(type); dsm.TightMarshal2(this, o, ds, bs); } }
public int TightMarshalNestedObject1(DataStructure o, BooleanStream bs) { bs.WriteBoolean(o != null); if(null == o) { return 0; } if(o.IsMarshallAware()) { MarshallAware ma = (MarshallAware) o; byte[] sequence = ma.GetMarshalledForm(this); bs.WriteBoolean(sequence != null); if(sequence != null) { return 1 + sequence.Length; } } byte type = o.GetDataStructureType(); if(type == 0) { throw new IOException("No valid data structure type for: " + o + " of type: " + o.GetType()); } BaseDataStreamMarshaller dsm = GetDataStreamMarshallerForType(type); Tracer.Debug("Marshalling type: " + type + " with structure: " + o); return 1 + dsm.TightMarshal1(this, o, bs); }
public void TightMarshalNestedObject2(DataStructure o, BinaryWriter ds, BooleanStream bs) { if (!bs.ReadBoolean()) return ; byte type = o.GetDataStructureType(); ds.Write(type); if (o.IsMarshallAware() && bs.ReadBoolean()) { MarshallAware ma = (MarshallAware) o; byte[] sequence = ma.GetMarshalledForm(this); ds.Write(sequence, 0, sequence.Length); } else { BaseDataStreamMarshaller dsm = (BaseDataStreamMarshaller) dataMarshallers[type & 0xFF]; if (dsm == null) throw new IOException("Unknown data type: " + type); dsm.TightMarshal2(this, o, ds, bs); } }
public int TightMarshalNestedObject1(DataStructure o, BooleanStream bs) { bs.WriteBoolean(o != null); if (o == null) return 0; if (o.IsMarshallAware()) { MarshallAware ma = (MarshallAware) o; byte[] sequence = ma.GetMarshalledForm(this); bs.WriteBoolean(sequence != null); if (sequence != null) { return 1 + sequence.Length; } } byte type = o.GetDataStructureType(); if (type == 0) { throw new IOException("No valid data structure type for: " + o + " of type: " + o.GetType()); } BaseDataStreamMarshaller dsm = (BaseDataStreamMarshaller) dataMarshallers[type & 0xFF]; if (dsm == null) throw new IOException("Unknown data type: " + type); //Console.WriteLine("Marshalling type: " + type + " with structure: " + o); return 1 + dsm.TightMarshal1(this, o, bs); }