278 lines
18 KiB
HTML
278 lines
18 KiB
HTML
<!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>
|
|
<title>SFML - Simple and Fast Multimedia Library</title>
|
|
<meta http-equiv="Content-Type" content="text/html;"/>
|
|
<meta charset="utf-8"/>
|
|
<!--<link rel='stylesheet' type='text/css' href="https://fonts.googleapis.com/css?family=Ubuntu:400,700,400italic"/>-->
|
|
<link rel="stylesheet" type="text/css" href="doxygen.css" title="default" media="screen,print" />
|
|
<script type="text/javascript" src="jquery.js"></script>
|
|
<script type="text/javascript" src="dynsections.js"></script>
|
|
</head>
|
|
<body>
|
|
<div id="banner-container">
|
|
<div id="banner">
|
|
<span id="sfml">SFML 2.5.1</span>
|
|
</div>
|
|
</div>
|
|
<div id="content">
|
|
<!-- Generated by Doxygen 1.8.14 -->
|
|
<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="namespaces.html"><span>Namespaces</span></a></li>
|
|
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
|
|
<li><a href="files.html"><span>Files</span></a></li>
|
|
</ul>
|
|
</div>
|
|
<div id="navrow2" class="tabs2">
|
|
<ul class="tablist">
|
|
<li><a href="annotated.html"><span>Class List</span></a></li>
|
|
<li><a href="classes.html"><span>Class Index</span></a></li>
|
|
<li><a href="hierarchy.html"><span>Class Hierarchy</span></a></li>
|
|
<li><a href="functions.html"><span>Class Members</span></a></li>
|
|
</ul>
|
|
</div>
|
|
<div id="nav-path" class="navpath">
|
|
<ul>
|
|
<li class="navelem"><b>sf</b></li><li class="navelem"><a class="el" href="classsf_1_1ThreadLocalPtr.html">ThreadLocalPtr</a></li> </ul>
|
|
</div>
|
|
</div><!-- top -->
|
|
<div class="header">
|
|
<div class="summary">
|
|
<a href="#pub-methods">Public Member Functions</a> |
|
|
<a href="#pri-methods">Private Member Functions</a> |
|
|
<a href="classsf_1_1ThreadLocalPtr-members.html">List of all members</a> </div>
|
|
<div class="headertitle">
|
|
<div class="title">sf::ThreadLocalPtr< T > Class Template Reference<div class="ingroups"><a class="el" href="group__system.html">System module</a></div></div> </div>
|
|
</div><!--header-->
|
|
<div class="contents">
|
|
|
|
<p>Pointer to a thread-local variable.
|
|
<a href="classsf_1_1ThreadLocalPtr.html#details">More...</a></p>
|
|
|
|
<p><code>#include <<a class="el" href="ThreadLocalPtr_8hpp_source.html">ThreadLocalPtr.hpp</a>></code></p>
|
|
<div class="dynheader">
|
|
Inheritance diagram for sf::ThreadLocalPtr< T >:</div>
|
|
<div class="dyncontent">
|
|
<div class="center">
|
|
<img src="classsf_1_1ThreadLocalPtr.png" usemap="#sf::ThreadLocalPtr_3C_20T_20_3E_map" alt=""/>
|
|
<map id="sf::ThreadLocalPtr_3C_20T_20_3E_map" name="sf::ThreadLocalPtr_3C_20T_20_3E_map">
|
|
<area href="classsf_1_1ThreadLocal.html" title="Defines variables with thread-local storage. " alt="sf::ThreadLocal" shape="rect" coords="0,0,146,24"/>
|
|
</map>
|
|
</div></div>
|
|
<table class="memberdecls">
|
|
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
|
|
Public Member Functions</h2></td></tr>
|
|
<tr class="memitem:a8c678211d7828d2a8c41cb534422d649"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classsf_1_1ThreadLocalPtr.html#a8c678211d7828d2a8c41cb534422d649">ThreadLocalPtr</a> (T *value=NULL)</td></tr>
|
|
<tr class="memdesc:a8c678211d7828d2a8c41cb534422d649"><td class="mdescLeft"> </td><td class="mdescRight">Default constructor. <a href="#a8c678211d7828d2a8c41cb534422d649">More...</a><br /></td></tr>
|
|
<tr class="separator:a8c678211d7828d2a8c41cb534422d649"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:ad31e8c4f342a676c759e921c08ad3343"><td class="memItemLeft" align="right" valign="top">T & </td><td class="memItemRight" valign="bottom"><a class="el" href="classsf_1_1ThreadLocalPtr.html#ad31e8c4f342a676c759e921c08ad3343">operator*</a> () const</td></tr>
|
|
<tr class="memdesc:ad31e8c4f342a676c759e921c08ad3343"><td class="mdescLeft"> </td><td class="mdescRight">Overload of unary operator *. <a href="#ad31e8c4f342a676c759e921c08ad3343">More...</a><br /></td></tr>
|
|
<tr class="separator:ad31e8c4f342a676c759e921c08ad3343"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:a752299e2858076ee89c62d4dbfb19245"><td class="memItemLeft" align="right" valign="top">T * </td><td class="memItemRight" valign="bottom"><a class="el" href="classsf_1_1ThreadLocalPtr.html#a752299e2858076ee89c62d4dbfb19245">operator-></a> () const</td></tr>
|
|
<tr class="memdesc:a752299e2858076ee89c62d4dbfb19245"><td class="mdescLeft"> </td><td class="mdescRight">Overload of operator -> <a href="#a752299e2858076ee89c62d4dbfb19245">More...</a><br /></td></tr>
|
|
<tr class="separator:a752299e2858076ee89c62d4dbfb19245"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:a81ca089ae5cda72c7470ca93041c3cb2"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classsf_1_1ThreadLocalPtr.html#a81ca089ae5cda72c7470ca93041c3cb2">operator T*</a> () const</td></tr>
|
|
<tr class="memdesc:a81ca089ae5cda72c7470ca93041c3cb2"><td class="mdescLeft"> </td><td class="mdescRight">Conversion operator to implicitly convert the pointer to its raw pointer type (T*) <a href="#a81ca089ae5cda72c7470ca93041c3cb2">More...</a><br /></td></tr>
|
|
<tr class="separator:a81ca089ae5cda72c7470ca93041c3cb2"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:a2adfc2e37f437e53acd9d1abd377ef2e"><td class="memItemLeft" align="right" valign="top"><a class="el" href="classsf_1_1ThreadLocalPtr.html">ThreadLocalPtr</a>< T > & </td><td class="memItemRight" valign="bottom"><a class="el" href="classsf_1_1ThreadLocalPtr.html#a2adfc2e37f437e53acd9d1abd377ef2e">operator=</a> (T *value)</td></tr>
|
|
<tr class="memdesc:a2adfc2e37f437e53acd9d1abd377ef2e"><td class="mdescLeft"> </td><td class="mdescRight">Assignment operator for a raw pointer parameter. <a href="#a2adfc2e37f437e53acd9d1abd377ef2e">More...</a><br /></td></tr>
|
|
<tr class="separator:a2adfc2e37f437e53acd9d1abd377ef2e"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:a934db0e5bed32b2d8d0cb02786fb91cf"><td class="memItemLeft" align="right" valign="top"><a class="el" href="classsf_1_1ThreadLocalPtr.html">ThreadLocalPtr</a>< T > & </td><td class="memItemRight" valign="bottom"><a class="el" href="classsf_1_1ThreadLocalPtr.html#a934db0e5bed32b2d8d0cb02786fb91cf">operator=</a> (const <a class="el" href="classsf_1_1ThreadLocalPtr.html">ThreadLocalPtr</a>< T > &right)</td></tr>
|
|
<tr class="memdesc:a934db0e5bed32b2d8d0cb02786fb91cf"><td class="mdescLeft"> </td><td class="mdescRight">Assignment operator for a <a class="el" href="classsf_1_1ThreadLocalPtr.html" title="Pointer to a thread-local variable. ">ThreadLocalPtr</a> parameter. <a href="#a934db0e5bed32b2d8d0cb02786fb91cf">More...</a><br /></td></tr>
|
|
<tr class="separator:a934db0e5bed32b2d8d0cb02786fb91cf"><td class="memSeparator" colspan="2"> </td></tr>
|
|
</table><table class="memberdecls">
|
|
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pri-methods"></a>
|
|
Private Member Functions</h2></td></tr>
|
|
<tr class="memitem:ab7e334c83d77644a8e67ee31c3230007"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classsf_1_1ThreadLocal.html#ab7e334c83d77644a8e67ee31c3230007">setValue</a> (void *value)</td></tr>
|
|
<tr class="memdesc:ab7e334c83d77644a8e67ee31c3230007"><td class="mdescLeft"> </td><td class="mdescRight">Set the thread-specific value of the variable. <a href="#ab7e334c83d77644a8e67ee31c3230007">More...</a><br /></td></tr>
|
|
<tr class="separator:ab7e334c83d77644a8e67ee31c3230007"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:ad68823496eb065b4b695c3468fa869bc"><td class="memItemLeft" align="right" valign="top">void * </td><td class="memItemRight" valign="bottom"><a class="el" href="classsf_1_1ThreadLocal.html#ad68823496eb065b4b695c3468fa869bc">getValue</a> () const</td></tr>
|
|
<tr class="memdesc:ad68823496eb065b4b695c3468fa869bc"><td class="mdescLeft"> </td><td class="mdescRight">Retrieve the thread-specific value of the variable. <a href="#ad68823496eb065b4b695c3468fa869bc">More...</a><br /></td></tr>
|
|
<tr class="separator:ad68823496eb065b4b695c3468fa869bc"><td class="memSeparator" colspan="2"> </td></tr>
|
|
</table>
|
|
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
|
|
<div class="textblock"><h3>template<typename T><br />
|
|
class sf::ThreadLocalPtr< T ></h3>
|
|
|
|
<p>Pointer to a thread-local variable. </p>
|
|
<p><a class="el" href="classsf_1_1ThreadLocalPtr.html" title="Pointer to a thread-local variable. ">sf::ThreadLocalPtr</a> is a type-safe wrapper for storing pointers to thread-local variables.</p>
|
|
<p>A thread-local variable holds a different value for each different thread, unlike normal variables that are shared.</p>
|
|
<p>Its usage is completely transparent, so that it is similar to manipulating the raw pointer directly (like any smart pointer).</p>
|
|
<p>Usage example: </p><div class="fragment"><div class="line">MyClass object1;</div><div class="line">MyClass object2;</div><div class="line"><a class="code" href="classsf_1_1ThreadLocalPtr.html">sf::ThreadLocalPtr<MyClass></a> objectPtr;</div><div class="line"></div><div class="line"><span class="keywordtype">void</span> thread1()</div><div class="line">{</div><div class="line"> objectPtr = &object1; <span class="comment">// doesn't impact thread2</span></div><div class="line"> ...</div><div class="line">}</div><div class="line"></div><div class="line"><span class="keywordtype">void</span> thread2()</div><div class="line">{</div><div class="line"> objectPtr = &object2; <span class="comment">// doesn't impact thread1</span></div><div class="line"> ...</div><div class="line">}</div><div class="line"></div><div class="line"><span class="keywordtype">int</span> main()</div><div class="line">{</div><div class="line"> <span class="comment">// Create and launch the two threads</span></div><div class="line"> <a class="code" href="classsf_1_1Thread.html">sf::Thread</a> t1(&thread1);</div><div class="line"> <a class="code" href="classsf_1_1Thread.html">sf::Thread</a> t2(&thread2);</div><div class="line"> t1.launch();</div><div class="line"> t2.launch();</div><div class="line"></div><div class="line"> <span class="keywordflow">return</span> 0;</div><div class="line">}</div></div><!-- fragment --><p><a class="el" href="classsf_1_1ThreadLocalPtr.html" title="Pointer to a thread-local variable. ">ThreadLocalPtr</a> is designed for internal use; however you can use it if you feel like it fits well your implementation. </p>
|
|
|
|
<p class="definition">Definition at line <a class="el" href="ThreadLocalPtr_8hpp_source.html#l00041">41</a> of file <a class="el" href="ThreadLocalPtr_8hpp_source.html">ThreadLocalPtr.hpp</a>.</p>
|
|
</div><h2 class="groupheader">Constructor & Destructor Documentation</h2>
|
|
<a id="a8c678211d7828d2a8c41cb534422d649"></a>
|
|
<h2 class="memtitle"><span class="permalink"><a href="#a8c678211d7828d2a8c41cb534422d649">◆ </a></span>ThreadLocalPtr()</h2>
|
|
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<div class="memtemplate">
|
|
template<typename T> </div>
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname"><a class="el" href="classsf_1_1ThreadLocalPtr.html">sf::ThreadLocalPtr</a>< T >::<a class="el" href="classsf_1_1ThreadLocalPtr.html">ThreadLocalPtr</a> </td>
|
|
<td>(</td>
|
|
<td class="paramtype">T * </td>
|
|
<td class="paramname"><em>value</em> = <code>NULL</code></td><td>)</td>
|
|
<td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>Default constructor. </p>
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramname">value</td><td>Optional value to initialize the variable </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
|
|
</div>
|
|
</div>
|
|
<h2 class="groupheader">Member Function Documentation</h2>
|
|
<a id="a81ca089ae5cda72c7470ca93041c3cb2"></a>
|
|
<h2 class="memtitle"><span class="permalink"><a href="#a81ca089ae5cda72c7470ca93041c3cb2">◆ </a></span>operator T*()</h2>
|
|
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<div class="memtemplate">
|
|
template<typename T> </div>
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname"><a class="el" href="classsf_1_1ThreadLocalPtr.html">sf::ThreadLocalPtr</a>< T >::operator T* </td>
|
|
<td>(</td>
|
|
<td class="paramname"></td><td>)</td>
|
|
<td> const</td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>Conversion operator to implicitly convert the pointer to its raw pointer type (T*) </p>
|
|
<dl class="section return"><dt>Returns</dt><dd>Pointer to the actual object </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a id="ad31e8c4f342a676c759e921c08ad3343"></a>
|
|
<h2 class="memtitle"><span class="permalink"><a href="#ad31e8c4f342a676c759e921c08ad3343">◆ </a></span>operator*()</h2>
|
|
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<div class="memtemplate">
|
|
template<typename T> </div>
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">T& <a class="el" href="classsf_1_1ThreadLocalPtr.html">sf::ThreadLocalPtr</a>< T >::operator* </td>
|
|
<td>(</td>
|
|
<td class="paramname"></td><td>)</td>
|
|
<td> const</td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>Overload of unary operator *. </p>
|
|
<p>Like raw pointers, applying the * operator returns a reference to the pointed-to object.</p>
|
|
<dl class="section return"><dt>Returns</dt><dd>Reference to the thread-local variable </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a id="a752299e2858076ee89c62d4dbfb19245"></a>
|
|
<h2 class="memtitle"><span class="permalink"><a href="#a752299e2858076ee89c62d4dbfb19245">◆ </a></span>operator->()</h2>
|
|
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<div class="memtemplate">
|
|
template<typename T> </div>
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">T* <a class="el" href="classsf_1_1ThreadLocalPtr.html">sf::ThreadLocalPtr</a>< T >::operator-> </td>
|
|
<td>(</td>
|
|
<td class="paramname"></td><td>)</td>
|
|
<td> const</td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>Overload of operator -> </p>
|
|
<p>Similarly to raw pointers, applying the -> operator returns the pointed-to object.</p>
|
|
<dl class="section return"><dt>Returns</dt><dd>Pointer to the thread-local variable </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a id="a2adfc2e37f437e53acd9d1abd377ef2e"></a>
|
|
<h2 class="memtitle"><span class="permalink"><a href="#a2adfc2e37f437e53acd9d1abd377ef2e">◆ </a></span>operator=() <span class="overload">[1/2]</span></h2>
|
|
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<div class="memtemplate">
|
|
template<typename T> </div>
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname"><a class="el" href="classsf_1_1ThreadLocalPtr.html">ThreadLocalPtr</a><T>& <a class="el" href="classsf_1_1ThreadLocalPtr.html">sf::ThreadLocalPtr</a>< T >::operator= </td>
|
|
<td>(</td>
|
|
<td class="paramtype">T * </td>
|
|
<td class="paramname"><em>value</em></td><td>)</td>
|
|
<td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>Assignment operator for a raw pointer parameter. </p>
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramname">value</td><td>Pointer to assign</td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="section return"><dt>Returns</dt><dd>Reference to self </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a id="a934db0e5bed32b2d8d0cb02786fb91cf"></a>
|
|
<h2 class="memtitle"><span class="permalink"><a href="#a934db0e5bed32b2d8d0cb02786fb91cf">◆ </a></span>operator=() <span class="overload">[2/2]</span></h2>
|
|
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<div class="memtemplate">
|
|
template<typename T> </div>
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname"><a class="el" href="classsf_1_1ThreadLocalPtr.html">ThreadLocalPtr</a><T>& <a class="el" href="classsf_1_1ThreadLocalPtr.html">sf::ThreadLocalPtr</a>< T >::operator= </td>
|
|
<td>(</td>
|
|
<td class="paramtype">const <a class="el" href="classsf_1_1ThreadLocalPtr.html">ThreadLocalPtr</a>< T > & </td>
|
|
<td class="paramname"><em>right</em></td><td>)</td>
|
|
<td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>Assignment operator for a <a class="el" href="classsf_1_1ThreadLocalPtr.html" title="Pointer to a thread-local variable. ">ThreadLocalPtr</a> parameter. </p>
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramname">right</td><td><a class="el" href="classsf_1_1ThreadLocalPtr.html" title="Pointer to a thread-local variable. ">ThreadLocalPtr</a> to assign</td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="section return"><dt>Returns</dt><dd>Reference to self </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
<hr/>The documentation for this class was generated from the following file:<ul>
|
|
<li><a class="el" href="ThreadLocalPtr_8hpp_source.html">ThreadLocalPtr.hpp</a></li>
|
|
</ul>
|
|
</div><!-- contents -->
|
|
</div>
|
|
<div id="footer-container">
|
|
<div id="footer">
|
|
SFML is licensed under the terms and conditions of the <a href="https://www.sfml-dev.org/license.php">zlib/png license</a>.<br>
|
|
Copyright © Laurent Gomila ::
|
|
Documentation generated by <a href="http://www.doxygen.org/" title="doxygen website">doxygen</a> ::
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html>
|