1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2 <html xmlns="http://www.w3.org/1999/xhtml">
4 <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
5 <meta http-equiv="X-UA-Compatible" content="IE=9"/>
6 <meta name="generator" content="Doxygen 1.8.12"/>
7 <meta name="viewport" content="width=device-width, initial-scale=1"/>
8 <title>MuldeR's Utilities for Qt: MUtils::Lazy< T > Class Template Reference</title>
9 <link href="../../tabs.css" rel="stylesheet" type="text/css"/>
10 <script type="text/javascript" src="../../jquery.js"></script>
11 <script type="text/javascript" src="../../dynsections.js"></script>
12 <link href="../../search/search.css" rel="stylesheet" type="text/css"/>
13 <script type="text/javascript" src="../../search/searchdata.js"></script>
14 <script type="text/javascript" src="../../search/search.js"></script>
15 <link href="../../doxygen.css" rel="stylesheet" type="text/css" />
18 <div id="top"><!-- do not remove this div, it is closed by doxygen! -->
20 <table cellspacing="0" cellpadding="0">
22 <tr style="height: 56px;">
23 <td id="projectalign" style="padding-left: 0.5em;">
24 <div id="projectname">MuldeR's Utilities for Qt
26 <div id="projectbrief">MUtilities</div>
32 <!-- end header part -->
33 <!-- Generated by Doxygen 1.8.12 -->
34 <script type="text/javascript">
35 var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
37 <script type="text/javascript" src="../../menudata.js"></script>
38 <script type="text/javascript" src="../../menu.js"></script>
39 <script type="text/javascript">
41 initMenu('../../',true,false,'search.php','Search');
42 $(document).ready(function() { init_search(); });
45 <div id="main-nav"></div>
46 <!-- window showing the filter options -->
47 <div id="MSearchSelectWindow"
48 onmouseover="return searchBox.OnSearchSelectShow()"
49 onmouseout="return searchBox.OnSearchSelectHide()"
50 onkeydown="return searchBox.OnSearchSelectKey(event)">
53 <!-- iframe showing the search results (closed by default) -->
54 <div id="MSearchResultsWindow">
55 <iframe src="javascript:void(0)" frameborder="0"
56 name="MSearchResults" id="MSearchResults">
60 <div id="nav-path" class="navpath">
62 <li class="navelem"><a class="el" href="../../d3/da6/namespace_m_utils.html">MUtils</a></li><li class="navelem"><a class="el" href="../../d0/dce/class_m_utils_1_1_lazy.html">Lazy</a></li> </ul>
67 <a href="#pub-methods">Public Member Functions</a> |
68 <a href="#pro-methods">Protected Member Functions</a> |
69 <a href="../../da/d44/class_m_utils_1_1_lazy-members.html">List of all members</a> </div>
70 <div class="headertitle">
71 <div class="title">MUtils::Lazy< T > Class Template Reference<span class="mlabels"><span class="mlabel">abstract</span></span></div> </div>
73 <div class="contents">
75 <p><a class="el" href="../../d0/dce/class_m_utils_1_1_lazy.html" title="Lazy initialization template class. ">Lazy</a> initialization template class.
76 <a href="../../d0/dce/class_m_utils_1_1_lazy.html#details">More...</a></p>
78 <p><code>#include <<a class="el" href="../../d8/d4d/_lazy_8h_source.html">Lazy.h</a>></code></p>
79 <table class="memberdecls">
80 <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
81 Public Member Functions</h2></td></tr>
82 <tr class="memitem:a86cf7d344a38ea09d37d27acd8993f45"><td class="memItemLeft" align="right" valign="top"><a id="a86cf7d344a38ea09d37d27acd8993f45"></a>
83 T & </td><td class="memItemRight" valign="bottom"><b>operator*</b> (void)</td></tr>
84 <tr class="separator:a86cf7d344a38ea09d37d27acd8993f45"><td class="memSeparator" colspan="2"> </td></tr>
85 </table><table class="memberdecls">
86 <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pro-methods"></a>
87 Protected Member Functions</h2></td></tr>
88 <tr class="memitem:a03f52adf0e421b20298f2f7578e3375f"><td class="memItemLeft" align="right" valign="top"><a id="a03f52adf0e421b20298f2f7578e3375f"></a>
89 virtual T * </td><td class="memItemRight" valign="bottom"><b>create</b> ()=0</td></tr>
90 <tr class="separator:a03f52adf0e421b20298f2f7578e3375f"><td class="memSeparator" colspan="2"> </td></tr>
92 <a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
93 <div class="textblock"><h3>template<typename T><br />
94 class MUtils::Lazy< T ></h3>
96 <p><a class="el" href="../../d0/dce/class_m_utils_1_1_lazy.html" title="Lazy initialization template class. ">Lazy</a> initialization template class. </p>
97 <p>In order to create your own "lazy" initializer, inherit from the <code><a class="el" href="../../d0/dce/class_m_utils_1_1_lazy.html" title="Lazy initialization template class. ">Lazy</a><T></code> class an implement the <a class="el" href="../../d2/dad/_hash_8h.html#a330b73d6927d6cd95892712f9396f40e" title="Create instance of a hash function. ">create()</a> function. The lazy-initialized value can be obtained from a <code><a class="el" href="../../d0/dce/class_m_utils_1_1_lazy.html" title="Lazy initialization template class. ">Lazy</a><T></code> instance by using the <code>operator*()</code>. Initialization of the value happens when the <code>operator*()</code> is called for the very first time, by invoking the concrete <a class="el" href="../../d2/dad/_hash_8h.html#a330b73d6927d6cd95892712f9396f40e" title="Create instance of a hash function. ">create()</a> function. The return value of <a class="el" href="../../d2/dad/_hash_8h.html#a330b73d6927d6cd95892712f9396f40e" title="Create instance of a hash function. ">create()</a> is then stored internally, so that any subsequent call to the <code>operator*()</code> immediately returns the previously created value.</p>
98 <p><b>Note on thread-saftey:</b> This class is thread-safe in the sense that all calls to <code>operator*()</code> on the same <code><a class="el" href="../../d0/dce/class_m_utils_1_1_lazy.html" title="Lazy initialization template class. ">Lazy</a><T></code> instance, regardless from which thread, are guaranteed to return the exactly same value/object. Still, if the value has <em>not</em> been initialized yet <b>and</b> if multiple threads happen to call <code>operator*()</code> at the same time, then the concrete <a class="el" href="../../d2/dad/_hash_8h.html#a330b73d6927d6cd95892712f9396f40e" title="Create instance of a hash function. ">create()</a> function <em>may</em> be invoked more than once (concurrently and by different threads). In that case, all but one return value of <a class="el" href="../../d2/dad/_hash_8h.html#a330b73d6927d6cd95892712f9396f40e" title="Create instance of a hash function. ">create()</a> are discarded, and all threads eventually receive the same value/object. </p>
99 </div><hr/>The documentation for this class was generated from the following file:<ul>
100 <li>include/MUtils/<a class="el" href="../../d8/d4d/_lazy_8h_source.html">Lazy.h</a></li>
102 </div><!-- contents -->
103 <!-- start footer part -->
104 <hr class="footer"/><address class="footer"><small>
105 Generated by  <a href="http://www.doxygen.org/index.html">
106 <img class="footer" src="../../doxygen.png" alt="doxygen"/>