示例#1
0
 private H5NamedReference GetObjectReference(LinkMessage linkMessage, H5LinkAccess linkAccess)
 {
     return(linkMessage.LinkInfo switch
     {
         HardLinkInfo hard => new H5NamedReference(linkMessage.LinkName, hard.HeaderAddress, this.File),
         SoftLinkInfo soft => new H5SymbolicLink(linkMessage, this).GetTarget(linkAccess),
         ExternalLinkInfo external => new H5SymbolicLink(linkMessage, this).GetTarget(linkAccess),
         _ => throw new Exception($"Unknown link type '{linkMessage.LinkType}'.")
     });
        internal H5SymbolicLink(LinkMessage linkMessage, H5Group parent)
        {
            this.Name = linkMessage.LinkName;

            (this.Value, this.ObjectPath) = linkMessage.LinkInfo switch
            {
                SoftLinkInfo softLink => (softLink.Value, null),
                ExternalLinkInfo externalLink => (externalLink.FilePath, externalLink.FullObjectPath),
                _ => throw new Exception($"The link info type '{linkMessage.LinkInfo.GetType().Name}' is not supported.")
            };

            this.Parent = parent;
        }
示例#3
0
        private IEnumerable <LinkMessage> EnumerateLinkMessagesFromLinkInfoMessage(LinkInfoMessage infoMessage)
        {
            var fractalHeap     = infoMessage.FractalHeap;
            var btree2NameIndex = infoMessage.BTree2NameIndex;
            var records         = btree2NameIndex
                                  .EnumerateRecords()
                                  .ToList();

            // local cache: indirectly accessed, non-filtered
            List <BTree2Record01>?record01Cache = null;

            foreach (var record in records)
            {
                using var localReader = new H5BinaryReader(new MemoryStream(record.HeapId));
                var heapId = FractalHeapId.Construct(this.Context, localReader, fractalHeap);

                yield return(heapId.Read(reader =>
                {
                    var message = new LinkMessage(reader, this.Context.Superblock);
                    return message;
                }, ref record01Cache));
            }
        }