示例#1
0
        public virtual ObjectID ReadObjectID(IInternalReadContext context)
        {
            int payloadOffset = context.ReadInt();

            if (payloadOffset == 0)
            {
                return(ObjectID.IsNull);
            }
            int           savedOffset = context.Offset();
            ITypeHandler4 typeHandler = ReadTypeHandler(context, payloadOffset);

            if (typeHandler == null)
            {
                context.Seek(savedOffset);
                return(ObjectID.IsNull);
            }
            SeekSecondaryOffset(context, typeHandler);
            if (typeHandler is IReadsObjectIds)
            {
                ObjectID readObjectID = ((IReadsObjectIds)typeHandler).ReadObjectID(context);
                context.Seek(savedOffset);
                return(readObjectID);
            }
            context.Seek(savedOffset);
            return(ObjectID.NotPossible);
        }
示例#2
0
        // do nothing, no longer needed in current implementation.
        public virtual object Read(IReadContext readContext)
        {
            IInternalReadContext context = (IInternalReadContext)readContext;
            int payloadOffset            = context.ReadInt();

            if (payloadOffset == 0)
            {
                context.NotifyNullReferenceSkipped();
                return(null);
            }
            int savedOffSet = context.Offset();

            try
            {
                ITypeHandler4 typeHandler = ReadTypeHandler(context, payloadOffset);
                if (typeHandler == null)
                {
                    return(null);
                }
                SeekSecondaryOffset(context, typeHandler);
                if (IsPlainObject(typeHandler))
                {
                    return(context.ReadAtCurrentSeekPosition(new PlainObjectHandler()));
                }
                return(context.ReadAtCurrentSeekPosition(typeHandler));
            }
            finally
            {
                context.Seek(savedOffSet);
            }
        }
示例#3
0
        //      throw new IllegalStateException();
        public virtual void CollectIDs(QueryingReadContext readContext)
        {
            IInternalReadContext context = (IInternalReadContext)readContext;
            int payloadOffset            = context.ReadInt();

            if (payloadOffset == 0)
            {
                return;
            }
            int savedOffSet = context.Offset();

            try
            {
                ITypeHandler4 typeHandler = ReadTypeHandler(context, payloadOffset);
                if (typeHandler == null)
                {
                    return;
                }
                SeekSecondaryOffset(context, typeHandler);
                if (IsPlainObject(typeHandler))
                {
                    readContext.Collector().AddId(readContext.ReadInt());
                    return;
                }
                CollectIdContext collectIdContext = new _CollectIdContext_203(readContext, readContext
                                                                              .Transaction(), readContext.Collector(), null, readContext.Buffer());
                Handlers4.CollectIdsInternal(collectIdContext, context.Container().Handlers.CorrectHandlerVersion
                                                 (typeHandler, context.HandlerVersion()), 0, false);
            }
            finally
            {
                context.Seek(savedOffSet);
            }
        }
示例#4
0
		public static Db4objects.Db4o.Internal.ObjectID Read(IInternalReadContext context
			)
		{
			int id = context.ReadInt();
			return id == 0 ? Db4objects.Db4o.Internal.ObjectID.IsNull : new Db4objects.Db4o.Internal.ObjectID
				(id);
		}
示例#5
0
        public static Db4objects.Db4o.Internal.ObjectID Read(IInternalReadContext context
                                                             )
        {
            int id = context.ReadInt();

            return(id == 0 ? Db4objects.Db4o.Internal.ObjectID.IsNull : new Db4objects.Db4o.Internal.ObjectID
                       (id));
        }
示例#6
0
        protected virtual ITypeHandler4 ReadTypeHandler(IInternalReadContext context, int
                                                        payloadOffset)
        {
            context.Seek(payloadOffset);
            ITypeHandler4 typeHandler = Container().TypeHandlerForClassMetadataID(context.ReadInt
                                                                                      ());

            return(HandlerRegistry.CorrectHandlerVersion(context, typeHandler));
        }
