Sophie

Sophie

distrib > Mageia > 7 > armv7hl > media > core-release > by-pkgid > 0a67b807a02637f2cae68649d519a89d > files > 1818

libcryptopp-devel-7.0.0-1.mga7.armv7hl.rpm

<!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.14"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Crypto++: Singleton&lt; T, F, instance &gt; Class Template 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="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">Crypto++
   &#160;<span id="projectnumber">7.0</span>
   </div>
   <div id="projectbrief">Free&nbsp;C&#43;&#43;&nbsp;class&nbsp;library&nbsp;of&nbsp;cryptographic&nbsp;schemes</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.14 -->
<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('',false,false,'search.php','Search');
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="class_singleton-members.html">List of all members</a>  </div>
  <div class="headertitle">
<div class="title">Singleton&lt; T, F, instance &gt; Class Template Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p>Restricts the instantiation of a class to one static object without locks.  
 <a href="class_singleton.html#details">More...</a></p>
<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:a864479413a63f1752a16981a4819a123"><td class="memItemLeft" align="right" valign="top"><a id="a864479413a63f1752a16981a4819a123"></a>
&#160;</td><td class="memItemRight" valign="bottom"><b>Singleton</b> (F objectFactory=F())</td></tr>
<tr class="separator:a864479413a63f1752a16981a4819a123"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a2dfafdfafaaf20ca4cfc550125f6332d"><td class="memItemLeft" align="right" valign="top">const T &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_singleton.html#a2dfafdfafaaf20ca4cfc550125f6332d">Ref</a> (...) const</td></tr>
<tr class="memdesc:a2dfafdfafaaf20ca4cfc550125f6332d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Return a reference to the inner <a class="el" href="class_singleton.html" title="Restricts the instantiation of a class to one static object without locks. ">Singleton</a> object.  <a href="#a2dfafdfafaaf20ca4cfc550125f6332d">More...</a><br /></td></tr>
<tr class="separator:a2dfafdfafaaf20ca4cfc550125f6332d"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><h3>template&lt;class T, class F = NewObject&lt;T&gt;, int instance = 0&gt;<br />
class Singleton&lt; T, F, instance &gt;</h3>

<p>Restricts the instantiation of a class to one static object without locks. </p>
<dl class="tparams"><dt>Template Parameters</dt><dd>
  <table class="tparams">
    <tr><td class="paramname">T</td><td>the class or type </td></tr>
    <tr><td class="paramname">F</td><td>the object factory for T </td></tr>
    <tr><td class="paramname">instance</td><td>an instance counter for the class object</td></tr>
  </table>
  </dd>
</dl>
<p>This class safely initializes a static object in a multithreaded environment. For C++03 and below it will do so without using locks for portability. If two threads call <a class="el" href="class_singleton.html#a2dfafdfafaaf20ca4cfc550125f6332d" title="Return a reference to the inner Singleton object. ">Ref()</a> at the same time, they may get back different references, and one object may end up being memory leaked. This is by design and it avoids a subltle initialization problem ina multithreaded environment with thread local storage on early Windows platforms, like Windows XP and Windows 2003.</p>
<p>For C++11 and above, a standard double-checked locking pattern with thread fences are used. The locks and fences are standard and do not hinder portability.</p>
<p>Microsoft's C++11 implementation provides the necessary primitive support on Windows Vista and above when using Visual Studio 2015 (<code>cl.exe</code> version 19.00). If C++11 is desired, you should set <code>WINVER</code> or <code>_WIN32_WINNT</code> to 0x600 (or above), and compile with Visual Studio 2015. </p><dl class="section see"><dt>See also</dt><dd><a href="http://preshing.com/20130930/double-checked-locking-is-fixed-in-cpp11/">Double-Checked Locking is Fixed In C++11</a>, <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2660.htm">Dynamic Initialization and Destruction with Concurrency</a> and <a href="http://msdn.microsoft.com/en-us/library/6yh4a9k1.aspx">Thread Local Storage (TLS)</a> on MSDN. </dd></dl>
<dl class="section since"><dt>Since</dt><dd>Crypto++ 5.2 </dd></dl>

<p class="definition">Definition at line <a class="el" href="misc_8h_source.html#l00291">291</a> of file <a class="el" href="misc_8h_source.html">misc.h</a>.</p>
</div><h2 class="groupheader">Member Function Documentation</h2>
<a id="a2dfafdfafaaf20ca4cfc550125f6332d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a2dfafdfafaaf20ca4cfc550125f6332d">&#9670;&nbsp;</a></span>Ref()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;class T , class F , int instance&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">const T &amp; <a class="el" href="class_singleton.html">Singleton</a>&lt; T, F, instance &gt;::Ref </td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname"><em>...</em></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Return a reference to the inner <a class="el" href="class_singleton.html" title="Restricts the instantiation of a class to one static object without locks. ">Singleton</a> object. </p>
<dl class="tparams"><dt>Template Parameters</dt><dd>
  <table class="tparams">
    <tr><td class="paramname">T</td><td>the class or type </td></tr>
    <tr><td class="paramname">F</td><td>the object factory for T </td></tr>
    <tr><td class="paramname">instance</td><td>an instance counter for the class object</td></tr>
  </table>
  </dd>
</dl>
<p><a class="el" href="class_singleton.html#a2dfafdfafaaf20ca4cfc550125f6332d" title="Return a reference to the inner Singleton object. ">Ref()</a> is used to create the object using the object factory. The object is only created once with the limitations discussed in the class documentation. </p><dl class="section see"><dt>See also</dt><dd><a href="http://preshing.com/20130930/double-checked-locking-is-fixed-in-cpp11/">Double-Checked Locking is Fixed In C++11</a> </dd></dl>
<dl class="section since"><dt>Since</dt><dd>Crypto++ 5.2 </dd></dl>

<p class="definition">Definition at line <a class="el" href="misc_8h_source.html#l00312">312</a> of file <a class="el" href="misc_8h_source.html">misc.h</a>.</p>

</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="misc_8h_source.html">misc.h</a></li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Sun Sep 16 2018 07:58:58 for Crypto++ by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.14
</small></address>
</body>
</html>