public FractalHeapDirectBlock(FractalHeapHeader header, H5BinaryReader reader, Superblock superblock) : base(reader) { _superblock = superblock; var headerSize = 0UL; // signature var signature = reader.ReadBytes(4); headerSize += 4; H5Utils.ValidateSignature(signature, FractalHeapDirectBlock.Signature); // version this.Version = reader.ReadByte(); headerSize += 1; // heap header address this.HeapHeaderAddress = superblock.ReadOffset(reader); headerSize += superblock.OffsetsSize; // block offset var blockOffsetFieldSize = (int)Math.Ceiling(header.MaximumHeapSize / 8.0); this.BlockOffset = H5Utils.ReadUlong(this.Reader, (ulong)blockOffsetFieldSize); headerSize += (ulong)blockOffsetFieldSize; // checksum if (header.Flags.HasFlag(FractalHeapHeaderFlags.DirectBlocksAreChecksummed)) { this.Checksum = reader.ReadUInt32(); headerSize += 4; } this.HeaderSize = headerSize; }
public ManagedObjectsFractalHeapId(H5BinaryReader reader, H5BinaryReader localReader, FractalHeapHeader header, ulong offsetByteCount, ulong lengthByteCount) { _reader = reader; _header = header; this.Offset = H5Utils.ReadUlong(localReader, offsetByteCount); this.Length = H5Utils.ReadUlong(localReader, lengthByteCount); }
internal HugeObjectsFractalHeapIdSubType1(H5BinaryReader reader, Superblock superblock, H5BinaryReader localReader, FractalHeapHeader header) { _reader = reader; _superblock = superblock; _heapHeader = header; // BTree2 key this.BTree2Key = H5Utils.ReadUlong(localReader, header.HugeIdsSize); }
public FractalHeapIndirectBlock(FractalHeapHeader header, H5BinaryReader reader, Superblock superblock, uint rowCount) : base(reader) { _superblock = superblock; this.RowCount = rowCount; // signature var signature = reader.ReadBytes(4); H5Utils.ValidateSignature(signature, FractalHeapIndirectBlock.Signature); // version this.Version = reader.ReadByte(); // heap header address this.HeapHeaderAddress = superblock.ReadOffset(reader); // block offset var blockOffsetFieldSize = (int)Math.Ceiling(header.MaximumHeapSize / 8.0); this.BlockOffset = H5Utils.ReadUlong(this.Reader, (ulong)blockOffsetFieldSize); // H5HFcache.c (H5HF__cache_iblock_deserialize) var length = rowCount * header.TableWidth; this.Entries = new FractalHeapEntry[length]; for (uint i = 0; i < this.Entries.Length; i++) { /* Decode child block address */ this.Entries[i].Address = _superblock.ReadOffset(reader); /* Check for heap with I/O filters */ if (header.IOFilterEncodedLength > 0) { /* Decode extra information for direct blocks */ if (i < (header.MaxDirectRows * header.TableWidth)) { /* Size of filtered direct block */ this.Entries[i].FilteredSize = _superblock.ReadLength(reader); /* I/O filter mask for filtered direct block */ this.Entries[i].FilterMask = reader.ReadUInt32(); } } /* Count child blocks */ if (!superblock.IsUndefinedAddress(this.Entries[i].Address)) { this.ChildCount++; this.MaxChildIndex = i; } } // checksum this.Checksum = reader.ReadUInt32(); }
internal static FractalHeapId Construct(H5Context context, H5BinaryReader localReader, FractalHeapHeader header) { var firstByte = localReader.ReadByte(); // bits 6-7 var version = (byte)((firstByte & 0xB0) >> 6); if (version != 0) { throw new FormatException($"Only version 0 instances of type {nameof(FractalHeapId)} are supported."); } // bits 4-5 var type = (FractalHeapIdType)((firstByte & 0x30) >> 4); // offset and length Size (for managed objects fractal heap id) var offsetSize = (ulong)Math.Ceiling(header.MaximumHeapSize / 8.0); #warning Is -1 correct? var lengthSize = H5Utils.FindMinByteCount(header.MaximumDirectBlockSize - 1); // H5HF.c (H5HF_op) return((FractalHeapId)((type, header.HugeIdsAreDirect, header.IOFilterEncodedLength, header.TinyObjectsAreExtended) switch { (FractalHeapIdType.Managed, _, _, _) => new ManagedObjectsFractalHeapId(context.Reader, localReader, header, offsetSize, lengthSize), // H5HFhuge.c (H5HF__huge_op_real) (FractalHeapIdType.Huge, false, 0, _) => new HugeObjectsFractalHeapIdSubType1(context.Reader, context.Superblock, localReader, header), (FractalHeapIdType.Huge, false, _, _) => new HugeObjectsFractalHeapIdSubType2(context.Reader, context.Superblock, localReader, header), (FractalHeapIdType.Huge, true, 0, _) => new HugeObjectsFractalHeapIdSubType3(context.Reader, context.Superblock, localReader), (FractalHeapIdType.Huge, true, _, _) => new HugeObjectsFractalHeapIdSubType4(context.Reader, context.Superblock, localReader), // H5HFtiny.c (H5HF_tiny_op_real) (FractalHeapIdType.Tiny, _, _, false) => new TinyObjectsFractalHeapIdSubType1(localReader, firstByte), (FractalHeapIdType.Tiny, _, _, true) => new TinyObjectsFractalHeapIdSubType2(localReader, firstByte), // default _ => throw new Exception($"Unknown heap ID type '{type}'.") }));
public HugeObjectsFractalHeapIdSubType2(H5BinaryReader reader, Superblock superblock, H5BinaryReader localReader, FractalHeapHeader header) : base(reader, superblock, localReader, header) { // }