H5PropList.h 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. // C++ informative line for the emacs editor: -*- C++ -*-
  2. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  3. * Copyright by The HDF Group. *
  4. * Copyright by the Board of Trustees of the University of Illinois. *
  5. * All rights reserved. *
  6. * *
  7. * This file is part of HDF5. The full HDF5 copyright notice, including *
  8. * terms governing use, modification, and redistribution, is contained in *
  9. * the COPYING file, which can be found at the root of the source code *
  10. * distribution tree, or in https://www.hdfgroup.org/licenses. *
  11. * If you do not have access to either file, you may request a copy from *
  12. * help@hdfgroup.org. *
  13. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  14. #ifndef H5PropList_H
  15. #define H5PropList_H
  16. namespace H5 {
  17. /*! \class PropList
  18. \brief Class PropList inherits from IdComponent and provides wrappers for
  19. the HDF5 generic property list.
  20. */
  21. // Inheritance: IdComponent
  22. class H5_DLLCPP PropList : public IdComponent {
  23. public:
  24. ///\brief Default property list
  25. static const PropList &DEFAULT;
  26. // Creates a property list of a given type or creates a copy of an
  27. // existing property list giving the property list id.
  28. PropList(const hid_t plist_id);
  29. // Make a copy of the given property list using assignment statement
  30. PropList &operator=(const PropList &rhs);
  31. // Compares this property list or class against the given list or class.
  32. bool operator==(const PropList &rhs) const;
  33. // Close this property list.
  34. virtual void close() override;
  35. // Close a property list class.
  36. void closeClass() const;
  37. // Makes a copy of the given property list.
  38. void copy(const PropList &like_plist);
  39. // Copies a property from this property list or class to another
  40. void copyProp(PropList &dest, const char *name) const;
  41. void copyProp(PropList &dest, const H5std_string &name) const;
  42. // Copies a property from one property list or property class to another
  43. void copyProp(PropList &dest, PropList &src, const char *name) const;
  44. void copyProp(PropList &dest, PropList &src, const H5std_string &name) const;
  45. // Gets the class of this property list, i.e. H5P_FILE_CREATE,
  46. // H5P_FILE_ACCESS, ...
  47. hid_t getClass() const;
  48. // Return the name of a generic property list class.
  49. H5std_string getClassName() const;
  50. // Returns the parent class of a generic property class.
  51. PropList getClassParent() const;
  52. // Returns the number of properties in this property list or class.
  53. size_t getNumProps() const;
  54. // Query the value of a property in a property list.
  55. void getProperty(const char *name, void *value) const;
  56. void getProperty(const H5std_string &name, void *value) const;
  57. H5std_string getProperty(const char *name) const;
  58. H5std_string getProperty(const H5std_string &name) const;
  59. // Set a property's value in a property list.
  60. void setProperty(const char *name, const char *charptr) const;
  61. void setProperty(const char *name, const void *value) const;
  62. void setProperty(const char *name, const H5std_string &strg) const;
  63. void setProperty(const H5std_string &name, const void *value) const;
  64. void setProperty(const H5std_string &name, const H5std_string &strg) const;
  65. // Deprecated after 1.10.1, missing const
  66. void setProperty(const char *name, void *value) const;
  67. void setProperty(const char *name, H5std_string &strg) const;
  68. void setProperty(const H5std_string &name, void *value) const;
  69. void setProperty(const H5std_string &name, H5std_string &strg) const;
  70. // Query the size of a property in a property list or class.
  71. size_t getPropSize(const char *name) const;
  72. size_t getPropSize(const H5std_string &name) const;
  73. // Determines whether a property list is a certain class.
  74. bool isAClass(const PropList &prop_class) const;
  75. /// Query the existence of a property in a property object.
  76. bool propExist(const char *name) const;
  77. bool propExist(const H5std_string &name) const;
  78. // Removes a property from a property list.
  79. void removeProp(const char *name) const;
  80. void removeProp(const H5std_string &name) const;
  81. ///\brief Returns this class name.
  82. virtual H5std_string
  83. fromClass() const override
  84. {
  85. return ("PropList");
  86. }
  87. // Default constructor: creates a stub PropList object.
  88. PropList();
  89. // Copy constructor: same as the original PropList.
  90. PropList(const PropList &original);
  91. // Gets the property list id.
  92. virtual hid_t getId() const override;
  93. // Destructor: properly terminates access to this property list.
  94. virtual ~PropList() override;
  95. #ifndef DOXYGEN_SHOULD_SKIP_THIS
  96. // Deletes the PropList global constant
  97. static void deleteConstants();
  98. protected:
  99. hid_t id; // HDF5 property list id
  100. // Sets the property list id.
  101. virtual void p_setId(const hid_t new_id) override;
  102. private:
  103. static PropList *DEFAULT_;
  104. // Dynamically allocates the PropList global constant
  105. static PropList *getConstant();
  106. // Friend function to set PropList id. For library use only.
  107. friend void f_PropList_setId(PropList *plist, hid_t new_id);
  108. #endif // DOXYGEN_SHOULD_SKIP_THIS
  109. }; // end of PropList
  110. } // namespace H5
  111. #endif // H5PropList_H