public CampaignInfo(string name, HdfElementBase parent, bool isLazyLoading) : base(name, parent, isLazyLoading) { _chunkDatasetInfo = new DatasetInfo("is_chunk_completed_set", TypeConversionHelper.GetHdfTypeIdFromType(typeof(bool)), this, this.IsLazyLoading); _variableInfoSet = new List <VariableInfo>(); this.RegisterSyncGroup(nameof(CampaignInfo), new SyncContext(this.UpdateCampaignInfo)); }
private void UpdateVariableInfo(FileContext fileContext, long variableGroupId) { ulong idx; idx = 0; _variableGroupSet = IOHelper.UpdateAttributeList(variableGroupId, "group_set", _variableGroupSet.ToArray()).ToList(); if (fileContext.FormatVersion != 1) { _unitSet = IOHelper.UpdateAttributeList(variableGroupId, "unit_set", _unitSet.ToArray()).ToList(); _transferFunctionSet = IOHelper.UpdateAttributeList(variableGroupId, "transfer_function_set", _transferFunctionSet.ToArray()).ToList(); } H5L.iterate(variableGroupId, H5.index_t.NAME, H5.iter_order_t.INC, ref idx, Callback, IntPtr.Zero); int Callback(long variableGroupId2, IntPtr intPtrName, ref H5L.info_t info, IntPtr userDataPtr) { long datasetId = -1; long typeId_do_not_close = -1; string name; DatasetInfo currentDatasetInfo; try { name = Marshal.PtrToStringAnsi(intPtrName); if (H5L.exists(variableGroupId2, name) > 0) { datasetId = H5D.open(variableGroupId2, name); currentDatasetInfo = _datasetInfoSet.FirstOrDefault(datasetInfo => datasetInfo.Name == name); if (currentDatasetInfo == null) { typeId_do_not_close = H5D.get_type(datasetId); currentDatasetInfo = new DatasetInfo(name, typeId_do_not_close, this, this.IsLazyLoading); _datasetInfoSet.Add(currentDatasetInfo); } currentDatasetInfo.Update(fileContext); } } finally { if (H5I.is_valid(datasetId) > 0) { H5D.close(datasetId); } } return(0); } }