1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.9.1"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>HDF5: Filters (H5Z)</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function() { init_search(); });
/* @license-end */
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="hdf5doxy.css" rel="stylesheet" type="text/css">
<!-- <link href="hdf5doxy.css" rel="stylesheet" type="text/css"/>
-->
<script type="text/javascript" src="hdf5_navtree_hacks.js"></script>
</head>
<body>
<div style="background:#FFDDDD;font-size:120%;text-align:center;margin:0;padding:5px">Please, help us to better serve our user community by answering the following short survey: <a href="https://www.hdfgroup.org/website-survey/">https://www.hdfgroup.org/website-survey/</a></div>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectlogo"><img alt="Logo" src="HDFG-logo.png"/></td>
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname"><a href="https://www.hdfgroup.org">HDF5</a>
 <span id="projectnumber">1.15.0.a6e610e</span>
</div>
<div id="projectbrief">API Reference</div>
</td>
<td> <div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.svg"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.svg" alt=""/></a>
</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.1 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search','.html');
/* @license-end */
</script>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('group___h5_z.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="header">
<div class="summary">
<a href="#groups">Modules</a> |
<a href="#func-members">Functions</a> </div>
<div class="headertitle">
<div class="title">Filters (H5Z)</div> </div>
</div><!--header-->
<div class="contents">
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<p>Use the functions in this module to manage HDF5 filters.</p>
<p>User-defined filters are created by registering a filter descriptor of type <a class="el" href="_h5version_8h.html#a3f702f77f3ab031d771be3b2b4bf4fba">H5Z_class_t</a> with the library.</p>
<p>Available filters can be read or examined at runtime.</p>
<p>It is conceivable that filters are stateful and that that state be updated at runtime.</p>
<p>Filters are deleted by unregistering.</p>
<table class="doxtable">
<tr>
<th>Create</th><th>Read </th></tr>
<tr valign="top">
<td><div class="fragment"><div class="line"><a name="l00010"></a><span class="lineno"> 10</span> <span class="keywordtype">size_t</span></div>
<div class="line"><a name="l00011"></a><span class="lineno"> 11</span> filter(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> flags, <span class="keywordtype">size_t</span> cd_nelmts, <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> cd_values[], <span class="keywordtype">size_t</span> nbytes, <span class="keywordtype">size_t</span> *buf_size,</div>
<div class="line"><a name="l00012"></a><span class="lineno"> 12</span>  <span class="keywordtype">void</span> **buf)</div>
<div class="line"><a name="l00013"></a><span class="lineno"> 13</span> {</div>
<div class="line"><a name="l00014"></a><span class="lineno"> 14</span>  buf_size = 0;</div>
<div class="line"><a name="l00015"></a><span class="lineno"> 15</span>  </div>
<div class="line"><a name="l00016"></a><span class="lineno"> 16</span>  <span class="keywordflow">if</span> (flags & <a class="code" href="_h5_zpublic_8h.html#a843859882318f69c9b4a38d3a88e0bfb">H5Z_FLAG_REVERSE</a>) {</div>
<div class="line"><a name="l00017"></a><span class="lineno"> 17</span>  <span class="comment">// read data, e.g., decompress data</span></div>
<div class="line"><a name="l00018"></a><span class="lineno"> 18</span>  <span class="comment">// ...</span></div>
<div class="line"><a name="l00019"></a><span class="lineno"> 19</span>  }</div>
<div class="line"><a name="l00020"></a><span class="lineno"> 20</span>  <span class="keywordflow">else</span> {</div>
<div class="line"><a name="l00021"></a><span class="lineno"> 21</span>  <span class="comment">// write data, e.g., compress data</span></div>
<div class="line"><a name="l00022"></a><span class="lineno"> 22</span>  <span class="comment">// ...</span></div>
<div class="line"><a name="l00023"></a><span class="lineno"> 23</span>  }</div>
<div class="line"><a name="l00024"></a><span class="lineno"> 24</span>  </div>
<div class="line"><a name="l00025"></a><span class="lineno"> 25</span>  <span class="keywordflow">return</span> nbytes;</div>
<div class="line"><a name="l00026"></a><span class="lineno"> 26</span> }</div>
<div class="ttc" id="a_h5_zpublic_8h_html_a843859882318f69c9b4a38d3a88e0bfb"><div class="ttname"><a href="_h5_zpublic_8h.html#a843859882318f69c9b4a38d3a88e0bfb">H5Z_FLAG_REVERSE</a></div><div class="ttdeci">#define H5Z_FLAG_REVERSE</div><div class="ttdef"><b>Definition:</b> H5Zpublic.h:107</div></div>
</div><!-- fragment --> <div class="fragment"><div class="line"><a name="l00035"></a><span class="lineno"> 35</span>  {</div>
<div class="line"><a name="l00036"></a><span class="lineno"> 36</span>  __label__ fail_register;</div>
<div class="line"><a name="l00037"></a><span class="lineno"> 37</span>  <a class="code" href="_h5version_8h.html#a3f702f77f3ab031d771be3b2b4bf4fba">H5Z_class_t</a> cls;</div>
<div class="line"><a name="l00038"></a><span class="lineno"> 38</span>  cls.version = <a class="code" href="_h5_zdevelop_8h.html#acec2c757b38aefdb817ba7c7915778a9">H5Z_CLASS_T_VERS</a>;</div>
<div class="line"><a name="l00039"></a><span class="lineno"> 39</span>  cls.id = 256;</div>
<div class="line"><a name="l00040"></a><span class="lineno"> 40</span>  cls.encoder_present = 1;</div>
<div class="line"><a name="l00041"></a><span class="lineno"> 41</span>  cls.decoder_present = 1;</div>
<div class="line"><a name="l00042"></a><span class="lineno"> 42</span>  cls.name = <span class="stringliteral">"Identity filter"</span>;</div>
<div class="line"><a name="l00043"></a><span class="lineno"> 43</span>  cls.can_apply = NULL;</div>
<div class="line"><a name="l00044"></a><span class="lineno"> 44</span>  cls.set_local = NULL;</div>
<div class="line"><a name="l00045"></a><span class="lineno"> 45</span>  cls.filter = &filter;</div>
<div class="line"><a name="l00046"></a><span class="lineno"> 46</span>  </div>
<div class="line"><a name="l00047"></a><span class="lineno"> 47</span>  <span class="comment">// register the filter</span></div>
<div class="line"><a name="l00048"></a><span class="lineno"> 48</span>  <span class="keywordflow">if</span> (<a class="code" href="group___h5_z.html#ga93145acc38c2c60d832b7a9b0123706b">H5Zregister</a>(&cls) < 0) {</div>
<div class="line"><a name="l00049"></a><span class="lineno"> 49</span>  ret_val = EXIT_FAILURE;</div>
<div class="line"><a name="l00050"></a><span class="lineno"> 50</span>  <span class="keywordflow">goto</span> fail_register;</div>
<div class="line"><a name="l00051"></a><span class="lineno"> 51</span>  }</div>
<div class="line"><a name="l00052"></a><span class="lineno"> 52</span>  </div>
<div class="line"><a name="l00053"></a><span class="lineno"> 53</span>  <span class="comment">// do something with filter</span></div>
<div class="line"><a name="l00054"></a><span class="lineno"> 54</span>  <span class="comment">// ...</span></div>
<div class="line"><a name="l00055"></a><span class="lineno"> 55</span>  </div>
<div class="line"><a name="l00056"></a><span class="lineno"> 56</span>  <span class="comment">// unregister the filter if no longer required</span></div>
<div class="line"><a name="l00057"></a><span class="lineno"> 57</span>  <span class="comment">// ...</span></div>
<div class="line"><a name="l00058"></a><span class="lineno"> 58</span>  </div>
<div class="line"><a name="l00059"></a><span class="lineno"> 59</span> fail_register:;</div>
<div class="line"><a name="l00060"></a><span class="lineno"> 60</span>  }</div>
<div class="ttc" id="a_h5_zdevelop_8h_html_acec2c757b38aefdb817ba7c7915778a9"><div class="ttname"><a href="_h5_zdevelop_8h.html#acec2c757b38aefdb817ba7c7915778a9">H5Z_CLASS_T_VERS</a></div><div class="ttdeci">#define H5Z_CLASS_T_VERS</div><div class="ttdef"><b>Definition:</b> H5Zdevelop.h:31</div></div>
<div class="ttc" id="a_h5version_8h_html_a3f702f77f3ab031d771be3b2b4bf4fba"><div class="ttname"><a href="_h5version_8h.html#a3f702f77f3ab031d771be3b2b4bf4fba">H5Z_class_t</a></div><div class="ttdeci">#define H5Z_class_t</div><div class="ttdef"><b>Definition:</b> H5version.h:1334</div></div>
<div class="ttc" id="agroup___h5_z_html_ga93145acc38c2c60d832b7a9b0123706b"><div class="ttname"><a href="group___h5_z.html#ga93145acc38c2c60d832b7a9b0123706b">H5Zregister</a></div><div class="ttdeci">herr_t H5Zregister(const void *cls)</div><div class="ttdoc">Registers a new filter with the HDF5 library.</div></div>
</div><!-- fragment --> </td><td><div class="fragment"><div class="line"><a name="l00064"></a><span class="lineno"> 64</span>  {</div>
<div class="line"><a name="l00065"></a><span class="lineno"> 65</span>  __label__ fail_avail;</div>
<div class="line"><a name="l00066"></a><span class="lineno"> 66</span>  </div>
<div class="line"><a name="l00067"></a><span class="lineno"> 67</span>  <a class="code" href="_h5_zpublic_8h.html#afae8461c70d47e63be2163af23362237">H5Z_filter_t</a> flt = <a class="code" href="_h5_zpublic_8h.html#a9e802e9612b3647e7d3ffe4ce3b8dcce">H5Z_FILTER_DEFLATE</a>;</div>
<div class="line"><a name="l00068"></a><span class="lineno"> 68</span>  <span class="keywordtype">unsigned</span> flags = 0;</div>
<div class="line"><a name="l00069"></a><span class="lineno"> 69</span>  </div>
<div class="line"><a name="l00070"></a><span class="lineno"> 70</span>  <span class="comment">// check if the deflate filter is available</span></div>
<div class="line"><a name="l00071"></a><span class="lineno"> 71</span>  <span class="keywordflow">if</span> (<a class="code" href="group___h5_z.html#ga3594e10d70739ccda55ebb55b17b50ee">H5Zfilter_avail</a>(flt) < 0) {</div>
<div class="line"><a name="l00072"></a><span class="lineno"> 72</span>  ret_val = EXIT_FAILURE;</div>
<div class="line"><a name="l00073"></a><span class="lineno"> 73</span>  <span class="keywordflow">goto</span> fail_avail;</div>
<div class="line"><a name="l00074"></a><span class="lineno"> 74</span>  }</div>
<div class="line"><a name="l00075"></a><span class="lineno"> 75</span>  <span class="comment">// retrieve the deflate filter info</span></div>
<div class="line"><a name="l00076"></a><span class="lineno"> 76</span>  <span class="keywordflow">if</span> (<a class="code" href="group___h5_z.html#ga9ef800ceec249c8819492545def9adba">H5Zget_filter_info</a>(flt, &flags) < 0) {</div>
<div class="line"><a name="l00077"></a><span class="lineno"> 77</span>  ret_val = EXIT_FAILURE;</div>
<div class="line"><a name="l00078"></a><span class="lineno"> 78</span>  <span class="keywordflow">goto</span> fail_avail;</div>
<div class="line"><a name="l00079"></a><span class="lineno"> 79</span>  }</div>
<div class="line"><a name="l00080"></a><span class="lineno"> 80</span>  </div>
<div class="line"><a name="l00081"></a><span class="lineno"> 81</span>  <span class="comment">// check if the deflate encoder or decoder is enabled</span></div>
<div class="line"><a name="l00082"></a><span class="lineno"> 82</span>  <span class="keywordflow">if</span> (<a class="code" href="_h5_zpublic_8h.html#ac4ec01a86fdac6619c7c3c1fcf3bf86a">H5Z_FILTER_CONFIG_ENCODE_ENABLED</a> & flags)</div>
<div class="line"><a name="l00083"></a><span class="lineno"> 83</span>  printf(<span class="stringliteral">"Deflate encoder enabled.\n"</span>);</div>
<div class="line"><a name="l00084"></a><span class="lineno"> 84</span>  <span class="keywordflow">if</span> (<a class="code" href="_h5_zpublic_8h.html#a4dead61ceb139a3f97505d6e52eb1b8a">H5Z_FILTER_CONFIG_DECODE_ENABLED</a> & flags)</div>
<div class="line"><a name="l00085"></a><span class="lineno"> 85</span>  printf(<span class="stringliteral">"Deflate decoder enabled.\n"</span>);</div>
<div class="line"><a name="l00086"></a><span class="lineno"> 86</span>  </div>
<div class="line"><a name="l00087"></a><span class="lineno"> 87</span> fail_avail:;</div>
<div class="line"><a name="l00088"></a><span class="lineno"> 88</span>  }</div>
<div class="ttc" id="a_h5_zpublic_8h_html_a4dead61ceb139a3f97505d6e52eb1b8a"><div class="ttname"><a href="_h5_zpublic_8h.html#a4dead61ceb139a3f97505d6e52eb1b8a">H5Z_FILTER_CONFIG_DECODE_ENABLED</a></div><div class="ttdeci">#define H5Z_FILTER_CONFIG_DECODE_ENABLED</div><div class="ttdef"><b>Definition:</b> H5Zpublic.h:216</div></div>
<div class="ttc" id="a_h5_zpublic_8h_html_a9e802e9612b3647e7d3ffe4ce3b8dcce"><div class="ttname"><a href="_h5_zpublic_8h.html#a9e802e9612b3647e7d3ffe4ce3b8dcce">H5Z_FILTER_DEFLATE</a></div><div class="ttdeci">#define H5Z_FILTER_DEFLATE</div><div class="ttdef"><b>Definition:</b> H5Zpublic.h:41</div></div>
<div class="ttc" id="a_h5_zpublic_8h_html_ac4ec01a86fdac6619c7c3c1fcf3bf86a"><div class="ttname"><a href="_h5_zpublic_8h.html#ac4ec01a86fdac6619c7c3c1fcf3bf86a">H5Z_FILTER_CONFIG_ENCODE_ENABLED</a></div><div class="ttdeci">#define H5Z_FILTER_CONFIG_ENCODE_ENABLED</div><div class="ttdef"><b>Definition:</b> H5Zpublic.h:215</div></div>
<div class="ttc" id="a_h5_zpublic_8h_html_afae8461c70d47e63be2163af23362237"><div class="ttname"><a href="_h5_zpublic_8h.html#afae8461c70d47e63be2163af23362237">H5Z_filter_t</a></div><div class="ttdeci">int H5Z_filter_t</div><div class="ttdoc">Filter identifiers.</div><div class="ttdef"><b>Definition:</b> H5Zpublic.h:27</div></div>
<div class="ttc" id="agroup___h5_z_html_ga3594e10d70739ccda55ebb55b17b50ee"><div class="ttname"><a href="group___h5_z.html#ga3594e10d70739ccda55ebb55b17b50ee">H5Zfilter_avail</a></div><div class="ttdeci">htri_t H5Zfilter_avail(H5Z_filter_t id)</div><div class="ttdoc">Determines whether a filter is available.</div></div>
<div class="ttc" id="agroup___h5_z_html_ga9ef800ceec249c8819492545def9adba"><div class="ttname"><a href="group___h5_z.html#ga9ef800ceec249c8819492545def9adba">H5Zget_filter_info</a></div><div class="ttdeci">herr_t H5Zget_filter_info(H5Z_filter_t filter, unsigned int *filter_config_flags)</div><div class="ttdoc">Retrieves information about a filter.</div></div>
</div><!-- fragment --> </td></tr>
<tr>
<th>Update</th><th>Delete </th></tr>
<tr valign="top">
<td><div class="fragment"><div class="line"><a name="l00092"></a><span class="lineno"> 92</span>  {</div>
<div class="line"><a name="l00093"></a><span class="lineno"> 93</span>  <span class="comment">// N/A</span></div>
</div><!-- fragment --> </td><td><div class="fragment"><div class="line"><a name="l00097"></a><span class="lineno"> 97</span>  {</div>
<div class="line"><a name="l00098"></a><span class="lineno"> 98</span>  <span class="comment">// unregister the identity filter</span></div>
<div class="line"><a name="l00099"></a><span class="lineno"> 99</span>  <span class="keywordflow">if</span> (<a class="code" href="group___h5_z.html#ga6b8bcdde70c9256c50c7c62ba66380f8">H5Zunregister</a>(256) < 0) {</div>
<div class="line"><a name="l00100"></a><span class="lineno"> 100</span>  ret_val = EXIT_FAILURE;</div>
<div class="line"><a name="l00101"></a><span class="lineno"> 101</span>  }</div>
<div class="line"><a name="l00102"></a><span class="lineno"> 102</span>  }</div>
<div class="ttc" id="agroup___h5_z_html_ga6b8bcdde70c9256c50c7c62ba66380f8"><div class="ttname"><a href="group___h5_z.html#ga6b8bcdde70c9256c50c7c62ba66380f8">H5Zunregister</a></div><div class="ttdeci">herr_t H5Zunregister(H5Z_filter_t id)</div><div class="ttdoc">Unregisters a filter.</div></div>
</div><!-- fragment --> </td></tr>
</table>
<p>HDF5 supports a filter pipeline that provides the capability for standard and customized raw data processing during I/O operations. HDF5 is distributed with a small set of standard filters such as compression (gzip, SZIP, and a shuffling algorithm) and error checking (Fletcher32 checksum). For further flexibility, the library allows a user application to extend the pipeline through the creation and registration of customized filters.</p>
<p>The flexibility of the filter pipeline implementation enables the definition of additional filters by a user application. A filter </p><ul>
<li>is associated with a dataset when the dataset is created, </li>
<li>can be used only with chunked data (i.e., datasets stored in the <a class="el" href="_h5_dpublic_8h.html#a57e163d4c263b585ca2d904996f5e06eadc846667d1f23d573964d22549e5f262">H5D_CHUNKED</a> storage layout), and </li>
<li>is applied independently to each chunk of the dataset.</li>
</ul>
<p>The HDF5 library does not support filters for contiguous datasets because of the difficulty of implementing random access for partial I/O. Compact dataset filters are not supported because they would not produce significant results.</p>
<p>Filter identifiers for the filters distributed with the HDF5 Library are as follows: </p><table class="doxtable">
<tr>
<td><a class="el" href="_h5_zpublic_8h.html#a9e802e9612b3647e7d3ffe4ce3b8dcce">H5Z_FILTER_DEFLATE</a></td><td>The gzip compression, or deflation, filter </td></tr>
<tr>
<td><a class="el" href="_h5_zpublic_8h.html#a421d9941c68ebb776573baeb9aa77cd2">H5Z_FILTER_SZIP</a></td><td>The SZIP compression filter </td></tr>
<tr>
<td><a class="el" href="_h5_zpublic_8h.html#a8cc463fa1979bd4bfa0dd9aa6a41e49d">H5Z_FILTER_NBIT</a></td><td>The N-bit compression filter </td></tr>
<tr>
<td><a class="el" href="_h5_zpublic_8h.html#a745d2ccb4f7712ed78ef5e562e27d2ca">H5Z_FILTER_SCALEOFFSET</a></td><td>The scale-offset compression filter </td></tr>
<tr>
<td><a class="el" href="_h5_zpublic_8h.html#aa723f1a71601bf22c95620a490ecf1af">H5Z_FILTER_SHUFFLE</a></td><td>The shuffle algorithm filter </td></tr>
<tr>
<td><a class="el" href="_h5_zpublic_8h.html#a59ca894c9c2b99b1614b0c46a7407f1c">H5Z_FILTER_FLETCHER32</a></td><td>The Fletcher32 checksum, or error checking, filter </td></tr>
</table>
<p>Custom filters that have been registered with the library will have additional unique identifiers.</p>
<p>See <a href="https://portal.hdfgroup.org/display/HDF5/HDF5+Dynamically+Loaded+Filters">HDF5 Dynamically Loaded Filters</a> for more information on how an HDF5 application can apply a filter that is not registered with the HDF5 library. </p>
<div id="dynsection-0" onclick="return toggleVisibility(this)" class="dynheader closed" style="cursor:pointer;">
<img id="dynsection-0-trigger" src="closed.png" alt="+"/> Collaboration diagram for Filters (H5Z):</div>
<div id="dynsection-0-summary" class="dynsummary" style="display:block;">
</div>
<div id="dynsection-0-content" class="dyncontent" style="display:none;">
<div class="center"><img src="group___h5_z.png" border="0" usemap="#agroup______h5__z" alt=""/></div>
<map name="agroup______h5__z" id="agroup______h5__z">
<area shape="rect" title=" " alt="" coords="5,5,108,31"/>
<area shape="rect" href="group___h5_z_p_r_e.html" title=" " alt="" coords="156,5,291,31"/>
</map>
</div>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="groups"></a>
Modules</h2></td></tr>
<tr class="memitem:group___h5_z_p_r_e"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="group___h5_z_p_r_e.html">Predefined Filters</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:ga93145acc38c2c60d832b7a9b0123706b"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_h5public_8h.html#a3b079ecf932a5c599499cf7e298af160">herr_t</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="group___h5_z.html#ga93145acc38c2c60d832b7a9b0123706b">H5Zregister</a> (const void *cls)</td></tr>
<tr class="memdesc:ga93145acc38c2c60d832b7a9b0123706b"><td class="mdescLeft"> </td><td class="mdescRight">Registers a new filter with the HDF5 library. <a href="group___h5_z.html#ga93145acc38c2c60d832b7a9b0123706b">More...</a><br /></td></tr>
<tr class="separator:ga93145acc38c2c60d832b7a9b0123706b"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga6b8bcdde70c9256c50c7c62ba66380f8"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_h5public_8h.html#a3b079ecf932a5c599499cf7e298af160">herr_t</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="group___h5_z.html#ga6b8bcdde70c9256c50c7c62ba66380f8">H5Zunregister</a> (<a class="el" href="_h5_zpublic_8h.html#afae8461c70d47e63be2163af23362237">H5Z_filter_t</a> id)</td></tr>
<tr class="memdesc:ga6b8bcdde70c9256c50c7c62ba66380f8"><td class="mdescLeft"> </td><td class="mdescRight">Unregisters a filter. <a href="group___h5_z.html#ga6b8bcdde70c9256c50c7c62ba66380f8">More...</a><br /></td></tr>
<tr class="separator:ga6b8bcdde70c9256c50c7c62ba66380f8"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga3594e10d70739ccda55ebb55b17b50ee"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_h5public_8h.html#aa8f6c28736dbd0f18388c67911d38aca">htri_t</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="group___h5_z.html#ga3594e10d70739ccda55ebb55b17b50ee">H5Zfilter_avail</a> (<a class="el" href="_h5_zpublic_8h.html#afae8461c70d47e63be2163af23362237">H5Z_filter_t</a> id)</td></tr>
<tr class="memdesc:ga3594e10d70739ccda55ebb55b17b50ee"><td class="mdescLeft"> </td><td class="mdescRight">Determines whether a filter is available. <a href="group___h5_z.html#ga3594e10d70739ccda55ebb55b17b50ee">More...</a><br /></td></tr>
<tr class="separator:ga3594e10d70739ccda55ebb55b17b50ee"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga9ef800ceec249c8819492545def9adba"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_h5public_8h.html#a3b079ecf932a5c599499cf7e298af160">herr_t</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="group___h5_z.html#ga9ef800ceec249c8819492545def9adba">H5Zget_filter_info</a> (<a class="el" href="_h5_zpublic_8h.html#afae8461c70d47e63be2163af23362237">H5Z_filter_t</a> filter, unsigned int *filter_config_flags)</td></tr>
<tr class="memdesc:ga9ef800ceec249c8819492545def9adba"><td class="mdescLeft"> </td><td class="mdescRight">Retrieves information about a filter. <a href="group___h5_z.html#ga9ef800ceec249c8819492545def9adba">More...</a><br /></td></tr>
<tr class="separator:ga9ef800ceec249c8819492545def9adba"><td class="memSeparator" colspan="2"> </td></tr>
</table>
<h2 class="groupheader">Function Documentation</h2>
<a id="ga3594e10d70739ccda55ebb55b17b50ee"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga3594e10d70739ccda55ebb55b17b50ee">◆ </a></span>H5Zfilter_avail()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="_h5public_8h.html#aa8f6c28736dbd0f18388c67911d38aca">htri_t</a> H5Zfilter_avail </td>
<td>(</td>
<td class="paramtype"><a class="el" href="_h5_zpublic_8h.html#afae8461c70d47e63be2163af23362237">H5Z_filter_t</a> </td>
<td class="paramname"><em>id</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Determines whether a filter is available. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">id</td><td>Filter identifier </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Returns zero (false), a positive (true) or a negative (failure) value.</dd></dl>
<p><a class="el" href="group___h5_z.html#ga3594e10d70739ccda55ebb55b17b50ee" title="Determines whether a filter is available.">H5Zfilter_avail()</a> determines whether the filter specified in <code>id</code> is available to the application.</p>
<dl class="section since"><dt>Since</dt><dd>1.6.0 </dd></dl>
</div>
</div>
<a id="ga9ef800ceec249c8819492545def9adba"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga9ef800ceec249c8819492545def9adba">◆ </a></span>H5Zget_filter_info()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="_h5public_8h.html#a3b079ecf932a5c599499cf7e298af160">herr_t</a> H5Zget_filter_info </td>
<td>(</td>
<td class="paramtype"><a class="el" href="_h5_zpublic_8h.html#afae8461c70d47e63be2163af23362237">H5Z_filter_t</a> </td>
<td class="paramname"><em>filter</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">unsigned int * </td>
<td class="paramname"><em>filter_config_flags</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Retrieves information about a filter. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">filter</td><td>Filter identifier </td></tr>
<tr><td class="paramdir">[out]</td><td class="paramname">filter_config_flags</td><td>A bit field encoding the returned filter information </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Returns a non-negative value if successful; otherwise, returns a negative value.</dd></dl>
<p><a class="el" href="group___h5_z.html#ga9ef800ceec249c8819492545def9adba" title="Retrieves information about a filter.">H5Zget_filter_info()</a> retrieves information about a filter. At present, this means that the function retrieves a filter's configuration flags, indicating whether the filter is configured to decode data, encode data, neither, or both.</p>
<p>If <code>filter_config_flags</code> is not set to NULL prior to the function call, the returned parameter contains a bit field specifying the available filter configuration. The configuration flag values can then be determined through a series of bitwise AND operations, as described below.</p>
<p>Valid filter configuration flags include the following: </p><table class="doxtable">
<tr>
<td><a class="el" href="_h5_zpublic_8h.html#ac4ec01a86fdac6619c7c3c1fcf3bf86a">H5Z_FILTER_CONFIG_ENCODE_ENABLED</a> </td><td>Encoding is enabled for this filter </td></tr>
<tr>
<td><a class="el" href="_h5_zpublic_8h.html#a4dead61ceb139a3f97505d6e52eb1b8a">H5Z_FILTER_CONFIG_DECODE_ENABLED</a> </td><td>Decoding is enabled for this filter </td></tr>
</table>
<p>A bitwise AND of the returned <code>filter_config_flags</code> and a valid filter configuration flag will reveal whether the related configuration option is available. For example, if the value of </p><div class="fragment"><div class="line"><a class="code" href="_h5_zpublic_8h.html#ac4ec01a86fdac6619c7c3c1fcf3bf86a">H5Z_FILTER_CONFIG_ENCODE_ENABLED</a> & filter_config_flags</div>
</div><!-- fragment --><p> is true, i.e., greater than 0 (zero), the queried filter is configured to encode data; if the value is <code>false</code>, i.e., equal to 0 (zero), the filter is not so configured.</p>
<p>If a filter is not encode-enabled, the corresponding <code>H5Pset_*</code> function will return an error if the filter is added to a dataset creation property list (which is required if the filter is to be used to encode that dataset). For example, if the <a class="el" href="_h5_zpublic_8h.html#ac4ec01a86fdac6619c7c3c1fcf3bf86a">H5Z_FILTER_CONFIG_ENCODE_ENABLED</a> flag is not returned for the SZIP filter, <a class="el" href="_h5_zpublic_8h.html#a421d9941c68ebb776573baeb9aa77cd2">H5Z_FILTER_SZIP</a>, a call to <a class="el" href="group___d_c_p_l.html#ga37de4b6071a94574cfab5cd6de9c3fc6" title="Sets up use of the SZIP compression filter.">H5Pset_szip()</a> will fail.</p>
<p>If a filter is not decode-enabled, the application will not be able to read an existing file encoded with that filter.</p>
<p>This function should be called, and the returned <code>filter_config_flags</code> should be analyzed, before calling any other function, such as <a class="el" href="group___d_c_p_l.html#ga37de4b6071a94574cfab5cd6de9c3fc6" title="Sets up use of the SZIP compression filter.">H5Pset_szip()</a>, that might require a particular filter configuration.</p>
<dl class="section since"><dt>Since</dt><dd>1.6.3 </dd></dl>
</div>
</div>
<a id="ga93145acc38c2c60d832b7a9b0123706b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga93145acc38c2c60d832b7a9b0123706b">◆ </a></span>H5Zregister()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="_h5public_8h.html#a3b079ecf932a5c599499cf7e298af160">herr_t</a> H5Zregister </td>
<td>(</td>
<td class="paramtype">const void * </td>
<td class="paramname"><em>cls</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Registers a new filter with the HDF5 library. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">cls</td><td>A pointer to a buffer for the struct containing the filter-definition</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Returns a non-negative value if successful; otherwise, returns a negative value.</dd></dl>
<p><a class="el" href="group___h5_z.html#ga93145acc38c2c60d832b7a9b0123706b" title="Registers a new filter with the HDF5 library.">H5Zregister()</a> registers a new filter with the HDF5 library.</p>
<p>Making a new filter available to an application is a two-step process. The first step is to write the three filter callback functions described below: <code>can_apply</code>, <code>set_local</code>, and <code>filter</code>. This call to <a class="el" href="group___h5_z.html#ga93145acc38c2c60d832b7a9b0123706b" title="Registers a new filter with the HDF5 library.">H5Zregister()</a>, registering the filter with the library, is the second step. The can_apply and set_local fields can be set to NULL if they are not required for the filter being registered.</p>
<p><a class="el" href="group___h5_z.html#ga93145acc38c2c60d832b7a9b0123706b" title="Registers a new filter with the HDF5 library.">H5Zregister()</a> accepts a single parameter, a pointer to a buffer for the <code>cls</code> data structure. That data structure must conform to one of the following definitions: </p><div class="fragment"><div class="line"><span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="struct_h5_z__class1__t.html">H5Z_class1_t</a> {</div>
<div class="line"> <a class="code" href="_h5_zpublic_8h.html#afae8461c70d47e63be2163af23362237">H5Z_filter_t</a> <a class="code" href="struct_h5_z__class1__t.html#a6f3027958c7ad4552356a1e47e4db2ce">id</a>; </div>
<div class="line"> <span class="keyword">const</span> <span class="keywordtype">char</span> *<a class="code" href="struct_h5_z__class1__t.html#a8f8f80d37794cde9472343e4487ba3eb">name</a>; </div>
<div class="line"> <a class="code" href="_h5_zdevelop_8h.html#af2d1e20aeb92b2712ebc2d9b5fcbf510">H5Z_can_apply_func_t</a> <a class="code" href="struct_h5_z__class1__t.html#a10d4a5417743a68aafc95160c5152601">can_apply</a>; </div>
<div class="line"> <a class="code" href="_h5_zdevelop_8h.html#a32591ae9c5164edd548c9885f430b15e">H5Z_set_local_func_t</a> <a class="code" href="struct_h5_z__class1__t.html#a5d89ab9372734010a5c500ea3e694a03">set_local</a>; </div>
<div class="line"> <a class="code" href="_h5_zdevelop_8h.html#a130d8964a46667029c7d3c14572577c6">H5Z_func_t</a> <a class="code" href="struct_h5_z__class1__t.html#a995507f1980f1e7f971fda7c362a213b">filter</a>; </div>
<div class="line">} <a class="code" href="struct_h5_z__class1__t.html">H5Z_class1_t</a>;</div>
<div class="ttc" id="a_h5_zdevelop_8h_html_a130d8964a46667029c7d3c14572577c6"><div class="ttname"><a href="_h5_zdevelop_8h.html#a130d8964a46667029c7d3c14572577c6">H5Z_func_t</a></div><div class="ttdeci">size_t(* H5Z_func_t)(unsigned int flags, size_t cd_nelmts, const unsigned int cd_values[], size_t nbytes, size_t *buf_size, void **buf)</div><div class="ttdoc">The filter operation callback function, defining a filter's operation on data.</div><div class="ttdef"><b>Definition:</b> H5Zdevelop.h:150</div></div>
<div class="ttc" id="a_h5_zdevelop_8h_html_a32591ae9c5164edd548c9885f430b15e"><div class="ttname"><a href="_h5_zdevelop_8h.html#a32591ae9c5164edd548c9885f430b15e">H5Z_set_local_func_t</a></div><div class="ttdeci">herr_t(* H5Z_set_local_func_t)(hid_t dcpl_id, hid_t type_id, hid_t space_id)</div><div class="ttdoc">The filter operation callback function, defining a filter's operation on data.</div><div class="ttdef"><b>Definition:</b> H5Zdevelop.h:116</div></div>
<div class="ttc" id="a_h5_zdevelop_8h_html_af2d1e20aeb92b2712ebc2d9b5fcbf510"><div class="ttname"><a href="_h5_zdevelop_8h.html#af2d1e20aeb92b2712ebc2d9b5fcbf510">H5Z_can_apply_func_t</a></div><div class="ttdeci">htri_t(* H5Z_can_apply_func_t)(hid_t dcpl_id, hid_t type_id, hid_t space_id)</div><div class="ttdoc">This callback determines if a filter can be applied to the dataset with the characteristics provided.</div><div class="ttdef"><b>Definition:</b> H5Zdevelop.h:78</div></div>
<div class="ttc" id="astruct_h5_z__class1__t_html"><div class="ttname"><a href="struct_h5_z__class1__t.html">H5Z_class1_t</a></div><div class="ttdef"><b>Definition:</b> H5Zdevelop.h:428</div></div>
<div class="ttc" id="astruct_h5_z__class1__t_html_a10d4a5417743a68aafc95160c5152601"><div class="ttname"><a href="struct_h5_z__class1__t.html#a10d4a5417743a68aafc95160c5152601">H5Z_class1_t::can_apply</a></div><div class="ttdeci">H5Z_can_apply_func_t can_apply</div><div class="ttdef"><b>Definition:</b> H5Zdevelop.h:431</div></div>
<div class="ttc" id="astruct_h5_z__class1__t_html_a5d89ab9372734010a5c500ea3e694a03"><div class="ttname"><a href="struct_h5_z__class1__t.html#a5d89ab9372734010a5c500ea3e694a03">H5Z_class1_t::set_local</a></div><div class="ttdeci">H5Z_set_local_func_t set_local</div><div class="ttdef"><b>Definition:</b> H5Zdevelop.h:432</div></div>
<div class="ttc" id="astruct_h5_z__class1__t_html_a6f3027958c7ad4552356a1e47e4db2ce"><div class="ttname"><a href="struct_h5_z__class1__t.html#a6f3027958c7ad4552356a1e47e4db2ce">H5Z_class1_t::id</a></div><div class="ttdeci">H5Z_filter_t id</div><div class="ttdef"><b>Definition:</b> H5Zdevelop.h:429</div></div>
<div class="ttc" id="astruct_h5_z__class1__t_html_a8f8f80d37794cde9472343e4487ba3eb"><div class="ttname"><a href="struct_h5_z__class1__t.html#a8f8f80d37794cde9472343e4487ba3eb">H5Z_class1_t::name</a></div><div class="ttdeci">const char * name</div><div class="ttdef"><b>Definition:</b> H5Zdevelop.h:430</div></div>
<div class="ttc" id="astruct_h5_z__class1__t_html_a995507f1980f1e7f971fda7c362a213b"><div class="ttname"><a href="struct_h5_z__class1__t.html#a995507f1980f1e7f971fda7c362a213b">H5Z_class1_t::filter</a></div><div class="ttdeci">H5Z_func_t filter</div><div class="ttdef"><b>Definition:</b> H5Zdevelop.h:433</div></div>
</div><!-- fragment --><p> or </p><div class="fragment"><div class="line"><span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="struct_h5_z__class2__t.html">H5Z_class2_t</a> {</div>
<div class="line"> <span class="keywordtype">int</span> <a class="code" href="struct_h5_z__class2__t.html#aad880fc4455c253781e8968f2239d56f">version</a>; </div>
<div class="line"> <a class="code" href="_h5_zpublic_8h.html#afae8461c70d47e63be2163af23362237">H5Z_filter_t</a> <a class="code" href="struct_h5_z__class2__t.html#a6f3027958c7ad4552356a1e47e4db2ce">id</a>; </div>
<div class="line"> <span class="keywordtype">unsigned</span> <a class="code" href="struct_h5_z__class2__t.html#a1622cd6083cfb9a6c4efb5d5bf67b143">encoder_present</a>; </div>
<div class="line"> <span class="keywordtype">unsigned</span> <a class="code" href="struct_h5_z__class2__t.html#af3f8cbfa487cb4c06ad2210d0b81a271">decoder_present</a>; </div>
<div class="line"> <span class="keyword">const</span> <span class="keywordtype">char</span> *<a class="code" href="struct_h5_z__class2__t.html#a8f8f80d37794cde9472343e4487ba3eb">name</a>; </div>
<div class="line"> <a class="code" href="_h5_zdevelop_8h.html#af2d1e20aeb92b2712ebc2d9b5fcbf510">H5Z_can_apply_func_t</a> <a class="code" href="struct_h5_z__class2__t.html#a10d4a5417743a68aafc95160c5152601">can_apply</a>; </div>
<div class="line"> <a class="code" href="_h5_zdevelop_8h.html#a32591ae9c5164edd548c9885f430b15e">H5Z_set_local_func_t</a> <a class="code" href="struct_h5_z__class2__t.html#a5d89ab9372734010a5c500ea3e694a03">set_local</a>; </div>
<div class="line"> <a class="code" href="_h5_zdevelop_8h.html#a130d8964a46667029c7d3c14572577c6">H5Z_func_t</a> <a class="code" href="struct_h5_z__class2__t.html#a995507f1980f1e7f971fda7c362a213b">filter</a>; </div>
<div class="line">} <a class="code" href="struct_h5_z__class2__t.html">H5Z_class2_t</a>;</div>
<div class="ttc" id="astruct_h5_z__class2__t_html"><div class="ttname"><a href="struct_h5_z__class2__t.html">H5Z_class2_t</a></div><div class="ttdef"><b>Definition:</b> H5Zdevelop.h:159</div></div>
<div class="ttc" id="astruct_h5_z__class2__t_html_a10d4a5417743a68aafc95160c5152601"><div class="ttname"><a href="struct_h5_z__class2__t.html#a10d4a5417743a68aafc95160c5152601">H5Z_class2_t::can_apply</a></div><div class="ttdeci">H5Z_can_apply_func_t can_apply</div><div class="ttdef"><b>Definition:</b> H5Zdevelop.h:165</div></div>
<div class="ttc" id="astruct_h5_z__class2__t_html_a1622cd6083cfb9a6c4efb5d5bf67b143"><div class="ttname"><a href="struct_h5_z__class2__t.html#a1622cd6083cfb9a6c4efb5d5bf67b143">H5Z_class2_t::encoder_present</a></div><div class="ttdeci">unsigned encoder_present</div><div class="ttdef"><b>Definition:</b> H5Zdevelop.h:162</div></div>
<div class="ttc" id="astruct_h5_z__class2__t_html_a5d89ab9372734010a5c500ea3e694a03"><div class="ttname"><a href="struct_h5_z__class2__t.html#a5d89ab9372734010a5c500ea3e694a03">H5Z_class2_t::set_local</a></div><div class="ttdeci">H5Z_set_local_func_t set_local</div><div class="ttdef"><b>Definition:</b> H5Zdevelop.h:166</div></div>
<div class="ttc" id="astruct_h5_z__class2__t_html_a6f3027958c7ad4552356a1e47e4db2ce"><div class="ttname"><a href="struct_h5_z__class2__t.html#a6f3027958c7ad4552356a1e47e4db2ce">H5Z_class2_t::id</a></div><div class="ttdeci">H5Z_filter_t id</div><div class="ttdef"><b>Definition:</b> H5Zdevelop.h:161</div></div>
<div class="ttc" id="astruct_h5_z__class2__t_html_a8f8f80d37794cde9472343e4487ba3eb"><div class="ttname"><a href="struct_h5_z__class2__t.html#a8f8f80d37794cde9472343e4487ba3eb">H5Z_class2_t::name</a></div><div class="ttdeci">const char * name</div><div class="ttdef"><b>Definition:</b> H5Zdevelop.h:164</div></div>
<div class="ttc" id="astruct_h5_z__class2__t_html_a995507f1980f1e7f971fda7c362a213b"><div class="ttname"><a href="struct_h5_z__class2__t.html#a995507f1980f1e7f971fda7c362a213b">H5Z_class2_t::filter</a></div><div class="ttdeci">H5Z_func_t filter</div><div class="ttdef"><b>Definition:</b> H5Zdevelop.h:167</div></div>
<div class="ttc" id="astruct_h5_z__class2__t_html_aad880fc4455c253781e8968f2239d56f"><div class="ttname"><a href="struct_h5_z__class2__t.html#aad880fc4455c253781e8968f2239d56f">H5Z_class2_t::version</a></div><div class="ttdeci">int version</div><div class="ttdef"><b>Definition:</b> H5Zdevelop.h:160</div></div>
<div class="ttc" id="astruct_h5_z__class2__t_html_af3f8cbfa487cb4c06ad2210d0b81a271"><div class="ttname"><a href="struct_h5_z__class2__t.html#af3f8cbfa487cb4c06ad2210d0b81a271">H5Z_class2_t::decoder_present</a></div><div class="ttdeci">unsigned decoder_present</div><div class="ttdef"><b>Definition:</b> H5Zdevelop.h:163</div></div>
</div><!-- fragment --><p> <code>version</code> is a library-defined value reporting the version number of the <a class="el" href="_h5version_8h.html#a3f702f77f3ab031d771be3b2b4bf4fba">H5Z_class_t</a> struct. This currently must be set to <a class="el" href="_h5_zdevelop_8h.html#acec2c757b38aefdb817ba7c7915778a9">H5Z_CLASS_T_VERS</a>.</p>
<p><code>id</code> is the identifier for the new filter. This is a user-defined value between <a class="el" href="_h5_zpublic_8h.html#a5280cfd4cf81c09616958ce34547c15e">H5Z_FILTER_RESERVED</a> and <a class="el" href="_h5_zpublic_8h.html#ab47f5d3a9a56dad8db2014fa25eb3be0">H5Z_FILTER_MAX</a>. These values are defined in the HDF5 source file <a class="el" href="_h5_zpublic_8h.html">H5Zpublic.h</a>, but the symbols <a class="el" href="_h5_zpublic_8h.html#a5280cfd4cf81c09616958ce34547c15e">H5Z_FILTER_RESERVED</a> and <a class="el" href="_h5_zpublic_8h.html#ab47f5d3a9a56dad8db2014fa25eb3be0">H5Z_FILTER_MAX</a> should always be used instead of the literal values.</p>
<p><code>encoder_present</code> is a library-defined value indicating whether the filter's encoding capability is available to the application.</p>
<p><code>decoder_present</code> is a library-defined value indicating whether the filter's encoding capability is available to the application.</p>
<p><code>name</code> is a descriptive comment used for debugging, may contain a descriptive name for the filter, and may be the null pointer.</p>
<p><code>can_apply</code>, described in detail below, is a user-defined callback function that determines whether the combination of the dataset creation property list values, the datatype, and the dataspace represent a valid combination to apply this filter to.</p>
<p><code>set_local</code>, described in detail below, is a user-defined callback function that sets any parameters that are specific to this dataset, based on the combination of the dataset creation property list values, the datatype, and the dataspace.</p>
<p><code>filter</code>, described in detail below, is a user-defined callback function which performs the action of the filter.</p>
<p>The statistics associated with a filter are not reset by this function; they accumulate over the life of the library.</p>
<p><a class="el" href="_h5version_8h.html#a3f702f77f3ab031d771be3b2b4bf4fba">H5Z_class_t</a> is a macro that maps to either <a class="el" href="struct_h5_z__class1__t.html">H5Z_class1_t</a> or <a class="el" href="struct_h5_z__class2__t.html">H5Z_class2_t</a>, depending on the needs of the application. To affect only this macro, H5Z_class_t_vers may be defined as either 1 or 2. Otherwise, it will behave in the same manner as other API compatibility macros. See API Compatibility Macros in HDF5 for more information. <a class="el" href="struct_h5_z__class1__t.html">H5Z_class1_t</a> matches the <a class="el" href="_h5version_8h.html#a3f702f77f3ab031d771be3b2b4bf4fba">H5Z_class_t</a> structure that is used in the 1.6.x versions of the HDF5 library.</p>
<p><a class="el" href="group___h5_z.html#ga93145acc38c2c60d832b7a9b0123706b" title="Registers a new filter with the HDF5 library.">H5Zregister()</a> will automatically detect which structure type has been passed in, regardless of the mapping of the <a class="el" href="_h5version_8h.html#a3f702f77f3ab031d771be3b2b4bf4fba">H5Z_class_t</a> macro. However, the application must make sure that the fields are filled in according to the correct structure definition if the macro is used to declare the structure.</p>
<p><b>The callback functions:</b><br />
Before <a class="el" href="group___h5_z.html#ga93145acc38c2c60d832b7a9b0123706b" title="Registers a new filter with the HDF5 library.">H5Zregister()</a> can link a filter into an application, three callback functions must be defined as described in the HDF5 library header file <a class="el" href="_h5_zpublic_8h.html">H5Zpublic.h</a>.</p>
<p>When a filter is applied to the fractal heap for a group (e.g., when compressing group metadata) and if they can apply and set local callback functions that have been defined for that filter, HDF5 passes the value -1 for all parameters for those callback functions. This is done to ensure that the filter will not be applied to groups if it relies on these parameters, as they are not applicable to group fractal heaps; to operate on group fractal heaps, a filter must be capable of operating on an opaque block of binary data.</p>
<p>The <em>can-apply</em> callback function must return a positive value for a valid combination, zero for an invalid combination, and a negative value for an error. </p><div class="fragment"><div class="line"><span class="keyword">typedef</span> <a class="code" href="_h5public_8h.html#aa8f6c28736dbd0f18388c67911d38aca">htri_t</a> (*<a class="code" href="_h5_zdevelop_8h.html#af2d1e20aeb92b2712ebc2d9b5fcbf510">H5Z_can_apply_func_t</a>)(<a class="code" href="_h5_ipublic_8h.html#a0045db7ff9c22ad35db6ae91662e1943">hid_t</a> dcpl_id, <a class="code" href="_h5_ipublic_8h.html#a0045db7ff9c22ad35db6ae91662e1943">hid_t</a> type_id, <a class="code" href="_h5_ipublic_8h.html#a0045db7ff9c22ad35db6ae91662e1943">hid_t</a> space_id);</div>
<div class="ttc" id="a_h5_ipublic_8h_html_a0045db7ff9c22ad35db6ae91662e1943"><div class="ttname"><a href="_h5_ipublic_8h.html#a0045db7ff9c22ad35db6ae91662e1943">hid_t</a></div><div class="ttdeci">int64_t hid_t</div><div class="ttdef"><b>Definition:</b> H5Ipublic.h:60</div></div>
<div class="ttc" id="a_h5public_8h_html_aa8f6c28736dbd0f18388c67911d38aca"><div class="ttname"><a href="_h5public_8h.html#aa8f6c28736dbd0f18388c67911d38aca">htri_t</a></div><div class="ttdeci">int htri_t</div><div class="ttdef"><b>Definition:</b> H5public.h:265</div></div>
</div><!-- fragment --><p> Before a dataset is created, the <em>can apply</em> callbacks for any filters used in the dataset creation property list are called with the dataset's dataset creation property list, <code>dcpl_id</code>, the dataset's datatype, <code>type_id</code>, and a dataspace describing a chunk, <code>space_id</code>, (for chunked dataset storage).</p>
<p>This callback must determine whether the combination of the dataset creation property list settings, the datatype, and the dataspace represent a valid combination to which to apply this filter. For example, an invalid combination may involve the filter not operating correctly on certain datatypes, on certain datatype sizes, or on certain sizes of the chunk dataspace. If this filter is enabled through <a class="el" href="group___o_c_p_l.html#ga191c567ee50b2063979cdef156a768c5" title="Adds a filter to the filter pipeline.">H5Pset_filter()</a> as optional and the can apply function returns 0, the library will skip the filter in the filter pipeline.</p>
<p>This callback can be the NULL pointer, in which case the library will assume that the filter can be applied to a dataset with any combination of dataset creation property list values, datatypes, and dataspaces.</p>
<p>The <em>set local</em> callback function is defined as follows: </p><div class="fragment"><div class="line"><span class="keyword">typedef</span> <a class="code" href="_h5public_8h.html#a3b079ecf932a5c599499cf7e298af160">herr_t</a> (*<a class="code" href="_h5_zdevelop_8h.html#a32591ae9c5164edd548c9885f430b15e">H5Z_set_local_func_t</a>)(<a class="code" href="_h5_ipublic_8h.html#a0045db7ff9c22ad35db6ae91662e1943">hid_t</a> dcpl_id, <a class="code" href="_h5_ipublic_8h.html#a0045db7ff9c22ad35db6ae91662e1943">hid_t</a> type_id, <a class="code" href="_h5_ipublic_8h.html#a0045db7ff9c22ad35db6ae91662e1943">hid_t</a> space_id);</div>
<div class="ttc" id="a_h5public_8h_html_a3b079ecf932a5c599499cf7e298af160"><div class="ttname"><a href="_h5public_8h.html#a3b079ecf932a5c599499cf7e298af160">herr_t</a></div><div class="ttdeci">int herr_t</div><div class="ttdef"><b>Definition:</b> H5public.h:235</div></div>
</div><!-- fragment --><p> After the can apply callbacks are checked for a new dataset, the <em>set local</em> callback functions for any filters used in the dataset creation property list are called. These callbacks receive <code>dcpl_id</code>, the dataset's private copy of the dataset creation property list passed into <a class="el" href="group___h5_d.html#ga0647ba4bbd26d5230cc07f3a5685b2cf">H5Dcreate()</a> (i.e. not the actual property list passed into <a class="el" href="group___h5_d.html#ga0647ba4bbd26d5230cc07f3a5685b2cf">H5Dcreate()</a>); <code>type_id</code>, the datatype identifier passed into <a class="el" href="group___h5_d.html#ga0647ba4bbd26d5230cc07f3a5685b2cf">H5Dcreate()</a>, which is not copied and should not be modified; and <code>space_id</code>, a dataspace describing the chunk (for chunked dataset storage), which should also not be modified.</p>
<p>The set local callback must set any filter parameters that are specific to this dataset, based on the combination of the dataset creation property list values, the datatype, and the dataspace. For example, some filters perform different actions based on different datatypes, datatype sizes, numbers of dimensions, or dataspace sizes.</p>
<p>The <em>set local</em> callback may be the NULL pointer, in which case, the library will assume that there are no dataset-specific settings for this filter.</p>
<p>The <em>set local</em> callback function must return a non-negative value on success and a negative value for an error.</p>
<p>The <em>filter operation</em> callback function, defining the filter's operation on the data, is defined as follows: </p><div class="fragment"><div class="line"><span class="keyword">typedef</span> size_t (*<a class="code" href="_h5_zdevelop_8h.html#a130d8964a46667029c7d3c14572577c6">H5Z_func_t</a>)(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> flags, <span class="keywordtype">size_t</span> cd_nelmts, <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> cd_values[],</div>
<div class="line"> <span class="keywordtype">size_t</span> nbytes, <span class="keywordtype">size_t</span> *buf_size, <span class="keywordtype">void</span> **buf);</div>
</div><!-- fragment --><p> The parameters <code>flags</code>, <code>cd_nelmts</code>, and <code>cd_values</code> are the same as for the function <a class="el" href="group___o_c_p_l.html#ga191c567ee50b2063979cdef156a768c5" title="Adds a filter to the filter pipeline.">H5Pset_filter()</a>. The one exception is that an additional flag, <a class="el" href="_h5_zpublic_8h.html#a843859882318f69c9b4a38d3a88e0bfb">H5Z_FLAG_REVERSE</a>, is set when the filter is called as part of the input pipeline.</p>
<p>The parameter <code>buf</code> points to the input buffer which has a size of <code>buf_size</code> bytes, <code>nbytes</code> of which are valid data.</p>
<p>The filter should perform the transformation in place if possible. If the transformation cannot be done in place, then the filter should allocate a new buffer and assign it to <code>buf</code>, assigning the allocated size of that buffer to <code>buf_size</code>. The old buffer should be freed by the filter.</p>
<p>Some care must be taken with the functions that allocate and free memory. Standard C library functions like malloc(3) and free(3) will work in many cases, but if there is a mismatch between the memory allocators used in the library and any filter that reallocates a buffer, there could be problems. This is most often the case with Windows and/or when debugging memory allocators are being used. In both cases, the "state" of the memory allocator lies in different libraries and will get corrupted if you allocate in one library and free in another. Windows adds the C standard library via dlls that can vary with Visual Studio version and debug vs. release builds. Static links to the MSVC CRT can also introduce a new memory allocator state.</p>
<p>The library does provide <a class="el" href="group___h5.html#ga3af36230b61a287112c0cd23962b9ec4" title="Allocates memory that will be freed later internally.">H5allocate_memory()</a> and <a class="el" href="group___h5.html#ga71872bf6445cba956da86d4762b662cf" title="Frees memory allocated by the HDF5 library.">H5free_memory()</a> functions that will use the library's allocation and free functions, however using these functions will require linking your filter to a particular version of the library, which may be inconvenient.</p>
<p>If successful, the <em>filter operation</em> callback function returns the number of valid bytes of data contained in <code>buf</code>. In the case of failure, the return value is 0 (zero) and all pointer arguments are left unchanged.</p>
<dl class="section version"><dt>Version</dt><dd>1.8.6 Return type for the <em>can apply</em> callback function, <a class="el" href="_h5_zdevelop_8h.html#af2d1e20aeb92b2712ebc2d9b5fcbf510">H5Z_can_apply_func_t</a>, changed to <a class="el" href="_h5public_8h.html#aa8f6c28736dbd0f18388c67911d38aca">htri_t</a>. </dd>
<dd>
1.8.5 Semantics of the <em>can apply</em> and <em>set local</em> callback functions changed to accommodate the use of filters with group fractal heaps. </dd>
<dd>
1.8.3 <a class="el" href="_h5version_8h.html#a3f702f77f3ab031d771be3b2b4bf4fba">H5Z_class_t</a> renamed to <a class="el" href="struct_h5_z__class2__t.html">H5Z_class2_t</a>, <a class="el" href="struct_h5_z__class1__t.html">H5Z_class1_t</a> structure introduced for backwards compatibility with release 1.6.x, and <a class="el" href="_h5version_8h.html#a3f702f77f3ab031d771be3b2b4bf4fba">H5Z_class_t</a> macro introduced in this release. Function modified to accept either structure type. </dd>
<dd>
1.8.0 The fields <code>version</code>, <code>encoder_present</code>, and <code>decoder_present</code> were added to the <a class="el" href="_h5version_8h.html#a3f702f77f3ab031d771be3b2b4bf4fba">H5Z_class_t</a> <code>struct</code> in this release. </dd>
<dd>
1.6.0 This function was substantially revised in Release 1.6.0 with a new <a class="el" href="_h5version_8h.html#a3f702f77f3ab031d771be3b2b4bf4fba">H5Z_class_t</a> struct and new set local and can apply callback functions. </dd></dl>
</div>
</div>
<a id="ga6b8bcdde70c9256c50c7c62ba66380f8"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga6b8bcdde70c9256c50c7c62ba66380f8">◆ </a></span>H5Zunregister()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="_h5public_8h.html#a3b079ecf932a5c599499cf7e298af160">herr_t</a> H5Zunregister </td>
<td>(</td>
<td class="paramtype"><a class="el" href="_h5_zpublic_8h.html#afae8461c70d47e63be2163af23362237">H5Z_filter_t</a> </td>
<td class="paramname"><em>id</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Unregisters a filter. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">id</td><td>Identifier of the filter to be unregistered. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Returns a non-negative value if successful; otherwise, returns a negative value.</dd></dl>
<p><a class="el" href="group___h5_z.html#ga6b8bcdde70c9256c50c7c62ba66380f8" title="Unregisters a filter.">H5Zunregister()</a> unregisters the filter specified in <code>id</code>.</p>
<p>This function first iterates through all opened datasets and groups. If an open object that uses this filter is found, the function will fail with a message indicating that an object using the filter is still open. All open files are then flushed to make sure that all cached data that may use this filter are written out.</p>
<p>If the application is a parallel program, all processes that participate in collective data writing should call this function to ensure that all data is flushed.</p>
<p>After a call to <a class="el" href="group___h5_z.html#ga6b8bcdde70c9256c50c7c62ba66380f8" title="Unregisters a filter.">H5Zunregister()</a>, the filter specified in filter will no longer be available to the application.</p>
<dl class="section version"><dt>Version</dt><dd>1.8.12 Function modified to check for open objects using the filter. </dd></dl>
<dl class="section since"><dt>Since</dt><dd>1.6.0 </dd></dl>
</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">Generated by
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.9.1 </li>
</ul>
</div>
</body>
</html>
|