示例#1
0
        public SymbolTableEntry(H5BinaryReader reader, Superblock superblock) : base(reader)
        {
            _superblock = superblock;

            // link name offset
            this.LinkNameOffset = superblock.ReadOffset(reader);

            // object header address
            this.HeaderAddress = superblock.ReadOffset(reader);

            // cache type
            this.CacheType = (CacheType)reader.ReadUInt32();

            // reserved
            reader.ReadUInt32();

            // scratch pad
            var before = reader.BaseStream.Position;

            this.ScratchPad = this.CacheType switch
            {
                CacheType.NoCache => null,
                CacheType.ObjectHeader => new ObjectHeaderScratchPad(reader, superblock),
                CacheType.SymbolicLink => new SymbolicLinkScratchPad(reader),
                _ => throw new NotSupportedException()
            };

            var after  = reader.BaseStream.Position;
            var length = after - before;

            // read as many bytes as needed to read a total of 16 bytes, even if the scratch pad is not used
            reader.ReadBytes((int)(16 - length));
        }
        public SymbolTableMessage(H5BinaryReader reader, Superblock superblock) : base(reader)
        {
            _superblock = superblock;

            this.BTree1Address    = superblock.ReadOffset(reader);
            this.LocalHeapAddress = superblock.ReadOffset(reader);
        }
示例#3
0
        public GlobalHeapObject(H5BinaryReader reader, Superblock superblock) : base(reader)
        {
            // heap object index
            this.HeapObjectIndex = reader.ReadUInt16();

            if (this.HeapObjectIndex == 0)
            {
                return;
            }

            // reference count
            this.ReferenceCount = reader.ReadUInt16();

            // reserved
            reader.ReadBytes(4);

            // object size
            var objectSize = superblock.ReadLength(reader);

            // object data
            this.ObjectData = reader.ReadBytes((int)objectSize);

            var paddedSize    = (int)(Math.Ceiling(objectSize / 8.0) * 8);
            var remainingSize = paddedSize - (int)objectSize;

            reader.ReadBytes(remainingSize);
        }
示例#4
0
        public FixedArrayHeader(H5BinaryReader reader, Superblock superblock, uint chunkSizeLength) : base(reader)
        {
            _superblock      = superblock;
            _chunkSizeLength = chunkSizeLength;

            // signature
            var signature = reader.ReadBytes(4);

            H5Utils.ValidateSignature(signature, FixedArrayHeader.Signature);

            // version
            this.Version = reader.ReadByte();

            // client ID
            this.ClientID = (ClientID)reader.ReadByte();

            // entry size
            this.EntrySize = reader.ReadByte();

            // page bits
            this.PageBits = reader.ReadByte();

            // entries count
            this.EntriesCount = superblock.ReadLength(reader);

            // data block address
            this.DataBlockAddress = superblock.ReadOffset(reader);

            // checksum
            this.Checksum = reader.ReadUInt32();
        }
        public static H5File GetH5File(Superblock superblock, string absoluteFilePath)
        {
            if (!Uri.TryCreate(absoluteFilePath, UriKind.Absolute, out var uri))
            {
                throw new Exception("The provided path is not absolute.");
            }

            if (!uri.IsFile && !uri.IsUnc)
            {
                throw new Exception("The provided path is not a file path or aN UNC path.");
            }

            if (!_fileMap.TryGetValue(superblock, out var pathToH5FileMap))
            {
                pathToH5FileMap      = new Dictionary <string, H5File>();
                _fileMap[superblock] = pathToH5FileMap;
            }

            if (!pathToH5FileMap.TryGetValue(uri.AbsoluteUri, out var h5File))
            {
#warning This does not correspond to https://support.hdfgroup.org/HDF5/doc/RM/H5L/H5Lcreate_external.htm
                h5File = H5File.Open(uri.LocalPath, FileMode.Open, FileAccess.Read, FileShare.Read);
                pathToH5FileMap[uri.AbsoluteUri] = h5File;
            }

            return(h5File);
        }
        public ObjectHeaderScratchPad(H5BinaryReader reader, Superblock superblock) : base(reader)
        {
            _superblock = superblock;

            this.BTree1Address   = superblock.ReadLength(reader);
            this.NameHeapAddress = superblock.ReadLength(reader);
        }
