示例#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));
        }
示例#2
0
        public H5S_SEL_POINTS(H5BinaryReader reader) : base(reader)
        {
            // version
            this.Version = reader.ReadUInt32();

            // reserved
            reader.ReadBytes(4);

            // length
            var length = reader.ReadUInt32();

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

            // point count
            this.PointCount = reader.ReadUInt32();

            // point data
            this.PointData = new uint[this.Rank * this.PointCount];

            for (int i = 0; i < (length - 8) / 4; i++)
            {
                this.PointData[i] = reader.ReadUInt32();
            }
        }
示例#3
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();
        }
        public FillValueMessage(H5BinaryReader reader) : base(reader)
        {
            // version
            this.Version = reader.ReadByte();

            uint size;

            switch (this.Version)
            {
            case 1:

                this.AllocationTime = (SpaceAllocationTime)reader.ReadByte();
                this.FillTime       = (FillValueWriteTime)reader.ReadByte();
                this.IsDefined      = reader.ReadByte() == 1;
                size       = reader.ReadUInt32();
                this.Value = reader.ReadBytes((int)size);

                break;

            case 2:

                this.AllocationTime = (SpaceAllocationTime)reader.ReadByte();
                this.FillTime       = (FillValueWriteTime)reader.ReadByte();
                this.IsDefined      = reader.ReadByte() == 1;

                if (this.IsDefined)
                {
                    size       = reader.ReadUInt32();
                    this.Value = reader.ReadBytes((int)size);
                }

                break;

            case 3:

                var flags = reader.ReadByte();
                this.AllocationTime = (SpaceAllocationTime)((flags & 0x03) >> 0);       // take only bits 0 and 1
                this.FillTime       = (FillValueWriteTime)((flags & 0x0C) >> 2);        // take only bits 2 and 3
                this.IsDefined      = (flags & (1 << 5)) > 0;                           // take only bit 5

                if (this.IsDefined)
                {
                    size       = reader.ReadUInt32();
                    this.Value = reader.ReadBytes((int)size);
                }

                break;

            default:
                break;
            }
        }
        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];
            }
        }
示例#6
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;
        }
示例#7
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();
        }
示例#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 H5S_SEL_ALL(H5BinaryReader reader) : base(reader)
        {
            // version
            this.Version = reader.ReadUInt32();

            // reserved
            reader.ReadBytes(8);
        }
示例#10
0
        public ObjectReferenceCountMessage(H5BinaryReader reader) : base(reader)
        {
            // version
            this.Version = reader.ReadByte();

            // reference count
            this.ReferenceCount = reader.ReadUInt32();
        }
示例#11
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();
        }
示例#12
0
        public DatatypeMessage(H5BinaryReader reader) : base(reader)
        {
            this.ClassVersion = reader.ReadByte();

            this.BitField = this.Class switch
            {
                DatatypeMessageClass.FixedPoint => new FixedPointBitFieldDescription(reader),
                DatatypeMessageClass.FloatingPoint => new FloatingPointBitFieldDescription(reader),
                DatatypeMessageClass.Time => new TimeBitFieldDescription(reader),
                DatatypeMessageClass.String => new StringBitFieldDescription(reader),
                DatatypeMessageClass.BitField => new BitFieldBitFieldDescription(reader),
                DatatypeMessageClass.Opaque => new OpaqueBitFieldDescription(reader),
                DatatypeMessageClass.Compound => new CompoundBitFieldDescription(reader),
                DatatypeMessageClass.Reference => new ReferenceBitFieldDescription(reader),
                DatatypeMessageClass.Enumerated => new EnumerationBitFieldDescription(reader),
                DatatypeMessageClass.VariableLength => new VariableLengthBitFieldDescription(reader),
                DatatypeMessageClass.Array => new ArrayBitFieldDescription(reader),
                _ => throw new NotSupportedException($"The data type message class '{this.Class}' is not supported.")
            };

            this.Size = reader.ReadUInt32();

            var memberCount = 1;

            if (this.Class == DatatypeMessageClass.Compound)
            {
                memberCount = ((CompoundBitFieldDescription)this.BitField).MemberCount;
            }

            this.Properties = new List <DatatypePropertyDescription>(memberCount);

            for (int i = 0; i < memberCount; i++)
            {
                DatatypePropertyDescription?properties = this.Class switch
                {
                    DatatypeMessageClass.FixedPoint => new FixedPointPropertyDescription(reader),
                    DatatypeMessageClass.FloatingPoint => new FloatingPointPropertyDescription(reader),
                    DatatypeMessageClass.Time => new TimePropertyDescription(reader),
                    DatatypeMessageClass.String => null,
                    DatatypeMessageClass.BitField => new BitFieldPropertyDescription(reader),
                    DatatypeMessageClass.Opaque => new OpaquePropertyDescription(reader, this.GetOpaqueTagByteLength()),
                    DatatypeMessageClass.Compound => new CompoundPropertyDescription(reader, this.Version, this.Size),
                    DatatypeMessageClass.Reference => null,
                    DatatypeMessageClass.Enumerated => new EnumerationPropertyDescription(reader, this.Version, this.Size, this.GetEnumMemberCount()),
                    DatatypeMessageClass.VariableLength => new VariableLengthPropertyDescription(reader),
                    DatatypeMessageClass.Array => new ArrayPropertyDescription(reader, this.Version),
                    _ => throw new NotSupportedException($"The class '{this.Class}' is not supported on data type messages of version {this.Version}.")
                };

                if (properties is not null)
                {
                    this.Properties.Add(properties);
                }
            }
        }
