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
|
<!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.8.8"/>
<title>Hardware Locality (hwloc): Exporting Topologies to XML</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="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<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 style="padding-left: 0.5em;">
<div id="projectname">Hardware Locality (hwloc)
 <span id="projectnumber">1.10.0</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.8 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="pages.html"><span>Related Pages</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li><a href="annotated.html"><span>Data Structures</span></a></li>
</ul>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#func-members">Functions</a> </div>
<div class="headertitle">
<div class="title">Exporting Topologies to XML</div> </div>
</div><!--header-->
<div class="contents">
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:ga2bf166eda4d3605362ac86f77684002a"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="a00084.html#ga2bf166eda4d3605362ac86f77684002a">hwloc_topology_export_xml</a> (<a class="el" href="a00076.html#ga9d1e76ee15a7dee158b786c30b6a6e38">hwloc_topology_t</a> topology, const char *xmlpath)</td></tr>
<tr class="separator:ga2bf166eda4d3605362ac86f77684002a"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga7cbf8a2d8579d192911007650366fc8a"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="a00084.html#ga7cbf8a2d8579d192911007650366fc8a">hwloc_topology_export_xmlbuffer</a> (<a class="el" href="a00076.html#ga9d1e76ee15a7dee158b786c30b6a6e38">hwloc_topology_t</a> topology, char **xmlbuffer, int *buflen)</td></tr>
<tr class="separator:ga7cbf8a2d8579d192911007650366fc8a"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga293e4a6489f15fd16ad22a5734561cf1"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="a00084.html#ga293e4a6489f15fd16ad22a5734561cf1">hwloc_free_xmlbuffer</a> (<a class="el" href="a00076.html#ga9d1e76ee15a7dee158b786c30b6a6e38">hwloc_topology_t</a> topology, char *xmlbuffer)</td></tr>
<tr class="separator:ga293e4a6489f15fd16ad22a5734561cf1"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga9d6ff0f7a8dd45be9aa8575ef31978cc"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="a00084.html#ga9d6ff0f7a8dd45be9aa8575ef31978cc">hwloc_topology_set_userdata_export_callback</a> (<a class="el" href="a00076.html#ga9d1e76ee15a7dee158b786c30b6a6e38">hwloc_topology_t</a> topology, void(*export_cb)(void *reserved, <a class="el" href="a00076.html#ga9d1e76ee15a7dee158b786c30b6a6e38">hwloc_topology_t</a> topology, <a class="el" href="a00075.html#ga79b8ab56877ef99ac59b833203391c7d">hwloc_obj_t</a> obj))</td></tr>
<tr class="separator:ga9d6ff0f7a8dd45be9aa8575ef31978cc"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:gaa541bdd628416dbbe97d0df69d3de958"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="a00084.html#gaa541bdd628416dbbe97d0df69d3de958">hwloc_export_obj_userdata</a> (void *reserved, <a class="el" href="a00076.html#ga9d1e76ee15a7dee158b786c30b6a6e38">hwloc_topology_t</a> topology, <a class="el" href="a00075.html#ga79b8ab56877ef99ac59b833203391c7d">hwloc_obj_t</a> obj, const char *name, const void *buffer, size_t length)</td></tr>
<tr class="separator:gaa541bdd628416dbbe97d0df69d3de958"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga1b7358137cec27bd073f58a606ecbaba"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="a00084.html#ga1b7358137cec27bd073f58a606ecbaba">hwloc_export_obj_userdata_base64</a> (void *reserved, <a class="el" href="a00076.html#ga9d1e76ee15a7dee158b786c30b6a6e38">hwloc_topology_t</a> topology, <a class="el" href="a00075.html#ga79b8ab56877ef99ac59b833203391c7d">hwloc_obj_t</a> obj, const char *name, const void *buffer, size_t length)</td></tr>
<tr class="separator:ga1b7358137cec27bd073f58a606ecbaba"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga5ac6917ea7289955fb1ffda4353af9b0"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="a00084.html#ga5ac6917ea7289955fb1ffda4353af9b0">hwloc_topology_set_userdata_import_callback</a> (<a class="el" href="a00076.html#ga9d1e76ee15a7dee158b786c30b6a6e38">hwloc_topology_t</a> topology, void(*import_cb)(<a class="el" href="a00076.html#ga9d1e76ee15a7dee158b786c30b6a6e38">hwloc_topology_t</a> topology, <a class="el" href="a00075.html#ga79b8ab56877ef99ac59b833203391c7d">hwloc_obj_t</a> obj, const char *name, const void *buffer, size_t length))</td></tr>
<tr class="separator:ga5ac6917ea7289955fb1ffda4353af9b0"><td class="memSeparator" colspan="2"> </td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<h2 class="groupheader">Function Documentation</h2>
<a class="anchor" id="gaa541bdd628416dbbe97d0df69d3de958"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int hwloc_export_obj_userdata </td>
<td>(</td>
<td class="paramtype">void * </td>
<td class="paramname"><em>reserved</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="a00076.html#ga9d1e76ee15a7dee158b786c30b6a6e38">hwloc_topology_t</a> </td>
<td class="paramname"><em>topology</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="a00075.html#ga79b8ab56877ef99ac59b833203391c7d">hwloc_obj_t</a> </td>
<td class="paramname"><em>obj</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const char * </td>
<td class="paramname"><em>name</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const void * </td>
<td class="paramname"><em>buffer</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">size_t </td>
<td class="paramname"><em>length</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Export some object userdata to XML. </p>
<p>This function may only be called from within the export() callback passed to <a class="el" href="a00084.html#ga9d6ff0f7a8dd45be9aa8575ef31978cc" title="Set the application-specific callback for exporting object userdata. ">hwloc_topology_set_userdata_export_callback()</a>. It may be invoked one of multiple times to export some userdata to XML. The <code>buffer</code> content of length <code>length</code> is stored with optional name <code>name</code>.</p>
<p>When importing this XML file, the import() callback (if set) will be called exactly as many times as <a class="el" href="a00084.html#gaa541bdd628416dbbe97d0df69d3de958" title="Export some object userdata to XML. ">hwloc_export_obj_userdata()</a> was called during export(). It will receive the corresponding <code>name</code>, <code>buffer</code> and <code>length</code> arguments.</p>
<p><code>reserved</code>, <code>topology</code> and <code>obj</code> must be the first three parameters that were given to the export callback.</p>
<p>Only printable characters may be exported to XML string attributes. If a non-printable character is passed in <code>name</code> or <code>buffer</code>, the function returns -1 with errno set to EINVAL.</p>
<p>If exporting binary data, the application should first encode into printable characters only (or use <a class="el" href="a00084.html#ga1b7358137cec27bd073f58a606ecbaba" title="Encode and export some object userdata to XML. ">hwloc_export_obj_userdata_base64()</a>). It should also take care of portability issues if the export may be reimported on a different architecture. </p>
</div>
</div>
<a class="anchor" id="ga1b7358137cec27bd073f58a606ecbaba"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int hwloc_export_obj_userdata_base64 </td>
<td>(</td>
<td class="paramtype">void * </td>
<td class="paramname"><em>reserved</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="a00076.html#ga9d1e76ee15a7dee158b786c30b6a6e38">hwloc_topology_t</a> </td>
<td class="paramname"><em>topology</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="a00075.html#ga79b8ab56877ef99ac59b833203391c7d">hwloc_obj_t</a> </td>
<td class="paramname"><em>obj</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const char * </td>
<td class="paramname"><em>name</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const void * </td>
<td class="paramname"><em>buffer</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">size_t </td>
<td class="paramname"><em>length</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Encode and export some object userdata to XML. </p>
<p>This function is similar to <a class="el" href="a00084.html#gaa541bdd628416dbbe97d0df69d3de958" title="Export some object userdata to XML. ">hwloc_export_obj_userdata()</a> but it encodes the input buffer into printable characters before exporting. On import, decoding is automatically performed before the data is given to the import() callback if any.</p>
<p>This function may only be called from within the export() callback passed to <a class="el" href="a00084.html#ga9d6ff0f7a8dd45be9aa8575ef31978cc" title="Set the application-specific callback for exporting object userdata. ">hwloc_topology_set_userdata_export_callback()</a>.</p>
<p>The function does not take care of portability issues if the export may be reimported on a different architecture. </p>
</div>
</div>
<a class="anchor" id="ga293e4a6489f15fd16ad22a5734561cf1"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void hwloc_free_xmlbuffer </td>
<td>(</td>
<td class="paramtype"><a class="el" href="a00076.html#ga9d1e76ee15a7dee158b786c30b6a6e38">hwloc_topology_t</a> </td>
<td class="paramname"><em>topology</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">char * </td>
<td class="paramname"><em>xmlbuffer</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Free a buffer allocated by <a class="el" href="a00084.html#ga7cbf8a2d8579d192911007650366fc8a" title="Export the topology into a newly-allocated XML memory buffer. ">hwloc_topology_export_xmlbuffer()</a> </p>
</div>
</div>
<a class="anchor" id="ga2bf166eda4d3605362ac86f77684002a"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int hwloc_topology_export_xml </td>
<td>(</td>
<td class="paramtype"><a class="el" href="a00076.html#ga9d1e76ee15a7dee158b786c30b6a6e38">hwloc_topology_t</a> </td>
<td class="paramname"><em>topology</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const char * </td>
<td class="paramname"><em>xmlpath</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Export the topology into an XML file. </p>
<p>This file may be loaded later through <a class="el" href="a00077.html#ga879439b7ee99407ee911b3ac64e9a25e" title="Enable XML-file based topology. ">hwloc_topology_set_xml()</a>.</p>
<dl class="section return"><dt>Returns</dt><dd>-1 if a failure occured.</dd></dl>
<dl class="section note"><dt>Note</dt><dd>See also <a class="el" href="a00084.html#ga9d6ff0f7a8dd45be9aa8575ef31978cc" title="Set the application-specific callback for exporting object userdata. ">hwloc_topology_set_userdata_export_callback()</a> for exporting application-specific object userdata.</dd>
<dd>
The topology-specific userdata pointer is ignored when exporting to XML.</dd>
<dd>
Only printable characters may be exported to XML string attributes. Any other character, especially any non-ASCII character, will be silently dropped.</dd>
<dd>
If <code>name</code> is "-", the XML output is sent to the standard output. </dd></dl>
</div>
</div>
<a class="anchor" id="ga7cbf8a2d8579d192911007650366fc8a"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int hwloc_topology_export_xmlbuffer </td>
<td>(</td>
<td class="paramtype"><a class="el" href="a00076.html#ga9d1e76ee15a7dee158b786c30b6a6e38">hwloc_topology_t</a> </td>
<td class="paramname"><em>topology</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">char ** </td>
<td class="paramname"><em>xmlbuffer</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int * </td>
<td class="paramname"><em>buflen</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Export the topology into a newly-allocated XML memory buffer. </p>
<p><code>xmlbuffer</code> is allocated by the callee and should be freed with <a class="el" href="a00084.html#ga293e4a6489f15fd16ad22a5734561cf1" title="Free a buffer allocated by hwloc_topology_export_xmlbuffer() ">hwloc_free_xmlbuffer()</a> later in the caller.</p>
<p>This memory buffer may be loaded later through <a class="el" href="a00077.html#ga2745616b65595e1c1e579ecc7e461fa8" title="Enable XML based topology using a memory buffer (instead of a file, as with hwloc_topology_set_xml())...">hwloc_topology_set_xmlbuffer()</a>.</p>
<dl class="section return"><dt>Returns</dt><dd>-1 if a failure occured.</dd></dl>
<dl class="section note"><dt>Note</dt><dd>See also <a class="el" href="a00084.html#ga9d6ff0f7a8dd45be9aa8575ef31978cc" title="Set the application-specific callback for exporting object userdata. ">hwloc_topology_set_userdata_export_callback()</a> for exporting application-specific object userdata.</dd>
<dd>
The topology-specific userdata pointer is ignored when exporting to XML.</dd>
<dd>
Only printable characters may be exported to XML string attributes. Any other character, especially any non-ASCII character, will be silently dropped. </dd></dl>
</div>
</div>
<a class="anchor" id="ga9d6ff0f7a8dd45be9aa8575ef31978cc"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void hwloc_topology_set_userdata_export_callback </td>
<td>(</td>
<td class="paramtype"><a class="el" href="a00076.html#ga9d1e76ee15a7dee158b786c30b6a6e38">hwloc_topology_t</a> </td>
<td class="paramname"><em>topology</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">void(*)(void *reserved, <a class="el" href="a00076.html#ga9d1e76ee15a7dee158b786c30b6a6e38">hwloc_topology_t</a> topology, <a class="el" href="a00075.html#ga79b8ab56877ef99ac59b833203391c7d">hwloc_obj_t</a> obj) </td>
<td class="paramname"><em>export_cb</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Set the application-specific callback for exporting object userdata. </p>
<p>The object userdata pointer is not exported to XML by default because hwloc does not know what it contains.</p>
<p>This function lets applications set <code>export_cb</code> to a callback function that converts this opaque userdata into an exportable string.</p>
<p><code>export_cb</code> is invoked during XML export for each object whose <code>userdata</code> pointer is not <code>NULL</code>. The callback should use <a class="el" href="a00084.html#gaa541bdd628416dbbe97d0df69d3de958" title="Export some object userdata to XML. ">hwloc_export_obj_userdata()</a> or <a class="el" href="a00084.html#ga1b7358137cec27bd073f58a606ecbaba" title="Encode and export some object userdata to XML. ">hwloc_export_obj_userdata_base64()</a> to actually export something to XML (possibly multiple times per object).</p>
<p><code>export_cb</code> may be set to <code>NULL</code> if userdata should not be exported to XML.</p>
<dl class="section note"><dt>Note</dt><dd>The topology-specific userdata pointer is ignored when exporting to XML. </dd></dl>
</div>
</div>
<a class="anchor" id="ga5ac6917ea7289955fb1ffda4353af9b0"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void hwloc_topology_set_userdata_import_callback </td>
<td>(</td>
<td class="paramtype"><a class="el" href="a00076.html#ga9d1e76ee15a7dee158b786c30b6a6e38">hwloc_topology_t</a> </td>
<td class="paramname"><em>topology</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">void(*)(<a class="el" href="a00076.html#ga9d1e76ee15a7dee158b786c30b6a6e38">hwloc_topology_t</a> topology, <a class="el" href="a00075.html#ga79b8ab56877ef99ac59b833203391c7d">hwloc_obj_t</a> obj, const char *name, const void *buffer, size_t length) </td>
<td class="paramname"><em>import_cb</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Set the application-specific callback for importing userdata. </p>
<p>On XML import, userdata is ignored by default because hwloc does not know how to store it in memory.</p>
<p>This function lets applications set <code>import_cb</code> to a callback function that will get the XML-stored userdata and store it in the object as expected by the application.</p>
<p><code>import_cb</code> is called during <a class="el" href="a00076.html#gabdf58d87ad77f6615fccdfe0535ff826" title="Build the actual topology. ">hwloc_topology_load()</a> as many times as <a class="el" href="a00084.html#gaa541bdd628416dbbe97d0df69d3de958" title="Export some object userdata to XML. ">hwloc_export_obj_userdata()</a> was called during export. The topology is not entirely setup yet. Object attributes are ready to consult, but links between objects are not.</p>
<p><code>import_cb</code> may be <code>NULL</code> if userdata should be ignored during import.</p>
<dl class="section note"><dt>Note</dt><dd><code>buffer</code> contains <code>length</code> characters followed by a null byte ('\0').</dd>
<dd>
This function should be called before <a class="el" href="a00076.html#gabdf58d87ad77f6615fccdfe0535ff826" title="Build the actual topology. ">hwloc_topology_load()</a>.</dd>
<dd>
The topology-specific userdata pointer is ignored when importing from XML. </dd></dl>
</div>
</div>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Tue Oct 7 2014 11:56:52 for Hardware Locality (hwloc) by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.8
</small></address>
</body>
</html>
|