blob: 3eed781ad7bec21831443dbfeed0def0e0afa448 [file] [log] [blame]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://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.17"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>mxnet: /work/mxnet/3rdparty/dmlc-core/include/dmlc/registry.h File Reference</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="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>
<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 id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">mxnet
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.17 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- 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 id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="dir_8cab8f464681f7cc51cee77e79a434cd.html">3rdparty</a></li><li class="navelem"><a class="el" href="dir_82e31a22178767beedddc7597fd1ecb6.html">dmlc-core</a></li><li class="navelem"><a class="el" href="dir_7dd5b88db83ff474628c03c453739a90.html">include</a></li><li class="navelem"><a class="el" href="dir_e30967e3ab51f65ad4b50dd298ccf4e7.html">dmlc</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#nested-classes">Classes</a> &#124;
<a href="#namespaces">Namespaces</a> &#124;
<a href="#define-members">Macros</a> </div>
<div class="headertitle">
<div class="title">registry.h File Reference</div> </div>
</div><!--header-->
<div class="contents">
<p>Registry utility that helps to build registry singletons.
<a href="#details">More...</a></p>
<div class="textblock"><code>#include &lt;map&gt;</code><br />
<code>#include &lt;string&gt;</code><br />
<code>#include &lt;vector&gt;</code><br />
<code>#include &quot;<a class="el" href="3rdparty_2dmlc-core_2include_2dmlc_2base_8h_source.html">./base.h</a>&quot;</code><br />
<code>#include &quot;./logging.h&quot;</code><br />
<code>#include &quot;<a class="el" href="parameter_8h_source.html">./parameter.h</a>&quot;</code><br />
<code>#include &quot;<a class="el" href="type__traits_8h_source.html">./type_traits.h</a>&quot;</code><br />
</div><div class="textblock"><div class="dynheader">
Include dependency graph for registry.h:</div>
<div class="dyncontent">
<div class="center"><img src="3rdparty_2dmlc-core_2include_2dmlc_2registry_8h__incl.png" border="0" usemap="#_2work_2mxnet_23rdparty_2dmlc-core_2include_2dmlc_2registry_8h" alt=""/></div>
<!-- MAP 0 -->
</div>
</div><div class="textblock"><div class="dynheader">
This graph shows which files directly or indirectly include this file:</div>
<div class="dyncontent">
<div class="center"><img src="3rdparty_2dmlc-core_2include_2dmlc_2registry_8h__dep__incl.png" border="0" usemap="#_2work_2mxnet_23rdparty_2dmlc-core_2include_2dmlc_2registry_8hdep" alt=""/></div>
<!-- MAP 1 -->
</div>
</div>
<p><a href="3rdparty_2dmlc-core_2include_2dmlc_2registry_8h_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a>
Classes</h2></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">class &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classdmlc_1_1Registry.html">dmlc::Registry&lt; EntryType &gt;</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight"><a class="el" href="classdmlc_1_1Registry.html" title="Registry class. Registry can be used to register global singletons. The most commonly use case are fa...">Registry</a> class. <a class="el" href="classdmlc_1_1Registry.html" title="Registry class. Registry can be used to register global singletons. The most commonly use case are fa...">Registry</a> can be used to register global singletons. The most commonly use case are factory functions. <a href="classdmlc_1_1Registry.html#details">More...</a><br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">class &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classdmlc_1_1FunctionRegEntryBase.html">dmlc::FunctionRegEntryBase&lt; EntryType, FunctionType &gt;</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">Common base class for function registry. <a href="classdmlc_1_1FunctionRegEntryBase.html#details">More...</a><br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="namespaces"></a>
Namespaces</h2></td></tr>
<tr class="memitem:namespacedmlc"><td class="memItemLeft" align="right" valign="top"> &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacedmlc.html">dmlc</a></td></tr>
<tr class="memdesc:namespacedmlc"><td class="mdescLeft">&#160;</td><td class="mdescRight">namespace for dmlc <br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="define-members"></a>
Macros</h2></td></tr>
<tr class="memitem:a30edfc9f7bcb9862348b512dd73354ff"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="3rdparty_2dmlc-core_2include_2dmlc_2registry_8h.html#a30edfc9f7bcb9862348b512dd73354ff">DMLC_REGISTRY_ENABLE</a>(EntryType)</td></tr>
<tr class="memdesc:a30edfc9f7bcb9862348b512dd73354ff"><td class="mdescLeft">&#160;</td><td class="mdescRight">Macro to enable the registry of EntryType. This macro must be used under namespace dmlc, and only used once in cc file. <a href="3rdparty_2dmlc-core_2include_2dmlc_2registry_8h.html#a30edfc9f7bcb9862348b512dd73354ff">More...</a><br /></td></tr>
<tr class="separator:a30edfc9f7bcb9862348b512dd73354ff"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af6870c3bce5b56d427a4d225b1194816"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="3rdparty_2dmlc-core_2include_2dmlc_2registry_8h.html#af6870c3bce5b56d427a4d225b1194816">DMLC_REGISTRY_REGISTER</a>(EntryType, EntryTypeName, Name)</td></tr>
<tr class="memdesc:af6870c3bce5b56d427a4d225b1194816"><td class="mdescLeft">&#160;</td><td class="mdescRight">Generic macro to register an EntryType There is a complete example in FactoryRegistryEntryBase. <a href="3rdparty_2dmlc-core_2include_2dmlc_2registry_8h.html#af6870c3bce5b56d427a4d225b1194816">More...</a><br /></td></tr>
<tr class="separator:af6870c3bce5b56d427a4d225b1194816"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4948c95b9237182a8c10fb02bb3e9dc2"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="3rdparty_2dmlc-core_2include_2dmlc_2registry_8h.html#a4948c95b9237182a8c10fb02bb3e9dc2">DMLC_REGISTRY_FILE_TAG</a>(UniqueTag)&#160;&#160;&#160;int __dmlc_registry_file_tag_ ## UniqueTag ## __() { return 0; }</td></tr>
<tr class="memdesc:a4948c95b9237182a8c10fb02bb3e9dc2"><td class="mdescLeft">&#160;</td><td class="mdescRight">(Optional) Declare a file tag to current file that contains object registrations. <a href="3rdparty_2dmlc-core_2include_2dmlc_2registry_8h.html#a4948c95b9237182a8c10fb02bb3e9dc2">More...</a><br /></td></tr>
<tr class="separator:a4948c95b9237182a8c10fb02bb3e9dc2"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7b08353ab775fb48862638173cf1ce38"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="3rdparty_2dmlc-core_2include_2dmlc_2registry_8h.html#a7b08353ab775fb48862638173cf1ce38">DMLC_REGISTRY_LINK_TAG</a>(UniqueTag)</td></tr>
<tr class="memdesc:a7b08353ab775fb48862638173cf1ce38"><td class="mdescLeft">&#160;</td><td class="mdescRight">(Optional) Force link to all the objects registered in file tag. <a href="3rdparty_2dmlc-core_2include_2dmlc_2registry_8h.html#a7b08353ab775fb48862638173cf1ce38">More...</a><br /></td></tr>
<tr class="separator:a7b08353ab775fb48862638173cf1ce38"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Registry utility that helps to build registry singletons. </p>
<p>Copyright (c) 2015 by Contributors </p>
</div><h2 class="groupheader">Macro Definition Documentation</h2>
<a id="a30edfc9f7bcb9862348b512dd73354ff"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a30edfc9f7bcb9862348b512dd73354ff">&#9670;&nbsp;</a></span>DMLC_REGISTRY_ENABLE</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define DMLC_REGISTRY_ENABLE</td>
<td>(</td>
<td class="paramtype">&#160;</td>
<td class="paramname">EntryType</td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<b>Value:</b><div class="fragment"><div class="line"> <span class="keyword">template</span>&lt;&gt; \</div>
<div class="line"> Registry&lt;EntryType &gt; *Registry&lt;EntryType &gt;::Get() { \</div>
<div class="line"> static Registry&lt;EntryType &gt; inst; \</div>
<div class="line"> return &amp;inst; \</div>
<div class="line"> } \</div>
</div><!-- fragment -->
<p>Macro to enable the registry of EntryType. This macro must be used under namespace dmlc, and only used once in cc file. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">EntryType</td><td>Type of registry entry </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a id="a4948c95b9237182a8c10fb02bb3e9dc2"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a4948c95b9237182a8c10fb02bb3e9dc2">&#9670;&nbsp;</a></span>DMLC_REGISTRY_FILE_TAG</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define DMLC_REGISTRY_FILE_TAG</td>
<td>(</td>
<td class="paramtype">&#160;</td>
<td class="paramname">UniqueTag</td><td>)</td>
<td>&#160;&#160;&#160;int __dmlc_registry_file_tag_ ## UniqueTag ## __() { return 0; }</td>
</tr>
</table>
</div><div class="memdoc">
<p>(Optional) Declare a file tag to current file that contains object registrations. </p>
<p>This will declare a dummy function that will be called by register file to incur a link dependency.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">UniqueTag</td><td>The unique tag used to represent. </td></tr>
</table>
</dd>
</dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="3rdparty_2dmlc-core_2include_2dmlc_2registry_8h.html#a7b08353ab775fb48862638173cf1ce38" title="(Optional) Force link to all the objects registered in file tag.">DMLC_REGISTRY_LINK_TAG</a> </dd></dl>
</div>
</div>
<a id="a7b08353ab775fb48862638173cf1ce38"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a7b08353ab775fb48862638173cf1ce38">&#9670;&nbsp;</a></span>DMLC_REGISTRY_LINK_TAG</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define DMLC_REGISTRY_LINK_TAG</td>
<td>(</td>
<td class="paramtype">&#160;</td>
<td class="paramname">UniqueTag</td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<b>Value:</b><div class="fragment"><div class="line"> <span class="keywordtype">int</span> __dmlc_registry_file_tag_ ## UniqueTag ## __(); \</div>
<div class="line"> static <span class="keywordtype">int</span> <a class="code" href="3rdparty_2dmlc-core_2include_2dmlc_2base_8h.html#a9425a87a06019a8392509217b2a1da5a">DMLC_ATTRIBUTE_UNUSED</a> __reg_file_tag_ ## UniqueTag ## __ = \</div>
<div class="line"> __dmlc_registry_file_tag_ ## UniqueTag ## __();</div>
</div><!-- fragment -->
<p>(Optional) Force link to all the objects registered in file tag. </p>
<p>This macro must be used in the same file as DMLC_REGISTRY_ENABLE and in the same namespace as DMLC_REGISTRY_FILE_TAG</p>
<p>DMLC_REGISTRY_FILE_TAG and DMLC_REGISTRY_LINK_TAG are optional macros for registration. They are used to encforce link of certain file into during static linking.</p>
<p>This is mainly used to solve problem during statically link a library which contains backward registration. Specifically, this avoids the objects in these file tags to be ignored by compiler.</p>
<p>For dynamic linking, this problem won't occur as everything is loaded by default.</p>
<p>Use of this is optional as it will create an error when a file tag do not exist. An alternative solution is always ask user to enable &ndash;whole-archieve during static link.</p>
<p>\begincode // in file objective_registry.cc <a class="el" href="3rdparty_2dmlc-core_2include_2dmlc_2registry_8h.html#a30edfc9f7bcb9862348b512dd73354ff" title="Macro to enable the registry of EntryType. This macro must be used under namespace dmlc,...">DMLC_REGISTRY_ENABLE(MyObjective)</a>; <a class="el" href="3rdparty_2dmlc-core_2include_2dmlc_2registry_8h.html#a7b08353ab775fb48862638173cf1ce38" title="(Optional) Force link to all the objects registered in file tag.">DMLC_REGISTRY_LINK_TAG(regression_op)</a>; <a class="el" href="3rdparty_2dmlc-core_2include_2dmlc_2registry_8h.html#a7b08353ab775fb48862638173cf1ce38" title="(Optional) Force link to all the objects registered in file tag.">DMLC_REGISTRY_LINK_TAG(rank_op)</a>;</p>
<p>// in file regression_op.cc // declare tag of this file. <a class="el" href="3rdparty_2dmlc-core_2include_2dmlc_2registry_8h.html#a4948c95b9237182a8c10fb02bb3e9dc2" title="(Optional) Declare a file tag to current file that contains object registrations.">DMLC_REGISTRY_FILE_TAG(regression_op)</a>; <a class="el" href="3rdparty_2dmlc-core_2include_2dmlc_2registry_8h.html#af6870c3bce5b56d427a4d225b1194816" title="Generic macro to register an EntryType There is a complete example in FactoryRegistryEntryBase.">DMLC_REGISTRY_REGISTER(MyObjective, logistic_reg, logistic_reg)</a>; // ...</p>
<p>// in file rank_op.cc // declare tag of this file. <a class="el" href="3rdparty_2dmlc-core_2include_2dmlc_2registry_8h.html#a4948c95b9237182a8c10fb02bb3e9dc2" title="(Optional) Declare a file tag to current file that contains object registrations.">DMLC_REGISTRY_FILE_TAG(rank_op)</a>; <a class="el" href="3rdparty_2dmlc-core_2include_2dmlc_2registry_8h.html#af6870c3bce5b56d427a4d225b1194816" title="Generic macro to register an EntryType There is a complete example in FactoryRegistryEntryBase.">DMLC_REGISTRY_REGISTER(MyObjective, pairwiserank, pairwiserank)</a>;</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">UniqueTag</td><td>The unique tag used to represent. </td></tr>
</table>
</dd>
</dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="3rdparty_2dmlc-core_2include_2dmlc_2registry_8h.html#a30edfc9f7bcb9862348b512dd73354ff" title="Macro to enable the registry of EntryType. This macro must be used under namespace dmlc,...">DMLC_REGISTRY_ENABLE</a>, <a class="el" href="3rdparty_2dmlc-core_2include_2dmlc_2registry_8h.html#a4948c95b9237182a8c10fb02bb3e9dc2" title="(Optional) Declare a file tag to current file that contains object registrations.">DMLC_REGISTRY_FILE_TAG</a> </dd></dl>
</div>
</div>
<a id="af6870c3bce5b56d427a4d225b1194816"></a>
<h2 class="memtitle"><span class="permalink"><a href="#af6870c3bce5b56d427a4d225b1194816">&#9670;&nbsp;</a></span>DMLC_REGISTRY_REGISTER</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define DMLC_REGISTRY_REGISTER</td>
<td>(</td>
<td class="paramtype">&#160;</td>
<td class="paramname">EntryType, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">&#160;</td>
<td class="paramname">EntryTypeName, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">&#160;</td>
<td class="paramname">Name&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<b>Value:</b><div class="fragment"><div class="line"> <span class="keyword">static</span> <a class="code" href="3rdparty_2dmlc-core_2include_2dmlc_2base_8h.html#a9425a87a06019a8392509217b2a1da5a">DMLC_ATTRIBUTE_UNUSED</a> EntryType &amp; __make_ ## EntryTypeName ## _ ## Name ## __ = <a class="code" href="classdmlc_1_1Registry.html#ae41428f0ae40e5545df63a2dd0af50d6">\</a></div>
<div class="line"><a class="code" href="classdmlc_1_1Registry.html#ae41428f0ae40e5545df63a2dd0af50d6"> ::dmlc::Registry&lt;EntryType&gt;::Get</a>()-&gt;<a class="code" href="classdmlc_1_1Registry.html#a0b71def33966eca79ad304b9da04fecc">__REGISTER__</a>(#Name) \</div>
</div><!-- fragment -->
<p>Generic macro to register an EntryType There is a complete example in FactoryRegistryEntryBase. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">EntryType</td><td>The type of registry entry. </td></tr>
<tr><td class="paramname">EntryTypeName</td><td>The typename of EntryType, must do not contain namespace :: . </td></tr>
<tr><td class="paramname">Name</td><td>The name to be registered. </td></tr>
</table>
</dd>
</dl>
<dl class="section see"><dt>See also</dt><dd>FactoryRegistryEntryBase </dd></dl>
</div>
</div>
</div><!-- contents -->
<div class="ttc" id="aclassdmlc_1_1Registry_html_a0b71def33966eca79ad304b9da04fecc"><div class="ttname"><a href="classdmlc_1_1Registry.html#a0b71def33966eca79ad304b9da04fecc">dmlc::Registry::__REGISTER__</a></div><div class="ttdeci">EntryType &amp; __REGISTER__(const std::string &amp;name)</div><div class="ttdoc">Internal function to register a name function under name.</div><div class="ttdef"><b>Definition:</b> registry.h:78</div></div>
<div class="ttc" id="aclassdmlc_1_1Registry_html_ae41428f0ae40e5545df63a2dd0af50d6"><div class="ttname"><a href="classdmlc_1_1Registry.html#ae41428f0ae40e5545df63a2dd0af50d6">dmlc::Registry::Get</a></div><div class="ttdeci">static Registry * Get()</div><div class="ttdoc">get a singleton of the Registry. This function can be defined by DMLC_REGISTRY_ENABLE.</div></div>
<div class="ttc" id="a3rdparty_2dmlc-core_2include_2dmlc_2base_8h_html_a9425a87a06019a8392509217b2a1da5a"><div class="ttname"><a href="3rdparty_2dmlc-core_2include_2dmlc_2base_8h.html#a9425a87a06019a8392509217b2a1da5a">DMLC_ATTRIBUTE_UNUSED</a></div><div class="ttdeci">#define DMLC_ATTRIBUTE_UNUSED</div><div class="ttdoc">helper macro to supress unused warning</div><div class="ttdef"><b>Definition:</b> base.h:148</div></div>
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Thu Jan 5 2023 03:47:40 for mxnet by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.17
</small></address>
</body>
</html>