Example #1
0
 private void ReadArrayCandidates(ITypeHandler4 typeHandler, IReadBuffer buffer, ITypeHandler4
     arrayElementHandler, QCandidates candidates)
 {
     if (!Handlers4.IsCascading(arrayElementHandler))
     {
         return;
     }
     SlotFormat slotFormat = SlotFormat.ForHandlerVersion(_handlerVersion);
     slotFormat.DoWithSlotIndirection(buffer, typeHandler, new _IClosure4_318(this, arrayElementHandler
         , buffer, candidates));
 }
Example #2
0
        public static void CollectIdsInternal(CollectIdContext context, ITypeHandler4 handler
                                              , int linkLength, bool doWithSlotIndirection)
        {
            if (!(IsCascading(handler)))
            {
                IReadBuffer buffer = context.Buffer();
                buffer.Seek(buffer.Offset() + linkLength);
                return;
            }
            if (handler is StandardReferenceTypeHandler)
            {
                context.AddId();
                return;
            }
            LocalObjectContainer container  = (LocalObjectContainer)context.Container();
            SlotFormat           slotFormat = context.SlotFormat();

            if (HandleAsObject(handler))
            {
                // TODO: Code is similar to QCandidate.readArrayCandidates. Try to refactor to one place.
                int             collectionID     = context.ReadInt();
                ByteArrayBuffer collectionBuffer = container.ReadBufferById(context.Transaction()
                                                                            , collectionID);
                ObjectHeader        objectHeader = new ObjectHeader(container, collectionBuffer);
                QueryingReadContext subContext   = new QueryingReadContext(context.Transaction(), context
                                                                           .HandlerVersion(), collectionBuffer, collectionID, context.Collector());
                objectHeader.ClassMetadata().CollectIDs(subContext);
                return;
            }
            QueryingReadContext queryingReadContext = new QueryingReadContext(context.Transaction
                                                                                  (), context.HandlerVersion(), context.Buffer(), 0, context.Collector());
            IClosure4 collectIDsFromQueryingContext = new _IClosure4_263(handler, queryingReadContext
                                                                         );

            if (doWithSlotIndirection)
            {
                slotFormat.DoWithSlotIndirection(queryingReadContext, handler, collectIDsFromQueryingContext
                                                 );
            }
            else
            {
                collectIDsFromQueryingContext.Run();
            }
        }