示例#7
0
        public GlobalHeapCollection(H5BinaryReader reader, Superblock superblock) : base(reader)
        {
            // signature
            var signature = reader.ReadBytes(4);

            H5Utils.ValidateSignature(signature, GlobalHeapCollection.Signature);

            // version
            this.Version = reader.ReadByte();

            // reserved
            reader.ReadBytes(3);

            // collection size
            this.CollectionSize = superblock.ReadLength(reader);

            // global heap objects
            this.GlobalHeapObjects = new List <GlobalHeapObject>();

            var headerSize = 8UL + superblock.LengthsSize;
            var remaining  = this.CollectionSize;

            while (remaining > headerSize)
            {
                var before           = reader.BaseStream.Position;
                var globalHeapObject = new GlobalHeapObject(reader, superblock);
                this.GlobalHeapObjects.Add(globalHeapObject);
                var after    = reader.BaseStream.Position;
                var consumed = (ulong)(after - before);

                remaining -= consumed;
            }
        }
示例#8
0
        public BTree2InternalNode(H5BinaryReader reader, Superblock superblock, BTree2Header <T> header, ushort recordCount, int nodeLevel, Func <T> decodeKey)
            : base(reader, header, recordCount, BTree2InternalNode <T> .Signature, decodeKey)
        {
            this.NodePointers = new BTree2NodePointer[recordCount + 1];

            // H5B2cache.c (H5B2__cache_int_deserialize)
            for (int i = 0; i < recordCount + 1; i++)
            {
                // address
                this.NodePointers[i].Address = superblock.ReadOffset(reader);

                // record count
                var childRecordCount = H5Utils.ReadUlong(reader, header.MaxRecordCountSize);
                this.NodePointers[i].RecordCount = (ushort)childRecordCount;

                // total record count
                if (nodeLevel > 1)
                {
                    var totalChildRecordCount = H5Utils.ReadUlong(reader, header.NodeInfos[nodeLevel - 1].CumulatedTotalRecordCountSize);
                    this.NodePointers[i].TotalRecordCount = totalChildRecordCount;
                }
                else
                {
                    this.NodePointers[i].TotalRecordCount = childRecordCount;
                }
            }

            // checksum
            this.Checksum = reader.ReadUInt32();
        }
示例#9
0
        public AttributeInfoMessage(H5BinaryReader reader, Superblock superblock) : base(reader)
        {
            _superblock = superblock;

            // version
            this.Version = reader.ReadByte();

            // flags
            this.Flags = (CreationOrderFlags)reader.ReadByte();

            // maximum creation index
            if (this.Flags.HasFlag(CreationOrderFlags.TrackCreationOrder))
            {
                this.MaximumCreationIndex = reader.ReadUInt16();
            }

            // fractal heap address
            this.FractalHeapAddress = superblock.ReadOffset(reader);

            // b-tree 2 name index address
            this.BTree2NameIndexAddress = superblock.ReadOffset(reader);

            // b-tree 2 creation order index address
            if (this.Flags.HasFlag(CreationOrderFlags.IndexCreationOrder))
            {
                this.BTree2CreationOrderIndexAddress = superblock.ReadOffset(reader);
            }
        }
示例#10
0
        public BTree1Node(H5BinaryReader reader, Superblock superblock, Func <T> decodeKey)
        {
            _reader     = reader;
            _superblock = superblock;
            _decodeKey  = decodeKey;

            var signature = reader.ReadBytes(4);

            H5Utils.ValidateSignature(signature, BTree1Node <T> .Signature);

            this.NodeType    = (BTree1NodeType)reader.ReadByte();
            this.NodeLevel   = reader.ReadByte();
            this.EntriesUsed = reader.ReadUInt16();

            this.LeftSiblingAddress  = superblock.ReadOffset(reader);
            this.RightSiblingAddress = superblock.ReadOffset(reader);

            this.Keys           = new T[this.EntriesUsed + 1];
            this.ChildAddresses = new ulong[this.EntriesUsed];

            for (int i = 0; i < this.EntriesUsed; i++)
            {
                this.Keys[i]           = decodeKey();
                this.ChildAddresses[i] = superblock.ReadOffset(reader);
            }

            this.Keys[this.EntriesUsed] = decodeKey();
        }