示例#13
0
        public ObjectModificationMessage(H5BinaryReader reader) : base(reader)
        {
            // version
            this.Version = reader.ReadByte();

            // reserved
            reader.ReadBytes(3);

            // seconds after unix epoch
            this.SecondsAfterUnixEpoch = reader.ReadUInt32();
        }
示例#14
0
        public DataBlockPage(H5BinaryReader reader, ulong elementCount, Func <H5BinaryReader, T> decode)
        {
            // elements
            this.Elements = Enumerable
                            .Range(0, (int)elementCount)
                            .Select(i => decode(reader))
                            .ToArray();

            // checksum
            this.Checksum = reader.ReadUInt32();
        }
示例#15
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();
        }
示例#16
0
        public DataspaceSelection(H5BinaryReader reader) : base(reader)
        {
            this.SelectionType = (SelectionType)reader.ReadUInt32();

            this.SelectionInfo = this.SelectionType switch
            {
                SelectionType.H5S_SEL_NONE => new H5S_SEL_NONE(reader),
                SelectionType.H5S_SEL_POINTS => new H5S_SEL_POINTS(reader),
                SelectionType.H5S_SEL_HYPER => new H5S_SEL_HYPER(reader),
                SelectionType.H5S_SEL_ALL => new H5S_SEL_ALL(reader),
                _ => throw new NotSupportedException($"The dataspace selection type '{this.SelectionType}' is not supported.")
            };
        }
        public SharedObjectHeaderMessageTable(H5BinaryReader reader) : base(reader)
        {
            // signature
            var signature = reader.ReadBytes(4);

            H5Utils.ValidateSignature(signature, SharedObjectHeaderMessageTable.Signature);

            //
#warning implement this correctly

            // checksum
            this.Checksum = reader.ReadUInt32();
        }
示例#18
0
        public H5S_SEL_HYPER(H5BinaryReader reader) : base(reader)
        {
            // version
            this.Version = reader.ReadUInt32();

            // hyperslab selection info
            this.HyperslabSelectionInfo = this.Version switch
            {
                1 => new HyperslabSelectionInfo1(reader),
                2 => new HyperslabSelectionInfo2(reader),
                _ => throw new NotSupportedException($"Only {nameof(H5S_SEL_HYPER)} of version 1 or 2 are supported.")
            };
        }
示例#19
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 SharedMessageRecordList(H5BinaryReader reader) : base(reader)
        {
            // signature
            var signature = reader.ReadBytes(4);

            H5Utils.ValidateSignature(signature, SharedMessageRecordList.Signature);

            // share message records
            this.SharedMessageRecords = new List <SharedMessageRecord>();
#warning how to know how many?

            // 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);
        }
        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();
        }
示例#23
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();
        }
        public ExtensibleArrayIndexBlock(H5BinaryReader reader, Superblock superblock, ExtensibleArrayHeader header, uint chunkSizeLength)
        {
            // H5EAiblock.c (H5EA__iblock_alloc)
            ulong secondaryBlockDataBlockAddressCount = 2 * (ulong)Math.Log(header.SecondaryBlockMinimumDataBlockPointerCount, 2);
            ulong dataBlockPointerCount      = (ulong)(2 * (header.SecondaryBlockMinimumDataBlockPointerCount - 1));
            ulong secondaryBlockPointerCount = header.SecondaryBlockCount - secondaryBlockDataBlockAddressCount;

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

            H5Utils.ValidateSignature(signature, ExtensibleArrayIndexBlock.Signature);

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

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

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

            // elements
            this.Elements = ArrayIndexUtils.ReadElements(reader, superblock, header.IndexBlockElementsCount, this.ClientID, chunkSizeLength);

            // 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();
        }
示例#25
0
        public static DataBlockElement[] ReadElements(H5BinaryReader reader,
                                                      Superblock superblock,
                                                      ulong elementsCount,
                                                      ClientID clientID,
                                                      uint chunkSizeLength)
        {
            var elements = new DataBlockElement[elementsCount];

            switch (clientID)
            {
            case ClientID.NonFilteredDatasetChunks:

                for (ulong i = 0; i < elementsCount; i++)
                {
                    elements[i] = new DataBlockElement()
                    {
                        Address = superblock.ReadOffset(reader)
                    };
                }

                break;

            case ClientID.FilteredDatasetChunks:

                for (ulong i = 0; i < elementsCount; i++)
                {
                    elements[i] = new DataBlockElement()
                    {
                        Address    = superblock.ReadOffset(reader),
                        ChunkSize  = (uint)H5Utils.ReadUlong(reader, chunkSizeLength),
                        FilterMask = reader.ReadUInt32()
                    };
                }

                break;

            default:
                throw new Exception($"Client ID '{clientID}' is not supported.");
            }

            return(elements);
        }
