示例#1
0
        public HeapOnNodeGenerator(IHeapOnNodeEncoder encoder, IDataTreeAllocator dataTreeAllocator)
        {
            this.encoder           = encoder;
            this.dataTreeAllocator = dataTreeAllocator;

            externalDataBlocks       = new List <ExternalDataBlockForHeapOnNode>();
            currentExternalDataBlock = new ExternalDataBlockForHeapOnNode(blockIndex: 0);
        }
示例#2
0
        private HID AllocateItemToCurrentExternalDataBlock(BinaryData value, bool isUserRoot)
        {
            if (currentExternalDataBlock.FreeSpaceSize > value.Length + 2)
            {
                return(currentExternalDataBlock.AddItem(value, isUserRoot));
            }

            externalDataBlocks.Add(currentExternalDataBlock);

            currentExternalDataBlock = new ExternalDataBlockForHeapOnNode(currentExternalDataBlock.BlockIndex + 1);

            return(currentExternalDataBlock.AddItem(value, isUserRoot));
        }