/c++/src/H5FaccProp.cpp

https://gitlab.com/jorjpimm/hdf5 · C++ · 736 lines · 285 code · 44 blank · 407 comment · 29 complexity · 5847775289c6147b5d7e007019208214 MD5 · raw file

  1. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  2. * Copyright by The HDF Group. *
  3. * Copyright by the Board of Trustees of the University of Illinois. *
  4. * All rights reserved. *
  5. * *
  6. * This file is part of HDF5. The full HDF5 copyright notice, including *
  7. * terms governing use, modification, and redistribution, is contained in *
  8. * the files COPYING and Copyright.html. COPYING can be found at the root *
  9. * of the source code distribution tree; Copyright.html can be found at the *
  10. * root level of an installed copy of the electronic HDF5 document set and *
  11. * is linked from the top-level documents page. It can also be found at *
  12. * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
  13. * access to either file, you may request a copy from help@hdfgroup.org. *
  14. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  15. #include <string>
  16. #include "H5Include.h"
  17. #include "H5Exception.h"
  18. #include "H5IdComponent.h"
  19. #include "H5PropList.h"
  20. #include "H5FaccProp.h"
  21. #ifndef H5_NO_NAMESPACE
  22. namespace H5 {
  23. #endif
  24. //--------------------------------------------------------------------------
  25. ///\brief Constant for default property
  26. //--------------------------------------------------------------------------
  27. const FileAccPropList FileAccPropList::DEFAULT;
  28. //--------------------------------------------------------------------------
  29. // Function: Default Constructor
  30. ///\brief Creates a file access property list
  31. // Programmer: Binh-Minh Ribler - 2000
  32. //--------------------------------------------------------------------------
  33. FileAccPropList::FileAccPropList() : PropList( H5P_FILE_ACCESS ) {}
  34. //--------------------------------------------------------------------------
  35. // Function: FileAccPropList copy constructor
  36. ///\brief Copy Constructor: makes a copy of the original
  37. ///\param original - IN: FileAccPropList instance to copy
  38. // Programmer: Binh-Minh Ribler - 2000
  39. //--------------------------------------------------------------------------
  40. FileAccPropList::FileAccPropList(const FileAccPropList& original) : PropList(original) {}
  41. //--------------------------------------------------------------------------
  42. // Function: FileAccPropList overloaded constructor
  43. ///\brief Creates a file access property list using the id of an
  44. /// existing one.
  45. // Programmer: Binh-Minh Ribler - 2000
  46. //--------------------------------------------------------------------------
  47. FileAccPropList::FileAccPropList(const hid_t plist_id) : PropList(plist_id) {}
  48. //--------------------------------------------------------------------------
  49. // Function: FileAccPropList::setStdio
  50. ///\brief Modifies this property list to use the \c H5FD_STDIO driver.
  51. ///
  52. ///\exception H5::PropListIException
  53. // Programmer: Binh-Minh Ribler - April, 2004
  54. //--------------------------------------------------------------------------
  55. void FileAccPropList::setStdio() const
  56. {
  57. herr_t ret_value = H5Pset_fapl_stdio(id);
  58. if( ret_value < 0 )
  59. {
  60. throw PropListIException("FileAccPropList::setStdio", "H5Pset_fapl_stdio failed");
  61. }
  62. }
  63. //--------------------------------------------------------------------------
  64. // Function: FileAccPropList::getDriver
  65. ///\brief Return the ID of the low-level file driver.
  66. ///\return A low-level driver ID which is the same ID used when the
  67. /// driver was set for the property list. The driver ID is
  68. /// only valid as long as the file driver remains registered.
  69. /// Valid driver identifiers can be found at:
  70. /// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-GetDriver
  71. ///\exception H5::PropListIException
  72. // Programmer: Binh-Minh Ribler - April, 2004
  73. //--------------------------------------------------------------------------
  74. hid_t FileAccPropList::getDriver() const
  75. {
  76. hid_t driver = H5Pget_driver(id);
  77. if (driver < 0)
  78. {
  79. throw PropListIException("FileAccPropList::getDriver", "H5Pget_driver failed");
  80. }
  81. return(driver);
  82. }
  83. //--------------------------------------------------------------------------
  84. // Function: FileAccPropList::setDriver
  85. ///\brief Set file driver for this property list.
  86. ///\param new_driver_id - IN: File driver
  87. ///\param new_driver_info - IN: Struct containing the driver-specific properites
  88. ///\exception H5::PropListIException
  89. ///\par Description
  90. /// For a list of valid driver identifiers, please see the C
  91. /// layer Reference Manual at:
  92. /// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetDriver
  93. // Programmer: Binh-Minh Ribler - April, 2004
  94. //--------------------------------------------------------------------------
  95. void FileAccPropList::setDriver(hid_t new_driver_id, const void *new_driver_info) const
  96. {
  97. herr_t ret_value = H5Pset_driver(id, new_driver_id, new_driver_info);
  98. if (ret_value < 0)
  99. {
  100. throw PropListIException("FileAccPropList::setDriver", "H5Pset_driver failed");
  101. }
  102. }
  103. //--------------------------------------------------------------------------
  104. // Function: FileAccPropList::setFamilyOffset
  105. ///\brief Sets offset for family driver.
  106. ///\param offset - IN: offset value
  107. ///\exception H5::PropListIException
  108. // Programmer: Binh-Minh Ribler - April, 2004
  109. //--------------------------------------------------------------------------
  110. void FileAccPropList::setFamilyOffset(hsize_t offset) const
  111. {
  112. herr_t ret_value = H5Pset_family_offset(id, offset);
  113. if (ret_value < 0)
  114. {
  115. throw PropListIException("FileAccPropList::setFamilyOffset", "H5Pset_family_offset failed");
  116. }
  117. }
  118. //--------------------------------------------------------------------------
  119. // Function: FileAccPropList::getFamilyOffset
  120. ///\brief Get offset for family driver.
  121. ///\return Offset for family driver
  122. ///\exception H5::PropListIException
  123. // Programmer: Binh-Minh Ribler - April, 2004
  124. //--------------------------------------------------------------------------
  125. hsize_t FileAccPropList::getFamilyOffset() const
  126. {
  127. hsize_t offset;
  128. herr_t ret_value = H5Pget_family_offset(id, &offset);
  129. if (ret_value < 0)
  130. {
  131. throw PropListIException("FileAccPropList::getFamilyOffset", "H5Pget_family_offset failed");
  132. }
  133. return(offset);
  134. }
  135. //--------------------------------------------------------------------------
  136. // Function: FileAccPropList::setCore
  137. ///\brief Modifies this file access property list to use the \c H5FD_CORE
  138. /// driver.
  139. ///\param increment - IN: Specifies how much memory to increase each
  140. /// time more memory is needed, in bytes
  141. ///\param backing_store - IN: Indicating whether to write the file
  142. /// contents to disk when the file is closed
  143. ///\exception H5::PropListIException
  144. ///\par Description
  145. /// For more details on the use of \c H5FD_CORE driver, please
  146. /// refer to
  147. /// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetFaplCore
  148. // Programmer: Binh-Minh Ribler - April, 2004
  149. //--------------------------------------------------------------------------
  150. void FileAccPropList::setCore (size_t increment, hbool_t backing_store) const
  151. {
  152. herr_t ret_value = H5Pset_fapl_core (id, increment, backing_store);
  153. if (ret_value < 0)
  154. {
  155. throw PropListIException ("FileAccPropList::setCore", "H5Pset_fapl_core failed");
  156. }
  157. }
  158. //--------------------------------------------------------------------------
  159. // Function: FileAccPropList::getCore
  160. ///\brief Queries core file driver properties.
  161. ///\param increment - OUT: Size of memory increment, in bytes
  162. ///\param backing_store - OUT: Indicating whether to write the file
  163. /// contents to disk when the file is closed
  164. ///\exception H5::PropListIException
  165. // Programmer: Binh-Minh Ribler - April, 2004
  166. //--------------------------------------------------------------------------
  167. void FileAccPropList::getCore (size_t& increment, hbool_t& backing_store) const
  168. {
  169. herr_t ret_value = H5Pget_fapl_core(id, &increment, &backing_store);
  170. if( ret_value < 0 )
  171. {
  172. throw PropListIException("FileAccPropList::getCore", "H5Pget_fapl_core failed");
  173. }
  174. }
  175. //--------------------------------------------------------------------------
  176. // Function: FileAccPropList::setFamily
  177. ///\brief Sets this file access property list to use the family driver.
  178. ///\param memb_size - IN: Size in bytes of each file member
  179. ///\param memb_plist - IN: File access property list to be used for
  180. /// each family member
  181. ///\exception H5::PropListIException
  182. ///\par Description
  183. /// Note that \a memb_size is used only when creating a new file.
  184. // Programmer: Binh-Minh Ribler - April, 2004
  185. //--------------------------------------------------------------------------
  186. void FileAccPropList::setFamily( hsize_t memb_size, const FileAccPropList& memb_plist ) const
  187. {
  188. herr_t ret_value = H5Pset_fapl_family (id, memb_size, memb_plist.getId() );
  189. if( ret_value < 0 )
  190. {
  191. throw PropListIException("FileAccPropList::setFamily", "H5Pset_fapl_family failed");
  192. }
  193. }
  194. //--------------------------------------------------------------------------
  195. // Function: FileAccPropList::getFamily
  196. ///\brief Returns information about the family file access property
  197. /// list.
  198. ///\param memb_size - OUT: Size in bytes of each file member
  199. ///\param memb_plist - OUT: Retrieved file access property list for each
  200. /// file member
  201. ///\exception H5::PropListIException
  202. // Programmer: Binh-Minh Ribler - April, 2004
  203. //--------------------------------------------------------------------------
  204. void FileAccPropList::getFamily(hsize_t& memb_size, FileAccPropList& memb_plist) const
  205. {
  206. hid_t memb_plist_id;
  207. herr_t ret_value = H5Pget_fapl_family( id, &memb_size, &memb_plist_id );
  208. if( ret_value < 0 )
  209. {
  210. throw PropListIException("FileAccPropList::getFamily", "H5Pget_fapl_family failed");
  211. }
  212. memb_plist.p_setId(memb_plist_id);
  213. }
  214. //--------------------------------------------------------------------------
  215. // Function: FileAccPropList::getFamily
  216. ///\brief This is an overloaded member function, provided for convenience.
  217. /// It differs from the above function only in what arguments it
  218. /// accepts and its return value.
  219. ///\param memb_size - OUT: Size in bytes of each file member
  220. ///\return The file access property list for each file member
  221. ///\exception H5::PropListIException
  222. // Programmer: Binh-Minh Ribler - April, 2004
  223. //--------------------------------------------------------------------------
  224. FileAccPropList FileAccPropList::getFamily(hsize_t& memb_size) const
  225. {
  226. hid_t memb_plist_id;
  227. herr_t ret_value = H5Pget_fapl_family( id, &memb_size, &memb_plist_id );
  228. if( ret_value < 0 )
  229. {
  230. throw PropListIException("FileAccPropList::getFamily", "H5Pget_fapl_family failed");
  231. }
  232. FileAccPropList memb_plist(memb_plist_id);
  233. return(memb_plist);
  234. }
  235. //--------------------------------------------------------------------------
  236. // Function: FileAccPropList::setSplit
  237. ///\brief Emulates the old split file driver, which stored meta data
  238. /// in one file and raw data in another file.
  239. ///\param meta_plist - IN: File access plist for the metadata file
  240. ///\param raw_plist - IN: File access plist for the raw data file
  241. ///\param meta_ext - IN: Metadata filename extension as \c char*
  242. ///\param raw_ext - IN: Raw data filename extension as \c char*
  243. ///\exception H5::PropListIException
  244. ///\par Description
  245. /// Temporary - For information, please refer to:
  246. /// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetFaplSplit
  247. // Programmer: Binh-Minh Ribler - April, 2004
  248. //--------------------------------------------------------------------------
  249. void FileAccPropList::setSplit(const FileAccPropList& meta_plist, const FileAccPropList& raw_plist, const char* meta_ext, const char* raw_ext ) const
  250. {
  251. hid_t meta_pid = meta_plist.getId();
  252. hid_t raw_pid = raw_plist.getId();
  253. herr_t ret_value = H5Pset_fapl_split( id, meta_ext, meta_pid, raw_ext, raw_pid );
  254. if( ret_value < 0 )
  255. {
  256. throw PropListIException("FileAccPropList::setSplit", "H5Pset_fapl_split failed");
  257. }
  258. }
  259. //--------------------------------------------------------------------------
  260. // Function: FileAccPropList::setSplit
  261. ///\brief This is an overloaded member function, kept for backward
  262. /// compatibility. It differs from the above function in that it
  263. /// misses const's. This wrapper will be removed in future release.
  264. ///\param meta_plist - IN: File access plist for the metadata file
  265. ///\param raw_plist - IN: File access plist for the raw data file
  266. ///\param meta_ext - IN: Metadata filename extension as \c char*
  267. ///\param raw_ext - IN: Raw data filename extension as \c char*
  268. ///\exception H5::PropListIException
  269. // Programmer: Binh-Minh Ribler - April, 2004
  270. // Note: Retiring April, 2014
  271. //--------------------------------------------------------------------------
  272. void FileAccPropList::setSplit(FileAccPropList& meta_plist, FileAccPropList& raw_plist, const char* meta_ext, const char* raw_ext ) const
  273. {
  274. setSplit((const FileAccPropList)meta_plist, (const FileAccPropList)raw_plist, meta_ext, raw_ext);
  275. }
  276. //--------------------------------------------------------------------------
  277. // Function: FileAccPropList::setSplit
  278. ///\brief This is an overloaded member function, provided for convenience.
  279. /// It takes character arguments as \c H5std_string.
  280. ///\param meta_plist - IN: File access plist for the metadata file
  281. ///\param raw_plist - IN: File access plist for the raw data file
  282. ///\param meta_ext - IN: Metadata filename extension as \c H5std_string
  283. ///\param raw_ext - IN: Raw data filename extension as \c H5std_string
  284. ///\exception H5::PropListIException
  285. // Programmer: Binh-Minh Ribler - April, 2004
  286. //--------------------------------------------------------------------------
  287. void FileAccPropList::setSplit(const FileAccPropList& meta_plist, const FileAccPropList& raw_plist, const H5std_string& meta_ext, const H5std_string& raw_ext ) const
  288. {
  289. setSplit( meta_plist, raw_plist, meta_ext.c_str(), raw_ext.c_str() );
  290. }
  291. //--------------------------------------------------------------------------
  292. // Function: FileAccPropList::setSplit
  293. ///\brief This is an overloaded member function, kept for backward
  294. /// compatibility. It differs from the above function in that it
  295. /// misses const's. This wrapper will be removed in future release.
  296. ///\param meta_plist - IN: File access plist for the metadata file
  297. ///\param raw_plist - IN: File access plist for the raw data file
  298. ///\param meta_ext - IN: Metadata filename extension as \c string
  299. ///\param raw_ext - IN: Raw data filename extension as \c string
  300. ///\exception H5::PropListIException
  301. // Programmer: Binh-Minh Ribler - April, 2004
  302. // Note: Retiring April, 2014
  303. //--------------------------------------------------------------------------
  304. void FileAccPropList::setSplit(FileAccPropList& meta_plist, FileAccPropList& raw_plist, const H5std_string& meta_ext, const H5std_string& raw_ext ) const
  305. {
  306. setSplit((const FileAccPropList)meta_plist, (const FileAccPropList)raw_plist, meta_ext.c_str(), raw_ext.c_str() );
  307. }
  308. // Stream Virtual File Driver had been removed from the main library.
  309. // FileAccPropList::[s,g]etStream are now removed from the C++ API.
  310. // -BMR, March, 2012
  311. //--------------------------------------------------------------------------
  312. // Function: FileAccPropList::getSieveBufSize
  313. ///\brief Returns the current settings for the data sieve buffer size
  314. /// property from this property list.
  315. ///\return Data sieve buffer size, in bytes
  316. ///\exception H5::PropListIException
  317. // Programmer: Binh-Minh Ribler - April, 2004
  318. //--------------------------------------------------------------------------
  319. size_t FileAccPropList::getSieveBufSize() const
  320. {
  321. size_t bufsize;
  322. herr_t ret_value = H5Pget_sieve_buf_size(id, &bufsize);
  323. if( ret_value < 0 )
  324. {
  325. throw PropListIException("FileAccPropList::getSieveBufSize", "H5Pget_sieve_buf_size failed");
  326. }
  327. return(bufsize);
  328. }
  329. //--------------------------------------------------------------------------
  330. // Function: FileAccPropList::setSieveBufSize
  331. ///\brief Sets the maximum size of the data sieve buffer.
  332. ///\param bufsize - IN: Maximum size, in bytes, of data sieve buffer
  333. ///\exception H5::PropListIException
  334. ///\par Description
  335. /// For detail on data sieving, please refer to
  336. /// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetSieveBufSize
  337. // Programmer: Binh-Minh Ribler - April, 2004
  338. //--------------------------------------------------------------------------
  339. void FileAccPropList::setSieveBufSize(size_t bufsize) const
  340. {
  341. herr_t ret_value = H5Pset_sieve_buf_size(id, bufsize);
  342. if( ret_value < 0 )
  343. {
  344. throw PropListIException("FileAccPropList::getSieveBufSize", "H5Pget_sieve_buf_size failed");
  345. }
  346. }
  347. //--------------------------------------------------------------------------
  348. // Function: FileAccPropList::setMetaBlockSize
  349. ///\brief Sets the minimum size of metadata block allocations.
  350. ///\param block_size - IN: Minimum size, in bytes, of metadata
  351. /// block allocations
  352. ///\exception H5::PropListIException
  353. ///\par Description
  354. /// For more detail, please see the C layer Reference Manual at:
  355. /// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetMetaBlockSize
  356. // Programmer: Binh-Minh Ribler - April, 2004
  357. //--------------------------------------------------------------------------
  358. void FileAccPropList::setMetaBlockSize(hsize_t &block_size) const
  359. {
  360. herr_t ret_value = H5Pset_meta_block_size(id, block_size);
  361. if( ret_value < 0 )
  362. {
  363. throw PropListIException("FileAccPropList::setMetaBlockSize", "H5Pset_meta_block_size failed");
  364. }
  365. }
  366. //--------------------------------------------------------------------------
  367. // Function: FileAccPropList::getMetaBlockSize
  368. ///\brief Returns the current metadata block size setting.
  369. ///\return Metadata block size
  370. ///\exception H5::PropListIException
  371. // Programmer: Binh-Minh Ribler - April, 2004
  372. //--------------------------------------------------------------------------
  373. hsize_t FileAccPropList::getMetaBlockSize() const
  374. {
  375. hsize_t block_size;
  376. herr_t ret_value = H5Pget_meta_block_size(id, &block_size);
  377. if( ret_value < 0 )
  378. {
  379. throw PropListIException("FileAccPropList::getMetaBlockSize", "H5Pget_meta_block_size failed");
  380. }
  381. return(block_size);
  382. }
  383. //--------------------------------------------------------------------------
  384. // Function: FileAccPropList::setLog
  385. ///\brief Modifies this file access property list to use the logging
  386. /// driver.
  387. ///\param logfile - IN: Name of the log file
  388. ///\param flags - IN: Flags specifying the types of logging activity
  389. ///\param buf_size - IN: Size of the logging buffer
  390. ///\exception H5::PropListIException
  391. ///\par Description
  392. /// For detail on \a flags, please refer to
  393. /// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetFaplLog
  394. // Programmer: Binh-Minh Ribler - April, 2004
  395. //--------------------------------------------------------------------------
  396. void FileAccPropList::setLog(const char *logfile, unsigned flags, size_t buf_size) const
  397. {
  398. herr_t ret_value = H5Pset_fapl_log(id, logfile, flags, buf_size);
  399. if( ret_value < 0 )
  400. {
  401. throw PropListIException("FileAccPropList::setLog", "H5Pset_fapl_log failed");
  402. }
  403. }
  404. //--------------------------------------------------------------------------
  405. // Function: FileAccPropList::setLog
  406. ///\brief This is an overloaded member function, provided for convenience.
  407. /// It differs from the above function only in what arguments it
  408. /// accepts.
  409. ///\param logfile - IN: Name of the log file - string
  410. ///\param flags - IN: Flags specifying the types of logging activity
  411. ///\param buf_size - IN: Size of the logging buffer
  412. // Programmer: Binh-Minh Ribler - April, 2004
  413. //--------------------------------------------------------------------------
  414. void FileAccPropList::setLog(const H5std_string& logfile, unsigned flags, size_t buf_size) const
  415. {
  416. setLog(logfile.c_str(), flags, buf_size);
  417. }
  418. //--------------------------------------------------------------------------
  419. // Function: FileAccPropList::setSec2
  420. ///\brief Modifies this file access property list to use the sec2
  421. /// driver.
  422. ///
  423. ///\exception H5::PropListIException
  424. // Programmer: Binh-Minh Ribler - April, 2004
  425. //--------------------------------------------------------------------------
  426. void FileAccPropList::setSec2() const
  427. {
  428. herr_t ret_value = H5Pset_fapl_sec2(id);
  429. if( ret_value < 0 )
  430. {
  431. throw PropListIException("FileAccPropList::setSec2", "H5Pset_fapl_sec2 failed");
  432. }
  433. }
  434. //--------------------------------------------------------------------------
  435. // Function: FileAccPropList::setAlignment
  436. ///\brief Sets the alignment properties of this property list.
  437. ///\param threshold - IN: Threshold value for file object size
  438. ///\param alignment - IN: Alignment value
  439. ///\exception H5::PropListIException
  440. ///\par Description
  441. /// The parameter \a threshold must have a non-negative value.
  442. /// Note that setting the threshold value to 0 (zero) has the
  443. /// effect of a special case, forcing everything to be aligned.
  444. /// The parameter \a alignment must have a positive value.
  445. ///
  446. /// For detail on \a setting alignment, please refer to
  447. /// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetAlignment
  448. // Programmer: Binh-Minh Ribler - 2000
  449. //--------------------------------------------------------------------------
  450. void FileAccPropList::setAlignment( hsize_t threshold, hsize_t alignment ) const
  451. {
  452. herr_t ret_value = H5Pset_alignment( id, threshold, alignment );
  453. if( ret_value < 0 )
  454. {
  455. throw PropListIException("FileAccPropList::setAlignment", "H5Pset_alignment failed");
  456. }
  457. }
  458. //--------------------------------------------------------------------------
  459. // Function: FileAccPropList::getAlignment
  460. ///\brief Returns the current settings for alignment properties from
  461. /// this property list.
  462. ///\param threshold - OUT: Retrieved threshold value for file object size
  463. ///\param alignment - OUT: Retrieved alignment value
  464. ///\exception H5::PropListIException
  465. // Programmer: Binh-Minh Ribler - 2000
  466. //--------------------------------------------------------------------------
  467. void FileAccPropList::getAlignment( hsize_t &threshold, hsize_t &alignment ) const
  468. {
  469. herr_t ret_value = H5Pget_alignment( id, &threshold, &alignment );
  470. if( ret_value < 0 )
  471. {
  472. throw PropListIException("FileAccPropList::getAlignment", "H5Pget_alignment failed");
  473. }
  474. }
  475. //--------------------------------------------------------------------------
  476. // Function: FileAccPropList::setMultiType
  477. ///\brief Sets data type for \c MULTI driver.
  478. ///\param dtype - IN: Type of data
  479. ///\exception H5::PropListIException
  480. ///\par Description
  481. /// More details and valid values for \a dtype can be found at:
  482. /// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetMultiType
  483. // Programmer: Binh-Minh Ribler - April, 2004
  484. //--------------------------------------------------------------------------
  485. void FileAccPropList::setMultiType(H5FD_mem_t dtype) const
  486. {
  487. herr_t ret_value = H5Pset_multi_type(id, dtype);
  488. if( ret_value < 0 )
  489. {
  490. throw PropListIException("FileAccPropList::setMultiType", "H5Pset_multi_type failed");
  491. }
  492. }
  493. //--------------------------------------------------------------------------
  494. // Function: FileAccPropList::getMultiType
  495. ///\brief Returns the data type property for \c MULTI driver.
  496. ///\return The data type property
  497. ///\exception H5::PropListIException
  498. ///\par Description
  499. /// More details and possible returned values can be found at:
  500. /// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-GetMultiType
  501. // Programmer: Binh-Minh Ribler - April, 2004
  502. //--------------------------------------------------------------------------
  503. H5FD_mem_t FileAccPropList::getMultiType() const
  504. {
  505. H5FD_mem_t dtype;
  506. herr_t ret_value = H5Pget_multi_type(id, &dtype);
  507. if( ret_value < 0 )
  508. {
  509. throw PropListIException("FileAccPropList::getMultiType", "H5Pget_multi_type failed");
  510. }
  511. return(dtype);
  512. }
  513. //--------------------------------------------------------------------------
  514. // Function: FileAccPropList::setCache
  515. ///\brief Sets the meta data cache and raw data chunk cache parameters.
  516. ///\param mdc_nelmts - IN: Number of elements in the meta data cache
  517. ///\param rdcc_nelmts - IN: Number of elements in the raw data chunk cache
  518. ///\param rdcc_nbytes - IN: Total size of the raw data chunk cache, in bytes
  519. ///\param rdcc_w0 - IN: Preemption policy
  520. ///\exception H5::PropListIException
  521. ///\par Description
  522. /// The argument \a rdcc_w0 should hold a value between 0 and 1
  523. /// inclusive. This value indicates how much chunks that have
  524. /// been fully read are favored for preemption. A value of zero
  525. /// means fully read chunks are treated no differently than other
  526. /// chunks (the preemption is strictly LRU) while a value of one
  527. /// means fully read chunks are always preempted before other chunks.
  528. // Programmer: Binh-Minh Ribler - 2000
  529. //--------------------------------------------------------------------------
  530. void FileAccPropList::setCache( int mdc_nelmts, size_t rdcc_nelmts, size_t rdcc_nbytes, double rdcc_w0 ) const
  531. {
  532. herr_t ret_value = H5Pset_cache( id, mdc_nelmts, rdcc_nelmts, rdcc_nbytes, rdcc_w0 );
  533. if( ret_value < 0 )
  534. {
  535. throw PropListIException("FileAccPropList::setCache", "H5Pset_cache failed");
  536. }
  537. }
  538. //--------------------------------------------------------------------------
  539. // Function: FileAccPropList::getCache
  540. ///\brief Queries the meta data cache and raw data chunk cache parameters.
  541. ///\param mdc_nelmts - OUT: Number of elements in the meta data cache
  542. ///\param rdcc_nelmts - OUT: Number of elements in the raw data chunk cache
  543. ///\param rdcc_nbytes - OUT: Total size of the raw data chunk cache, in bytes
  544. ///\param rdcc_w0 - OUT: Preemption policy
  545. ///\exception H5::PropListIException
  546. // Programmer: Binh-Minh Ribler - 2000
  547. //--------------------------------------------------------------------------
  548. void FileAccPropList::getCache( int& mdc_nelmts, size_t& rdcc_nelmts, size_t& rdcc_nbytes, double& rdcc_w0 ) const
  549. {
  550. herr_t ret_value = H5Pget_cache( id, &mdc_nelmts, &rdcc_nelmts, &rdcc_nbytes, &rdcc_w0 );
  551. if( ret_value < 0 )
  552. {
  553. throw PropListIException("FileAccPropList::getCache", "H5Pget_cache failed");
  554. }
  555. }
  556. //--------------------------------------------------------------------------
  557. // Function: FileAccPropList::setFcloseDegree
  558. ///\brief Sets the degree for the file close behavior.
  559. ///\param degree - IN:
  560. ///\exception H5::PropListIException
  561. // Programmer: Binh-Minh Ribler - April, 2004
  562. //--------------------------------------------------------------------------
  563. void FileAccPropList::setFcloseDegree(H5F_close_degree_t degree)
  564. {
  565. herr_t ret_value = H5Pset_fclose_degree(id, degree);
  566. if( ret_value < 0 )
  567. {
  568. throw PropListIException("FileAccPropList::setFcloseDegree", "H5Pset_fclose_degree failed");
  569. }
  570. }
  571. //--------------------------------------------------------------------------
  572. // Function: FileAccPropList::getFcloseDegree
  573. ///\brief Returns the degree for the file close behavior.
  574. ///\return The degree for the file close behavior
  575. ///\exception H5::PropListIException
  576. // Programmer: Binh-Minh Ribler - April, 2004
  577. //--------------------------------------------------------------------------
  578. H5F_close_degree_t FileAccPropList::getFcloseDegree()
  579. {
  580. H5F_close_degree_t degree;
  581. herr_t ret_value = H5Pget_fclose_degree(id, &degree);
  582. if( ret_value < 0 )
  583. {
  584. throw PropListIException("FileAccPropList::getFcloseDegree", "H5Pget_fclose_degree failed");
  585. }
  586. return(degree);
  587. }
  588. //--------------------------------------------------------------------------
  589. // Function: FileAccPropList::setGcReferences
  590. ///\brief Sets garbage collecting references flag.
  591. ///\param gc_ref - IN: Flag setting reference garbage collection to
  592. /// on (1) or off (0).
  593. ///\exception H5::PropListIException
  594. ///\par Description
  595. /// For detail on \a fapl, please refer to
  596. /// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetGCReferences
  597. // Programmer: Binh-Minh Ribler - 2000
  598. //--------------------------------------------------------------------------
  599. void FileAccPropList::setGcReferences( unsigned gc_ref ) const
  600. {
  601. herr_t ret_value = H5Pset_gc_references( id, gc_ref );
  602. if( ret_value < 0 )
  603. {
  604. throw PropListIException("FileAccPropList::setGcReferences", "H5Pset_gc_references failed");
  605. }
  606. }
  607. //--------------------------------------------------------------------------
  608. // Function: FileAccPropList::getGcReferences
  609. ///\brief Returns the garbage collecting references setting.
  610. ///\return Garbage collecting references setting, 0 (off) or 1 (on)
  611. ///\exception H5::PropListIException
  612. // Programmer: Binh-Minh Ribler - 2000
  613. //--------------------------------------------------------------------------
  614. unsigned FileAccPropList::getGcReferences() const
  615. {
  616. unsigned gc_ref;
  617. // the name of this routine will be changed to H5Pget_gc_references???
  618. herr_t ret_value = H5Pget_gc_references( id, &gc_ref );
  619. if( ret_value < 0 )
  620. {
  621. throw PropListIException("FileAccPropList::getGcReferences", "H5Pget_gc_references failed");
  622. }
  623. return( gc_ref );
  624. }
  625. //--------------------------------------------------------------------------
  626. // Function: FileAccPropList::setLibverBounds
  627. ///\brief Sets bounds on versions of library format to be used when creating
  628. /// or writing objects.
  629. ///\param libver_low - IN: Earliest version of the library that will be
  630. /// used for creating or writing objects
  631. ///\param libver_high - IN: Latest version of the library that will be
  632. ///\exception H5::PropListIException
  633. ///\par Description
  634. /// Valid values of \a libver_low are as follows:
  635. /// \li \c H5F_LIBVER_EARLIEST (Default)
  636. /// \li \c H5F_LIBVER_18
  637. /// \li \c H5F_LIBVER_LATEST
  638. ///
  639. /// Valid values of \a libver_high are as follows:
  640. /// \li \c H5F_LIBVER_18
  641. /// \li \c H5F_LIBVER_LATEST (Default)
  642. ///
  643. /// For more details, please refer to
  644. /// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetLibverBounds
  645. // Programmer: Binh-Minh Ribler - March, 2015
  646. //--------------------------------------------------------------------------
  647. void FileAccPropList::setLibverBounds(H5F_libver_t libver_low, H5F_libver_t libver_high) const
  648. {
  649. herr_t ret_value = H5Pset_libver_bounds(id, libver_low, libver_high);
  650. if (ret_value < 0)
  651. {
  652. throw PropListIException("FileAccPropList::setLibverBounds", "H5Pset_libver_bounds failed");
  653. }
  654. }
  655. //--------------------------------------------------------------------------
  656. // Function: FileAccPropList::getLibverBounds
  657. ///\brief Gets the current settings for the library version format bounds
  658. /// from a file access property list.
  659. ///\param libver_low - OUT: Earliest version of the library that will be
  660. /// used for creating or writing objects
  661. ///\param libver_high - OUT: Latest version of the library that will be
  662. /// used for creating or writing objects
  663. ///\exception H5::PropListIException
  664. ///\par Description
  665. /// On success, the argument \a libver_low can have the following
  666. /// values:
  667. /// \li \c H5F_LIBVER_EARLIEST
  668. /// \li \c H5F_LIBVER_18
  669. /// \li \c H5F_LIBVER_LATEST
  670. ///
  671. /// and \a libver_high:
  672. /// \li \c H5F_LIBVER_18
  673. /// \li \c H5F_LIBVER_LATEST
  674. // Programmer: Binh-Minh Ribler - March, 2015
  675. //--------------------------------------------------------------------------
  676. void FileAccPropList::getLibverBounds(H5F_libver_t& libver_low, H5F_libver_t& libver_high) const
  677. {
  678. herr_t ret_value = H5Pget_libver_bounds(id, &libver_low, &libver_high);
  679. if( ret_value < 0 )
  680. {
  681. throw PropListIException("FileAccPropList::getLibverBounds", "H5Pget_libver_bounds failed");
  682. }
  683. }
  684. //--------------------------------------------------------------------------
  685. // Function: FileAccPropList destructor
  686. ///\brief Noop destructor
  687. // Programmer Binh-Minh Ribler - 2000
  688. //--------------------------------------------------------------------------
  689. FileAccPropList::~FileAccPropList() {}
  690. #ifndef H5_NO_NAMESPACE
  691. } // end namespace
  692. #endif