Ejemplo n.º 1
0
            public override void WriteUpdate(Transaction transaction, IUpdateDepth updatedepth
                                             )
            {
                if (!_firstUpdate)
                {
                    base.WriteUpdate(transaction, updatedepth);
                    return;
                }
                _firstUpdate = false;
                var container = transaction.Container();

                SetStateClean();
                var context = new MarshallingContext(transaction, this, updatedepth
                                                     , false);

                Handlers4.Write(ClassMetadata().TypeHandler(), context, GetObject());
                var length = Container().BlockConverter().BlockAlignedBytes(context.MarshalledLength
                                                                                ());
                var slot    = context.AllocateNewSlot(length);
                var pointer = new Pointer4(GetID(), slot);
                var buffer  = context.ToWriteBuffer(pointer);

                container.WriteUpdate(transaction, pointer, ClassMetadata(), ArrayType.None,
                                      buffer);
                if (IsActive())
                {
                    SetStateClean();
                }
            }
Ejemplo n.º 2
0
            public override void WriteUpdate(Transaction transaction, IUpdateDepth updatedepth
                                             )
            {
                if (!this._firstUpdate)
                {
                    base.WriteUpdate(transaction, updatedepth);
                    return;
                }
                this._firstUpdate = false;
                ObjectContainerBase container = transaction.Container();

                this.SetStateClean();
                MarshallingContext context = new MarshallingContext(transaction, this, updatedepth
                                                                    , false);

                Handlers4.Write(this.ClassMetadata().TypeHandler(), context, this.GetObject());
                int length = this.Container().BlockConverter().BlockAlignedBytes(context.MarshalledLength
                                                                                     ());
                Slot            slot    = context.AllocateNewSlot(length);
                Pointer4        pointer = new Pointer4(this.GetID(), slot);
                ByteArrayBuffer buffer  = context.ToWriteBuffer(pointer);

                container.WriteUpdate(transaction, pointer, this.ClassMetadata(), ArrayType.None,
                                      buffer);
                if (this.IsActive())
                {
                    this.SetStateClean();
                }
            }
Ejemplo n.º 3
0
        public virtual void WriteAny(object obj)
        {
            ClassMetadata classMetadata = Container().ClassMetadataForObject(obj);

            WriteInt(classMetadata.GetID());
            Handlers4.Write(classMetadata.TypeHandler(), this, obj);
        }
 private void WriteNullReference(ITypeHandler4 handler)
 {
     if (IsIndirectedWithinSlot(handler))
     {
         WriteNullLink();
         return;
     }
     Handlers4.Write(handler, this, Handlers4.NullRepresentationInUntypedArrays(handler
                                                                                ));
 }
Ejemplo n.º 5
0
        private object WriteAndRead(object obj)
        {
            int             imaginativeID = 500;
            ObjectReference @ref          = new ObjectReference(ClassMetadataForObject(obj), imaginativeID
                                                                );

            @ref.SetObject(obj);
            MarshallingContext marshallingContext = new MarshallingContext(Trans(), @ref, Container
                                                                               ().UpdateDepthProvider().ForDepth(int.MaxValue), true);

            Handlers4.Write(@ref.ClassMetadata().TypeHandler(), marshallingContext, obj);
            Pointer4        pointer = marshallingContext.AllocateSlot();
            ByteArrayBuffer buffer  = marshallingContext.ToWriteBuffer(pointer);

            buffer.Seek(0);
            //        String str = new String(buffer._buffer);
            //        System.out.println(str);
            UnmarshallingContext unmarshallingContext = new UnmarshallingContext(Trans(), @ref
                                                                                 , Const4.AddToIdTree, false);

            unmarshallingContext.Buffer(buffer);
            unmarshallingContext.ActivationDepth(new LegacyActivationDepth(5));
            return(unmarshallingContext.Read());
        }
Ejemplo n.º 6
0
 public virtual void WriteObject(ITypeHandler4 handler, object obj)
 {
     Handlers4.Write(handler, this, obj);
 }