示例#11
0
        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 ExternalFileListMessage(H5BinaryReader reader, Superblock superblock) : base(reader)
        {
            _superblock = superblock;

            // version
            this.Version = reader.ReadByte();

            // reserved
            reader.ReadBytes(3);

#warning Its value must be at least as large as the value contained in the Used Slots field.
            // allocated slot count
            this.AllocatedSlotCount = reader.ReadUInt16();

            // used slot count
            this.UsedSlotCount = reader.ReadUInt16();

            // heap address
            this.HeapAddress = superblock.ReadOffset(reader);

            // slot definitions
            this.SlotDefinitions = new ExternalFileListSlot[this.UsedSlotCount];

            for (int i = 0; i < this.UsedSlotCount; i++)
            {
                this.SlotDefinitions[i] = new ExternalFileListSlot(reader, superblock);
            }
        }
        public DataspaceMessage(H5BinaryReader reader, Superblock superblock) : base(reader)
        {
            this.Version = reader.ReadByte();
            this.Rank    = reader.ReadByte();
            var flags = (DataspaceMessageFlags)reader.ReadByte();

            if (this.Version == 1)
            {
                if (this.Rank > 0)
                {
                    this.Type = DataspaceType.Simple;
                }
                else
                {
                    this.Type = DataspaceType.Scalar;
                }

                reader.ReadBytes(5);
            }
            else
            {
                this.Type = (DataspaceType)reader.ReadByte();
            }

            this.DimensionSizes = new ulong[this.Rank];

            var dimensionMaxSizesArePresent  = flags.HasFlag(DataspaceMessageFlags.DimensionMaxSizes);
            var permutationIndicesArePresent = flags.HasFlag(DataspaceMessageFlags.PermuationIndices);

            for (int i = 0; i < this.Rank; i++)
            {
                this.DimensionSizes[i] = superblock.ReadLength(reader);
            }

            if (dimensionMaxSizesArePresent)
            {
                this.DimensionMaxSizes = new ulong[this.Rank];

                for (int i = 0; i < this.Rank; i++)
                {
                    this.DimensionMaxSizes[i] = superblock.ReadLength(reader);
                }
            }
            else
            {
                this.DimensionMaxSizes = this.DimensionSizes.ToArray();
            }

            if (permutationIndicesArePresent)
            {
                this.PermutationIndices = new ulong[this.Rank];

                for (int i = 0; i < this.Rank; i++)
                {
                    this.PermutationIndices[i] = superblock.ReadLength(reader);
                }
            }
        }
示例#14
0
        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();
        }
示例#15
0
        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 HugeObjectsFractalHeapIdSubType3(H5BinaryReader reader, Superblock superblock, H5BinaryReader localReader)
        {
            _reader = reader;

            // address
            this.Address = superblock.ReadOffset(localReader);

            // length
            this.Length = superblock.ReadLength(localReader);
        }
示例#17
0
        public SharedMessageTableMessage(H5BinaryReader reader, Superblock superblock) : base(reader)
        {
            // version
            this.Version = reader.ReadByte();

            // shared object header message table address
            this.SharedObjectHeaderMessageTableAddress = superblock.ReadOffset(reader);

            // index count
            this.IndexCount = reader.ReadByte();
        }
示例#18
0
        public SharedMessage3(H5BinaryReader reader, Superblock superblock) : base(reader)
        {
            // version
            this.Version = reader.ReadByte();

            // type
            this.Type = (SharedMessageLocation)reader.ReadByte();

            // address
            this.Location = superblock.ReadOffset(reader);
#warning the content could also be an 8 byte fractal heap ID
        }