示例#7
0
文件: ObjectID.cs 项目: masroore/db4o
 public static ObjectID Read(IInternalReadContext context
     )
 {
     var id = context.ReadInt();
     return id == 0
         ? IsNull
         : new ObjectID
             (id);
 }
示例#8
0
文件: ObjectID.cs 项目: pondyond/db4o
        public static ObjectID Read(IInternalReadContext context
                                    )
        {
            var id = context.ReadInt();

            return(id == 0
                ? IsNull
                : new ObjectID
                       (id));
        }
示例#9
0
        public virtual ITypeHandler4 ReadTypeHandlerRestoreOffset(IInternalReadContext context
                                                                  )
        {
            int           savedOffset   = context.Offset();
            int           payloadOffset = context.ReadInt();
            ITypeHandler4 typeHandler   = payloadOffset == 0 ? null : ReadTypeHandler(context,
                                                                                      payloadOffset);

            context.Seek(savedOffset);
            return(typeHandler);
        }
示例#10
0
        public override object Read(IReadContext readContext)
        {
            IInternalReadContext context = (IInternalReadContext)readContext;
            ByteArrayBuffer      buffer  = (ByteArrayBuffer)context.ReadIndirectedBuffer();

            if (buffer == null)
            {
                return(null);
            }
            // With the following line we ask the context to work with
            // a different buffer. Should this logic ever be needed by
            // a user handler, it should be implemented by using a Queue
            // in the UnmarshallingContext.
            // The buffer has to be set back from the outside!  See below
            IReadBuffer contextBuffer = context.Buffer(buffer);
            object      array         = base.Read(context);

            // The context buffer has to be set back.
            context.Buffer(contextBuffer);
            return(array);
        }
示例#11
0
		public virtual ObjectID ReadObjectID(IInternalReadContext context)
		{
			int payloadOffset = context.ReadInt();
			if (payloadOffset == 0)
			{
				return ObjectID.IsNull;
			}
			int savedOffset = context.Offset();
			ITypeHandler4 typeHandler = ReadTypeHandler(context, payloadOffset);
			if (typeHandler == null)
			{
				context.Seek(savedOffset);
				return ObjectID.IsNull;
			}
			SeekSecondaryOffset(context, typeHandler);
			if (typeHandler is IReadsObjectIds)
			{
				ObjectID readObjectID = ((IReadsObjectIds)typeHandler).ReadObjectID(context);
				context.Seek(savedOffset);
				return readObjectID;
			}
			context.Seek(savedOffset);
			return ObjectID.NotPossible;
		}
 public virtual ObjectID ReadObjectID(IInternalReadContext context)
 {
     return(ObjectID.Read(context));
 }
 public virtual ObjectID ReadObjectID(IInternalReadContext context)
 {
     return ObjectID.Read(context);
 }
示例#14
0
        public override ObjectID ReadObjectID(IInternalReadContext context)
        {
            int id = context.ReadInt();

            return(id == 0 ? ObjectID.IsNull : new ObjectID(id));
        }
示例#15
0
		public override ObjectID ReadObjectID(IInternalReadContext context)
		{
			int id = context.ReadInt();
			return id == 0 ? ObjectID.IsNull : new ObjectID(id);
		}
示例#16
0
		public virtual ITypeHandler4 ReadTypeHandlerRestoreOffset(IInternalReadContext context
			)
		{
			int savedOffset = context.Offset();
			int payloadOffset = context.ReadInt();
			ITypeHandler4 typeHandler = payloadOffset == 0 ? null : ReadTypeHandler(context, 
				payloadOffset);
			context.Seek(savedOffset);
			return typeHandler;
		}
示例#17
0
		protected virtual ITypeHandler4 ReadTypeHandler(IInternalReadContext context, int
			 payloadOffset)
		{
			context.Seek(payloadOffset);
			ITypeHandler4 typeHandler = Container().TypeHandlerForClassMetadataID(context.ReadInt
				());
			return HandlerRegistry.CorrectHandlerVersion(context, typeHandler);
		}