示例#26
0
        public FreeSpaceSectionList(H5BinaryReader reader, Superblock superblock) : base(reader)
        {
            _superblock = superblock;

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

            H5Utils.ValidateSignature(signature, FreeSpaceSectionList.Signature);

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

            // free space manager header address
            this.FreeSpaceManagerHeaderAddress = superblock.ReadOffset(reader);

#warning implement everything

            // checksum
            this.Checksum = reader.ReadUInt32();
        }
示例#27
0
        public ExtensibleArrayHeader(H5BinaryReader reader, Superblock superblock, uint chunkSizeLength) : base(reader)
        {
            _superblock      = superblock;
            _chunkSizeLength = chunkSizeLength;

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

            H5Utils.ValidateSignature(signature, ExtensibleArrayHeader.Signature);

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

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

            // byte fields
            this.ElementSize = reader.ReadByte();
            this.ExtensibleArrayMaximumNumberOfElementsBits = reader.ReadByte();
            this.IndexBlockElementsCount       = reader.ReadByte();
            this.DataBlockMininumElementsCount = reader.ReadByte();
            this.SecondaryBlockMinimumDataBlockPointerCount = reader.ReadByte();
            this.DataBlockPageMaximumNumberOfElementsBits   = reader.ReadByte();

            // length fields
            this.SecondaryBlocksCount = superblock.ReadLength(reader);
            this.SecondaryBlocksSize  = superblock.ReadLength(reader);
            this.DataBlocksCount      = superblock.ReadLength(reader);
            this.DataBlocksSize       = superblock.ReadLength(reader);
            this.MaximumIndexSet      = superblock.ReadLength(reader);
            this.ElementsCount        = superblock.ReadLength(reader);

            // index block address
            this.IndexBlockAddress = superblock.ReadOffset(reader);

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

            // initialize
            this.Initialize();
        }
示例#28
0
        public DriverInfoBlock(H5BinaryReader reader) : base(reader)
        {
            // version
            this.Version = reader.ReadByte();

            // reserved
            reader.ReadBytes(3);

            // driver info size
            this.DriverInfoSize = reader.ReadUInt32();

            // driver id
            this.DriverId = H5Utils.ReadFixedLengthString(reader, 8);

            // driver info
            this.DriverInfo = this.DriverId switch
            {
                "NCSAmulti" => new MultiDriverInfo(reader),
                "NCSAfami" => new FamilyDriverInfo(reader),
                _ => throw new NotSupportedException($"The driver ID '{this.DriverId}' is not supported.")
            };
        }
示例#29
0
        public ExtensibleArrayDataBlock(H5BinaryReader reader, Superblock superblock, ExtensibleArrayHeader header, uint chunkSizeLength, ulong elementsCount)
        {
            // H5EAdblock.c (H5EA__dblock_alloc)
            this.PageCount = 0UL;

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

            // H5EAcache.c (H5EA__cache_dblock_deserialize)

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

            H5Utils.ValidateSignature(signature, ExtensibleArrayDataBlock.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 = ArrayIndexUtils.ReadElements(reader, superblock, elementsCount, this.ClientID, chunkSizeLength);
            }

            // checksum
            this.Checksum = reader.ReadUInt32();
        }
        public FilterDescription(H5BinaryReader reader, byte version) : base(reader)
        {
            // filter identifier
            this.Identifier = (FilterIdentifier)reader.ReadInt16();

            // name length
            this.NameLength = version switch
            {
                1 => reader.ReadUInt16(),
                2 when(ushort) this.Identifier >= 256 => reader.ReadUInt16(),
                2 when(ushort) this.Identifier < 256 => 0,
                _ => throw new NotSupportedException($"Only version 1 or 2 instances of the {nameof(FilterDescription)} type are supported.")
            };

            // flags
            this.Flags = (FilterFlags)reader.ReadUInt16();

            // client data value count
            var clientDataValueCount = reader.ReadUInt16();

            // name
            this.Name = this.NameLength > 0 ? H5Utils.ReadNullTerminatedString(reader, pad: true) : string.Empty;

            // client data
            this.ClientData = new uint[clientDataValueCount];

            for (ushort i = 0; i < clientDataValueCount; i++)
            {
                this.ClientData[i] = reader.ReadUInt32();
            }

            // padding
            if (version == 1 && clientDataValueCount % 2 != 0)
            {
                reader.ReadBytes(4);
            }
        }