示例#19
0
        public FreeSpaceManagerHeader(H5BinaryReader reader, Superblock superblock) : base(reader)
        {
            // signature
            var signature = reader.ReadBytes(4);

            H5Utils.ValidateSignature(signature, FreeSpaceManagerHeader.Signature);

            // version
            this.Version = reader.ReadByte();

            // client ID
            this.ClientId = (ClientId)reader.ReadByte();

            // total space tracked
            this.TotalSpaceTracked = superblock.ReadLength(reader);

            // total sections count
            this.TotalSectionsCount = superblock.ReadLength(reader);

            // serialized sections count
            this.SerializedSectionsCount = superblock.ReadLength(reader);

            // un-serialized sections count
            this.UnSerializedSectionsCount = superblock.ReadLength(reader);

            // section classes count
            this.SectionClassesCount = reader.ReadUInt16();

            // shrink percent
            this.ShrinkPercent = reader.ReadUInt16();

            // expand percent
            this.ExpandPercent = reader.ReadUInt16();

            // address space size
            this.AddressSpaceSize = reader.ReadUInt16();

            // maximum section size
            this.MaximumSectionSize = superblock.ReadLength(reader);

            // serialized section list address
            this.SerializedSectionListAddress = superblock.ReadOffset(reader);

            // serialized section list used
            this.SerializedSectionListUsed = superblock.ReadLength(reader);

            // serialized section list allocated size
            this.SerializedSectionListAllocatedSize = superblock.ReadLength(reader);

            // checksum
            this.Checksum = reader.ReadUInt32();
        }
