File indexing completed on 2025-04-19 08:55:36
0001
0002
0003
0004
0005
0006
0007
0008
0009 #pragma once
0010
0011 #include <vector>
0012
0013 #include <H5Ppublic.h>
0014
0015
0016 #ifdef H5_HAVE_PARALLEL
0017 #include <H5FDmpi.h>
0018 #endif
0019
0020 #include "H5Exception.hpp"
0021 #include "H5Object.hpp"
0022
0023 namespace HighFive {
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061
0062
0063
0064
0065
0066
0067
0068
0069
0070
0071
0072
0073
0074
0075
0076
0077
0078
0079
0080
0081
0082
0083
0084
0085
0086
0087
0088
0089 enum class PropertyType : int {
0090 OBJECT_CREATE,
0091 FILE_CREATE,
0092 FILE_ACCESS,
0093 DATASET_CREATE,
0094 DATASET_ACCESS,
0095 DATASET_XFER,
0096 GROUP_CREATE,
0097 GROUP_ACCESS,
0098 DATATYPE_CREATE,
0099 DATATYPE_ACCESS,
0100 STRING_CREATE,
0101 ATTRIBUTE_CREATE,
0102 OBJECT_COPY,
0103 LINK_CREATE,
0104 LINK_ACCESS,
0105 };
0106
0107 namespace details {
0108 template <typename T, typename U>
0109 T get_plist(const U& obj, hid_t (*f)(hid_t)) {
0110 auto hid = f(obj.getId());
0111 if (hid < 0) {
0112 HDF5ErrMapper::ToException<PropertyException>("Unable to get property list");
0113 }
0114 T t{};
0115 t._hid = hid;
0116 return t;
0117 }
0118 }
0119
0120
0121
0122 class PropertyListBase: public Object {
0123 public:
0124 PropertyListBase() noexcept;
0125
0126 static const PropertyListBase& Default() noexcept {
0127 static const PropertyListBase plist{};
0128 return plist;
0129 }
0130
0131 private:
0132 template <typename T, typename U>
0133 friend T details::get_plist(const U&, hid_t (*f)(hid_t));
0134 };
0135
0136
0137
0138
0139
0140
0141
0142
0143
0144
0145 #if HIGHFIVE_HAS_CONCEPTS && __cplusplus >= 202002L
0146 template <typename P>
0147 concept PropertyInterface = requires(P p, const hid_t hid) {
0148 {p.apply(hid)};
0149 };
0150
0151 #else
0152 #define PropertyInterface typename
0153 #endif
0154
0155
0156
0157
0158
0159 template <PropertyType T>
0160 class PropertyList: public PropertyListBase {
0161 public:
0162
0163
0164 constexpr PropertyType getType() const noexcept {
0165 return T;
0166 }
0167
0168
0169
0170
0171
0172
0173 template <PropertyInterface P>
0174 void add(const P& property);
0175
0176
0177
0178 static const PropertyList<T>& Default() noexcept {
0179 return static_cast<const PropertyList<T>&>(PropertyListBase::Default());
0180 }
0181
0182
0183
0184
0185
0186
0187 static PropertyList<T> Empty() {
0188 auto plist = PropertyList<T>();
0189 plist._initializeIfNeeded();
0190
0191 return plist;
0192 }
0193
0194 protected:
0195 void _initializeIfNeeded();
0196 };
0197
0198 using ObjectCreateProps = PropertyList<PropertyType::OBJECT_CREATE>;
0199 using FileCreateProps = PropertyList<PropertyType::FILE_CREATE>;
0200 using FileAccessProps = PropertyList<PropertyType::FILE_ACCESS>;
0201 using DataSetCreateProps = PropertyList<PropertyType::DATASET_CREATE>;
0202 using DataSetAccessProps = PropertyList<PropertyType::DATASET_ACCESS>;
0203 using DataTransferProps = PropertyList<PropertyType::DATASET_XFER>;
0204 using GroupCreateProps = PropertyList<PropertyType::GROUP_CREATE>;
0205 using GroupAccessProps = PropertyList<PropertyType::GROUP_ACCESS>;
0206 using DataTypeCreateProps = PropertyList<PropertyType::DATATYPE_CREATE>;
0207 using DataTypeAccessProps = PropertyList<PropertyType::DATATYPE_ACCESS>;
0208 using StringCreateProps = PropertyList<PropertyType::STRING_CREATE>;
0209 using AttributeCreateProps = PropertyList<PropertyType::ATTRIBUTE_CREATE>;
0210 using ObjectCopyProps = PropertyList<PropertyType::OBJECT_COPY>;
0211 using LinkCreateProps = PropertyList<PropertyType::LINK_CREATE>;
0212 using LinkAccessProps = PropertyList<PropertyType::LINK_ACCESS>;
0213
0214
0215
0216
0217
0218 template <PropertyType T>
0219 class RawPropertyList: public PropertyList<T> {
0220 public:
0221 template <typename F, typename... Args>
0222 void add(const F& funct, const Args&... args);
0223 };
0224
0225 #ifdef H5_HAVE_PARALLEL
0226
0227
0228
0229
0230
0231
0232 class MPIOFileAccess {
0233 public:
0234 MPIOFileAccess(MPI_Comm comm, MPI_Info info);
0235
0236 private:
0237 friend FileAccessProps;
0238 void apply(const hid_t list) const;
0239
0240 MPI_Comm _comm;
0241 MPI_Info _info;
0242 };
0243
0244
0245 #if H5_VERSION_GE(1, 10, 0)
0246
0247
0248
0249
0250
0251 class MPIOCollectiveMetadata {
0252 public:
0253 explicit MPIOCollectiveMetadata(bool collective = true);
0254 explicit MPIOCollectiveMetadata(const FileAccessProps& plist);
0255
0256 bool isCollectiveRead() const;
0257 bool isCollectiveWrite() const;
0258
0259
0260 private:
0261 friend FileAccessProps;
0262 void apply(hid_t plist) const;
0263
0264 bool collective_read_;
0265 bool collective_write_;
0266 };
0267
0268
0269
0270
0271
0272
0273
0274
0275
0276
0277
0278
0279
0280
0281 class MPIOCollectiveMetadataRead {
0282 public:
0283 explicit MPIOCollectiveMetadataRead(bool collective = true);
0284 explicit MPIOCollectiveMetadataRead(const FileAccessProps& plist);
0285
0286 bool isCollective() const;
0287
0288 private:
0289 friend FileAccessProps;
0290 friend MPIOCollectiveMetadata;
0291
0292 void apply(hid_t plist) const;
0293
0294 bool collective_;
0295 };
0296
0297
0298
0299
0300
0301
0302
0303
0304
0305
0306
0307 class MPIOCollectiveMetadataWrite {
0308 public:
0309 explicit MPIOCollectiveMetadataWrite(bool collective = true);
0310 explicit MPIOCollectiveMetadataWrite(const FileAccessProps& plist);
0311
0312 bool isCollective() const;
0313
0314 private:
0315 friend FileAccessProps;
0316 friend MPIOCollectiveMetadata;
0317
0318 void apply(hid_t plist) const;
0319
0320 bool collective_;
0321 };
0322
0323 #endif
0324 #endif
0325
0326
0327
0328
0329
0330
0331
0332
0333
0334
0335
0336
0337
0338
0339
0340
0341
0342 class FileVersionBounds {
0343 public:
0344 FileVersionBounds(H5F_libver_t low, H5F_libver_t high);
0345 explicit FileVersionBounds(const FileAccessProps& fapl);
0346
0347 std::pair<H5F_libver_t, H5F_libver_t> getVersion() const;
0348
0349 private:
0350 friend FileAccessProps;
0351 void apply(const hid_t list) const;
0352
0353 H5F_libver_t _low;
0354 H5F_libver_t _high;
0355 };
0356
0357
0358
0359
0360
0361
0362 class MetadataBlockSize {
0363 public:
0364 explicit MetadataBlockSize(hsize_t size);
0365 explicit MetadataBlockSize(const FileAccessProps& fapl);
0366
0367 hsize_t getSize() const;
0368
0369 private:
0370 friend FileAccessProps;
0371 void apply(const hid_t list) const;
0372 hsize_t _size;
0373 };
0374
0375 #if H5_VERSION_GE(1, 10, 1)
0376
0377
0378
0379
0380
0381
0382 class FileSpaceStrategy {
0383 public:
0384
0385
0386
0387
0388
0389
0390 FileSpaceStrategy(H5F_fspace_strategy_t strategy, hbool_t persist, hsize_t threshold);
0391 explicit FileSpaceStrategy(const FileCreateProps& fcpl);
0392
0393 H5F_fspace_strategy_t getStrategy() const;
0394 hbool_t getPersist() const;
0395 hsize_t getThreshold() const;
0396
0397 private:
0398 friend FileCreateProps;
0399
0400 void apply(const hid_t list) const;
0401
0402 H5F_fspace_strategy_t _strategy;
0403 hbool_t _persist;
0404 hsize_t _threshold;
0405 };
0406
0407
0408
0409
0410
0411
0412
0413
0414
0415
0416 class FileSpacePageSize {
0417 public:
0418
0419
0420
0421
0422 explicit FileSpacePageSize(hsize_t page_size);
0423 explicit FileSpacePageSize(const FileCreateProps& fcpl);
0424
0425 hsize_t getPageSize() const;
0426
0427 private:
0428 friend FileCreateProps;
0429 void apply(const hid_t list) const;
0430
0431 hsize_t _page_size;
0432 };
0433
0434 #ifndef H5_HAVE_PARALLEL
0435
0436
0437
0438
0439
0440
0441
0442
0443
0444
0445
0446 class PageBufferSize {
0447 public:
0448
0449
0450
0451
0452
0453 explicit PageBufferSize(size_t page_buffer_size,
0454 unsigned min_meta_percent = 0,
0455 unsigned min_raw_percent = 0);
0456
0457 explicit PageBufferSize(const FileAccessProps& fapl);
0458
0459 size_t getPageBufferSize() const;
0460 unsigned getMinMetaPercent() const;
0461 unsigned getMinRawPercent() const;
0462
0463 private:
0464 friend FileAccessProps;
0465
0466 void apply(hid_t list) const;
0467
0468 size_t _page_buffer_size;
0469 unsigned _min_meta;
0470 unsigned _min_raw;
0471 };
0472 #endif
0473 #endif
0474
0475
0476
0477
0478 class EstimatedLinkInfo {
0479 public:
0480
0481
0482
0483
0484 explicit EstimatedLinkInfo(unsigned entries, unsigned length);
0485
0486 explicit EstimatedLinkInfo(const GroupCreateProps& gcpl);
0487
0488
0489 unsigned getEntries() const;
0490
0491
0492 unsigned getNameLength() const;
0493
0494 private:
0495 friend GroupCreateProps;
0496 void apply(hid_t hid) const;
0497 unsigned _entries;
0498 unsigned _length;
0499 };
0500
0501
0502
0503 class Chunking {
0504 public:
0505 explicit Chunking(const std::vector<hsize_t>& dims);
0506 Chunking(const std::initializer_list<hsize_t>& items);
0507
0508 template <typename... Args>
0509 explicit Chunking(hsize_t item, Args... args);
0510
0511 explicit Chunking(DataSetCreateProps& plist, size_t max_dims = 32);
0512
0513 const std::vector<hsize_t>& getDimensions() const noexcept;
0514
0515 private:
0516 friend DataSetCreateProps;
0517 void apply(hid_t hid) const;
0518 std::vector<hsize_t> _dims;
0519 };
0520
0521
0522 class Deflate {
0523 public:
0524 explicit Deflate(unsigned level);
0525
0526 private:
0527 friend DataSetCreateProps;
0528 friend GroupCreateProps;
0529 void apply(hid_t hid) const;
0530 const unsigned _level;
0531 };
0532
0533
0534 class Szip {
0535 public:
0536 explicit Szip(unsigned options_mask = H5_SZIP_EC_OPTION_MASK,
0537 unsigned pixels_per_block = H5_SZIP_MAX_PIXELS_PER_BLOCK);
0538
0539 unsigned getOptionsMask() const;
0540 unsigned getPixelsPerBlock() const;
0541
0542 private:
0543 friend DataSetCreateProps;
0544 void apply(hid_t hid) const;
0545 const unsigned _options_mask;
0546 const unsigned _pixels_per_block;
0547 };
0548
0549
0550 class Shuffle {
0551 public:
0552 Shuffle() = default;
0553
0554 private:
0555 friend DataSetCreateProps;
0556 void apply(hid_t hid) const;
0557 };
0558
0559
0560
0561
0562
0563
0564
0565 class AllocationTime {
0566 public:
0567 explicit AllocationTime(H5D_alloc_time_t alloc_time);
0568 explicit AllocationTime(const DataSetCreateProps& dcpl);
0569
0570 H5D_alloc_time_t getAllocationTime();
0571
0572 private:
0573 friend DataSetCreateProps;
0574 void apply(hid_t dcpl) const;
0575
0576 H5D_alloc_time_t _alloc_time;
0577 };
0578
0579
0580
0581
0582 class Caching {
0583 public:
0584
0585
0586 Caching(const size_t numSlots,
0587 const size_t cacheSize,
0588 const double w0 = static_cast<double>(H5D_CHUNK_CACHE_W0_DEFAULT));
0589
0590 explicit Caching(const DataSetCreateProps& dcpl);
0591
0592 size_t getNumSlots() const;
0593 size_t getCacheSize() const;
0594 double getW0() const;
0595
0596 private:
0597 friend DataSetAccessProps;
0598 void apply(hid_t hid) const;
0599 size_t _numSlots;
0600 size_t _cacheSize;
0601 double _w0;
0602 };
0603
0604
0605 class CreateIntermediateGroup {
0606 public:
0607 explicit CreateIntermediateGroup(bool create = true);
0608
0609 explicit CreateIntermediateGroup(const ObjectCreateProps& ocpl);
0610 explicit CreateIntermediateGroup(const LinkCreateProps& lcpl);
0611
0612 bool isSet() const;
0613
0614 protected:
0615 void fromPropertyList(hid_t hid);
0616
0617 private:
0618 friend ObjectCreateProps;
0619 friend LinkCreateProps;
0620 void apply(hid_t hid) const;
0621 bool _create;
0622 };
0623
0624 #ifdef H5_HAVE_PARALLEL
0625
0626 class UseCollectiveIO {
0627 public:
0628 explicit UseCollectiveIO(bool enable = true);
0629
0630 explicit UseCollectiveIO(const DataTransferProps& dxpl);
0631
0632
0633 bool isCollective() const;
0634
0635 private:
0636 friend DataTransferProps;
0637 void apply(hid_t hid) const;
0638 bool _enable;
0639 };
0640
0641
0642
0643
0644
0645
0646
0647
0648
0649 class MpioNoCollectiveCause {
0650 public:
0651 explicit MpioNoCollectiveCause(const DataTransferProps& dxpl);
0652
0653
0654 bool wasCollective() const;
0655
0656
0657 uint32_t getLocalCause() const;
0658
0659
0660 uint32_t getGlobalCause() const;
0661
0662
0663 std::pair<uint32_t, uint32_t> getCause() const;
0664
0665 private:
0666 friend DataTransferProps;
0667 uint32_t _local_cause;
0668 uint32_t _global_cause;
0669 };
0670 #endif
0671
0672 struct CreationOrder {
0673 enum _CreationOrder {
0674 Tracked = H5P_CRT_ORDER_TRACKED,
0675 Indexed = H5P_CRT_ORDER_INDEXED,
0676 };
0677 };
0678
0679
0680
0681
0682
0683
0684
0685 class LinkCreationOrder {
0686 public:
0687
0688
0689
0690
0691 explicit LinkCreationOrder(unsigned flags)
0692 : _flags(flags) {}
0693
0694 explicit LinkCreationOrder(const FileCreateProps& fcpl);
0695 explicit LinkCreationOrder(const GroupCreateProps& gcpl);
0696
0697 unsigned getFlags() const;
0698
0699 protected:
0700 void fromPropertyList(hid_t hid);
0701
0702 private:
0703 friend FileCreateProps;
0704 friend GroupCreateProps;
0705 void apply(hid_t hid) const;
0706 unsigned _flags;
0707 };
0708
0709
0710
0711
0712
0713
0714
0715
0716
0717
0718
0719
0720
0721 class AttributePhaseChange {
0722 public:
0723
0724
0725
0726
0727
0728
0729 AttributePhaseChange(unsigned max_compact, unsigned min_dense);
0730
0731
0732 explicit AttributePhaseChange(const GroupCreateProps& gcpl);
0733
0734 unsigned max_compact() const;
0735 unsigned min_dense() const;
0736
0737 private:
0738 friend GroupCreateProps;
0739 void apply(hid_t hid) const;
0740
0741 unsigned _max_compact;
0742 unsigned _min_dense;
0743 };
0744
0745
0746
0747 }
0748
0749 #include "bits/H5PropertyList_misc.hpp"