Sophie

Sophie

distrib > Mageia > 4 > x86_64 > by-pkgid > ba6e5e1a033bd8535c43a771ce407926 > files > 478

lib64cxx-gtk-utils2.2-devel-2.2.3-2.mga4.x86_64.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.4"/>
<title>c++-gtk-utils: Cgu::SharedPtrError&lt; T &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 style="padding-left: 0.5em;">
   <div id="projectname">c++-gtk-utils
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.4 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;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&#160;List</span></a></li>
      <li><a href="classes.html"><span>Class&#160;Index</span></a></li>
      <li><a href="hierarchy.html"><span>Class&#160;Hierarchy</span></a></li>
      <li><a href="functions.html"><span>Class&#160;Members</span></a></li>
    </ul>
  </div>
<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="namespaceCgu.html">Cgu</a></li><li class="navelem"><a class="el" href="structCgu_1_1SharedPtrError.html">SharedPtrError</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#pub-attribs">Public Attributes</a> &#124;
<a href="classCgu_1_1SharedPtrError-members.html">List of all members</a>  </div>
  <div class="headertitle">
<div class="title">Cgu::SharedPtrError&lt; T &gt; Class Template Reference<div class="ingroups"><a class="el" href="group__handles.html">handles and smart pointers</a></div></div>  </div>
</div><!--header-->
<div class="contents">

<p>This is an exception struct thrown as an alternative to deleting a managed object when internal memory allocation for <a class="el" href="classCgu_1_1SharedPtr.html" title="This is a smart pointer for managing the lifetime of objects allocated on freestore. ">SharedPtr</a> or <a class="el" href="classCgu_1_1SharedLockPtr.html" title="This is a smart pointer for managing the lifetime of objects allocated on freestore, with a thread safe reference count. ">SharedLockPtr</a> fails in their reset() method or in their constructor which takes a pointer.  
 <a href="structCgu_1_1SharedPtrError.html#details">More...</a></p>

<p><code>#include &lt;<a class="el" href="shared__ptr_8h_source.html">c++-gtk-utils/shared_ptr.h</a>&gt;</code></p>
<div class="dynheader">
Inheritance diagram for Cgu::SharedPtrError&lt; T &gt;:</div>
<div class="dyncontent">
 <div class="center">
  <img src="structCgu_1_1SharedPtrError.png" usemap="#Cgu::SharedPtrError&lt; T &gt;_map" alt=""/>
  <map id="Cgu::SharedPtrError&lt; T &gt;_map" name="Cgu::SharedPtrError&lt; T &gt;_map">
</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:ada0ea4b64dc4985297f347ff53601fd7"><td class="memItemLeft" align="right" valign="top">virtual const char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structCgu_1_1SharedPtrError.html#ada0ea4b64dc4985297f347ff53601fd7">what</a> () const   throw ()</td></tr>
<tr class="separator:ada0ea4b64dc4985297f347ff53601fd7"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:adcb074739ac2315f82c9a4260ee628a2"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structCgu_1_1SharedPtrError.html#adcb074739ac2315f82c9a4260ee628a2">SharedPtrError</a> (T *p)</td></tr>
<tr class="separator:adcb074739ac2315f82c9a4260ee628a2"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-attribs"></a>
Public Attributes</h2></td></tr>
<tr class="memitem:a34f8a8e55d8b570f8bf4e0e72c0ce14a"><td class="memItemLeft" align="right" valign="top">T *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structCgu_1_1SharedPtrError.html#a34f8a8e55d8b570f8bf4e0e72c0ce14a">obj</a></td></tr>
<tr class="separator:a34f8a8e55d8b570f8bf4e0e72c0ce14a"><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&gt;<br/>
class Cgu::SharedPtrError&lt; T &gt;</h3>