示例#20
0
        public static DataLayoutMessage Construct(H5BinaryReader reader, Superblock superblock)
        {
            // get version
            var version = reader.ReadByte();

            return(version switch
            {
                1 => new DataLayoutMessage12(reader, superblock, version),
                2 => new DataLayoutMessage12(reader, superblock, version),
                3 => new DataLayoutMessage3(reader, superblock, version),
                4 => new DataLayoutMessage4(reader, superblock, version),
                _ => throw new NotSupportedException($"The data layout message version '{version}' is not supported.")
            });
示例#21
0
        public ExtensibleArrayIndexBlock(
            H5BinaryReader reader,
            Superblock superblock,
            ExtensibleArrayHeader header,
            Func <H5BinaryReader, T> decode)
        {
            // H5EAiblock.c (H5EA__iblock_alloc)
            this.SecondaryBlockDataBlockAddressCount = 2 * (ulong)Math.Log(header.SecondaryBlockMinimumDataBlockPointerCount, 2);
            ulong dataBlockPointerCount      = (ulong)(2 * (header.SecondaryBlockMinimumDataBlockPointerCount - 1));
            ulong secondaryBlockPointerCount = header.SecondaryBlockCount - this.SecondaryBlockDataBlockAddressCount;

            // signature
            var signature = reader.ReadBytes(4);

            H5Utils.ValidateSignature(signature, ExtensibleArrayIndexBlock <T> .Signature);

            // version
            this.Version = reader.ReadByte();

            // client ID
            this.ClientID = (ClientID)reader.ReadByte();

            // header address
            this.HeaderAddress = superblock.ReadOffset(reader);

            // elements
            this.Elements = Enumerable
                            .Range(0, header.IndexBlockElementsCount)
                            .Select(i => decode(reader))
                            .ToArray();

            // data block addresses
            this.DataBlockAddresses = new ulong[dataBlockPointerCount];

            for (ulong i = 0; i < dataBlockPointerCount; i++)
            {
                this.DataBlockAddresses[i] = superblock.ReadOffset(reader);
            }

            // secondary block addresses
            this.SecondaryBlockAddresses = new ulong[secondaryBlockPointerCount];

            for (ulong i = 0; i < secondaryBlockPointerCount; i++)
            {
                this.SecondaryBlockAddresses[i] = superblock.ReadOffset(reader);
            }

            // checksum
            this.Checksum = reader.ReadUInt32();
        }
        public HugeObjectsFractalHeapIdSubType4(H5BinaryReader reader, Superblock superblock, H5BinaryReader localReader)
        {
            // address
            this.Address = superblock.ReadOffset(localReader);

            // length
            this.Length = superblock.ReadLength(localReader);

            // filter mask
            this.FilterMask = localReader.ReadUInt32();

            // de-filtered size
            this.DeFilteredSize = superblock.ReadLength(localReader);
        }
示例#23
0
        public LinkMessage(H5BinaryReader reader, Superblock superblock) : base(reader)
        {
            // version
            this.Version = reader.ReadByte();

            // flags
            this.Flags = reader.ReadByte();

            // link type
            var isLinkTypeFieldPresent = (this.Flags & (1 << 3)) > 0;

            if (isLinkTypeFieldPresent)
            {
                this.LinkType = (LinkType)reader.ReadByte();
            }

            // creation order
            var isCreationOrderFieldPresent = (this.Flags & (1 << 2)) > 0;

            if (isCreationOrderFieldPresent)
            {
                this.CreationOrder = reader.ReadUInt64();
            }

            // link name encoding
            var isLinkNameEncodingFieldPresent = (this.Flags & (1 << 4)) > 0;

            if (isLinkNameEncodingFieldPresent)
            {
                this.LinkNameEncoding = (CharacterSetEncoding)reader.ReadByte();
            }

            // link length
            var linkLengthFieldLength = (ulong)(1 << (this.Flags & 0x03));
            var linkNameLength        = H5Utils.ReadUlong(this.Reader, linkLengthFieldLength);

            // link name
            this.LinkName = H5Utils.ReadFixedLengthString(reader, (int)linkNameLength, this.LinkNameEncoding);

            // link info
            this.LinkInfo = this.LinkType switch
            {
                LinkType.Hard => new HardLinkInfo(reader, superblock),
                LinkType.Soft => new SoftLinkInfo(reader),
                LinkType.External => new ExternalLinkInfo(reader),
                _ when(65 <= (byte)this.LinkType && (byte)this.LinkType <= 255) => new UserDefinedLinkInfo(reader),
                _ => throw new NotSupportedException($"The link message link type '{this.LinkType}' is not supported.")
            };
        }
        internal DataLayoutMessage12(H5BinaryReader reader, Superblock superblock, byte version) : base(reader)
        {
            // version
            this.Version = version;

            // rank
            this.Rank = reader.ReadByte();

            // layout class
            this.LayoutClass = (LayoutClass)reader.ReadByte();

            // reserved
            reader.ReadBytes(5);

            // data address
            this.Address = this.LayoutClass switch
            {
                LayoutClass.Compact => ulong.MaxValue,     // invalid address
                LayoutClass.Contiguous => superblock.ReadOffset(reader),
                LayoutClass.Chunked => superblock.ReadOffset(reader),
                _ => throw new NotSupportedException($"The layout class '{this.LayoutClass}' is not supported.")
            };

            // dimension sizes
            this.DimensionSizes = new uint[this.Rank];

            for (int i = 0; i < this.Rank; i++)
            {
                this.DimensionSizes[i] = reader.ReadUInt32();
            }

            // dataset element size
            if (this.LayoutClass == LayoutClass.Chunked)
            {
                this.DatasetElementSize = reader.ReadUInt32();
            }

            // compact data size
            if (this.LayoutClass == LayoutClass.Compact)
            {
                var compactDataSize = reader.ReadUInt32();
                this.CompactData = reader.ReadBytes((int)compactDataSize);
            }
            else
            {
                this.CompactData = new byte[0];
            }
        }
示例#25
0
        public SharedMessage12(H5BinaryReader reader, Superblock superblock) : base(reader)
        {
            // version
            this.Version = reader.ReadByte();

            // type
            this.Type = reader.ReadByte();

            // reserved
            if (this.Version == 1)
            {
                reader.ReadBytes(6);
            }

            // address
            this.Address = superblock.ReadOffset(reader);
        }
示例#26
0
        public ExtensibleArrayDataBlock(H5BinaryReader reader, Superblock superblock, ExtensibleArrayHeader header, ulong elementCount, Func <H5BinaryReader, T> decode)
        {
            // H5EAdblock.c (H5EA__dblock_alloc)
            this.PageCount = 0UL;

            if (elementCount > header.DataBlockPageElementsCount)
            {
                /* Set the # of pages in the data block */
                this.PageCount = elementCount / header.DataBlockPageElementsCount;
            }

            // H5EAcache.c (H5EA__cache_dblock_deserialize)

            // signature
            var signature = reader.ReadBytes(4);

            H5Utils.ValidateSignature(signature, ExtensibleArrayDataBlock <T> .Signature);

            // version
            this.Version = reader.ReadByte();

            // client ID
            this.ClientID = (ClientID)reader.ReadByte();

            // header address
            this.HeaderAddress = superblock.ReadOffset(reader);

            // block offset
            this.BlockOffset = H5Utils.ReadUlong(reader, header.ArrayOffsetsSize);

            // elements
            if (this.PageCount == 0)
            {
                this.Elements = Enumerable
                                .Range(0, (int)elementCount)
                                .Select(i => decode(reader))
                                .ToArray();
            }
            else
            {
                this.Elements = new T[0];
            }

            // checksum
            this.Checksum = reader.ReadUInt32();
        }
示例#27
0
        public SharedMessage(H5BinaryReader reader, Superblock superblock) : base(reader)
        {
            // H5Oshared.c (H5O__shared_decode)

            // version
            this.Version = reader.ReadByte();

            // type
            if (this.Version == 3)
            {
                this.Type = (SharedMessageLocation)reader.ReadByte();
            }
            else
            {
                reader.ReadByte();
                this.Type = SharedMessageLocation.AnotherObjectsHeader;
            }

            // reserved
            if (this.Version == 1)
            {
                reader.ReadBytes(6);
            }

            // address
            if (this.Version == 1)
            {
                this.Address = superblock.ReadOffset(reader);
            }
            else
            {
                /* If this message is in the heap, copy a heap ID.
                 * Otherwise, it is a named datatype, so copy an H5O_loc_t.
                 */

                if (this.Type == SharedMessageLocation.SharedObjectHeaderMessageHeap)
                {
#warning implement this
                    throw new NotImplementedException("This code path is not yet implemented.");
                }
                else
                {
                    this.Address = superblock.ReadOffset(reader);
                }
            }
        }
        public FixedArrayDataBlock(H5BinaryReader reader, Superblock superblock, FixedArrayHeader header, uint chunkSizeLength)
        {
            // H5FAdblock.c (H5FA__dblock_alloc)
            this.ElementsPerPage = 1UL << header.PageBits;
            this.PageCount       = 0UL;

            var pageBitmapSize = 0UL;

            if (header.EntriesCount > this.ElementsPerPage)
            {
                /* Compute number of pages */
                this.PageCount = (header.EntriesCount + this.ElementsPerPage - 1) / this.ElementsPerPage;

                /* Compute size of 'page init' flag array, in bytes */
                pageBitmapSize = (this.PageCount + 7) / 8;
            }

            // signature
            var signature = reader.ReadBytes(4);

            H5Utils.ValidateSignature(signature, FixedArrayDataBlock.Signature);

            // version
            this.Version = reader.ReadByte();

            // client ID
            this.ClientID = (ClientID)reader.ReadByte();

            // header address
            this.HeaderAddress = superblock.ReadOffset(reader);

            // page bitmap
            if (this.PageCount > 0)
            {
                this.PageBitmap = reader.ReadBytes((int)pageBitmapSize);
            }

            // elements
            else
            {
                this.Elements = ArrayIndexUtils.ReadElements(reader, superblock, header.EntriesCount, this.ClientID, chunkSizeLength);
            }

            // checksum
            this.Checksum = reader.ReadUInt32();
        }
        internal DataLayoutMessage3(H5BinaryReader reader, Superblock superblock, byte version) : base(reader)
        {
            // version
            this.Version = version;

            // layout class
            this.LayoutClass = (LayoutClass)reader.ReadByte();

            // storage property description
            this.Properties = (this.Version, this.LayoutClass) switch
            {
                (_, LayoutClass.Compact) => new CompactStoragePropertyDescription(reader),
                (_, LayoutClass.Contiguous) => new ContiguousStoragePropertyDescription(reader, superblock),
                (3, LayoutClass.Chunked) => new ChunkedStoragePropertyDescription3(reader, superblock),
                (4, LayoutClass.Chunked) => new ChunkedStoragePropertyDescription4(reader, superblock),
                (4, LayoutClass.VirtualStorage) => new VirtualStoragePropertyDescription(reader, superblock),
                _ => throw new NotSupportedException($"The layout class '{this.LayoutClass}' is not supported for the data layout message version '{this.Version}'.")
            };
        }
示例#30
0
        public VdsGlobalHeapBlock(H5BinaryReader reader, Superblock superblock) : base(reader)
        {
            // version
            this.Version = reader.ReadUInt32();

            // entry count
            this.EntryCount = superblock.ReadLength(reader);

            // vds dataset entries
            this.VdsDatasetEntries = new List <VdsDatasetEntry>((int)this.EntryCount);

            for (ulong i = 0; i < this.EntryCount; i++)
            {
                this.VdsDatasetEntries.Add(new VdsDatasetEntry(reader));
            }

            // checksum
            this.Checksum = reader.ReadUInt32();
        }