<p>This is an exception struct thrown as an alternative to deleting a managed object when internal memory allocation for <a class="el" href="classCgu_1_1SharedPtr.html" title="This is a smart pointer for managing the lifetime of objects allocated on freestore. ">SharedPtr</a> or <a class="el" href="classCgu_1_1SharedLockPtr.html" title="This is a smart pointer for managing the lifetime of objects allocated on freestore, with a thread safe reference count. ">SharedLockPtr</a> fails in their reset() method or in their constructor which takes a pointer. </p>
<dl class="section see"><dt>See Also</dt><dd><a class="el" href="classCgu_1_1SharedPtr.html" title="This is a smart pointer for managing the lifetime of objects allocated on freestore. ">SharedPtr</a> <a class="el" href="classCgu_1_1SharedLockPtr.html" title="This is a smart pointer for managing the lifetime of objects allocated on freestore, with a thread safe reference count. ">SharedLockPtr</a> <a class="el" href="namespaceCgu_1_1SharedPtrAllocFail.html">SharedPtrAllocFail</a></dd></dl>
<p>This is an exception struct thrown as an alternative to deleting a managed object when <a class="el" href="classCgu_1_1SharedPtr.html#a8212c0879da8bed0be3f0e1d270f1a66">SharedPtr&lt;T&gt;::SharedPtr(T*)</a>, <a class="el" href="classCgu_1_1SharedLockPtr.html#a73f2b86f2c9e6a5e91ede78611fb2de5">SharedLockPtr&lt;T&gt;::SharedLockPtr(T*)</a>, <a class="el" href="classCgu_1_1SharedPtr.html#a1e0c62e0f2e20d04ba2962110e16d695">SharedPtr&lt;T&gt;::reset(T*)</a> or <a class="el" href="classCgu_1_1SharedLockPtr.html#a4a99afd5ebabd42d584a8a5e06dbb8b2">SharedLockPtr&lt;T&gt;::reset(T*)</a>, would otherwise throw std::bad_alloc. To make those methods do that, <a class="el" href="namespaceCgu_1_1SharedPtrAllocFail.html#a8128321f72cdb40f5ef0fda55cf307bcabdfcc27b3dfb6a01972e562ff05f0dc9">Cgu::SharedPtrAllocFail::leave</a> is passed as their second argument.</p>
<p>If the exception is thrown, the struct has a member 'obj' of type T*, which is a pointer to the object originally passed to those methods, so the user can deal with it appropriately. This enables the result of the new expression to be passed directly as the argument to those methods without giving rise to a resource leak, as in:</p>
<div class="fragment"><div class="line"><span class="keyword">using namespace </span>Cgu;</div>
<div class="line"><a class="code" href="classCgu_1_1SharedPtr.html" title="This is a smart pointer for managing the lifetime of objects allocated on freestore. ">SharedPtr&lt;T&gt;</a> s;                              <span class="comment">// doesn&#39;t throw</span></div>
<div class="line"><span class="keywordflow">try</span> {</div>
<div class="line">  s.<a class="code" href="classCgu_1_1SharedPtr.html#a1e0c62e0f2e20d04ba2962110e16d695">reset</a>(<span class="keyword">new</span> T, <a class="code" href="namespaceCgu_1_1SharedPtrAllocFail.html#a8128321f72cdb40f5ef0fda55cf307bcabdfcc27b3dfb6a01972e562ff05f0dc9">SharedPtrAllocFail::leave</a>); <span class="comment">// both T allocation and reset() might throw</span></div>
<div class="line">}</div>
<div class="line"><span class="keywordflow">catch</span> (std::bad_alloc&amp;) {</div>
<div class="line">  ...</div>
<div class="line">}</div>
<div class="line"><span class="keywordflow">catch</span> (<a class="code" href="structCgu_1_1SharedPtrError.html" title="This is an exception struct thrown as an alternative to deleting a managed object when internal memor...">SharedPtrError&lt;T&gt;</a>&amp; e) {</div>
<div class="line">  e.<a class="code" href="structCgu_1_1SharedPtrError.html#a34f8a8e55d8b570f8bf4e0e72c0ce14a">obj</a>-&gt;do_something();</div>
<div class="line">  ...</div>
<div class="line">}</div>
<div class="line">...</div>
</div><!-- fragment --><p>As above, a catch block will need to deal with std::bad_alloc (if the call to the new expression when creating the T object fails) as well as <a class="el" href="structCgu_1_1SharedPtrError.html" title="This is an exception struct thrown as an alternative to deleting a managed object when internal memor...">SharedPtrError</a> (if the call to the new expression in the reset() method fails after a valid T object has been constructed). </p>
</div><h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
<a class="anchor" id="adcb074739ac2315f82c9a4260ee628a2"></a>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;class T&gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structCgu_1_1SharedPtrError.html">Cgu::SharedPtrError</a>&lt; T &gt;::<a class="el" href="structCgu_1_1SharedPtrError.html">SharedPtrError</a> </td>
          <td>(</td>
          <td class="paramtype">T *&#160;</td>
          <td class="paramname"><em>p</em>)</td><td></td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a class="anchor" id="ada0ea4b64dc4985297f347ff53601fd7"></a>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;class T&gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual const char* <a class="el" href="structCgu_1_1SharedPtrError.html">Cgu::SharedPtrError</a>&lt; T &gt;::what </td>
          <td>(</td>
          <td class="paramname">)</td><td></td>
          <td> const</td>
        </tr>
        <tr>
          <td align="right">throw </td><td>(</td><td colspan="2"></td>
        </tr>
        <tr>
          <td align="right"></td><td>)</td><td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

</div>
</div>
<h2 class="groupheader">Member Data Documentation</h2>
<a class="anchor" id="a34f8a8e55d8b570f8bf4e0e72c0ce14a"></a>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;class T&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">T* <a class="el" href="structCgu_1_1SharedPtrError.html">Cgu::SharedPtrError</a>&lt; T &gt;::obj</td>
        </tr>
      </table>
</div><div class="memdoc">

</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="shared__ptr_8h_source.html">shared_ptr.h</a></li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Mon Sep 16 2013 20:45:31 for c++-gtk-utils by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.4
</small></address>
</body>
</html>