Sophie

Sophie

distrib > Fedora > 18 > x86_64 > by-pkgid > b3a1f4d91c26f535919e39e25606614a > files > 1228

wt-doc-3.2.3-1.fc18.noarch.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"/>
<title>Wt: Wt::Dbo::ptr&lt; C &gt; Class Template Reference</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />

<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>

</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">Wt
   &#160;<span id="projectnumber">3.2.3</span>
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.5.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <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>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </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="inherits.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="namespaceWt.html">Wt</a>      </li>
      <li class="navelem"><a class="el" href="namespaceWt_1_1Dbo.html">Dbo</a>      </li>
      <li class="navelem"><a class="el" href="classWt_1_1Dbo_1_1ptr.html">ptr</a>      </li>
    </ul>
  </div>
</div>
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a>  </div>
  <div class="headertitle">
<div class="title">Wt::Dbo::ptr&lt; C &gt; Class Template Reference<div class="ingroups"><a class="el" href="group__dbo.html">Database Objects (Wt::Dbo)</a></div></div>  </div>
</div>
<div class="contents">
<!-- doxytag: class="Wt::Dbo::ptr" --><!-- doxytag: inherits="Wt::Dbo::ptr_base" -->
<p>A smart pointer for a database object.  
 <a href="classWt_1_1Dbo_1_1ptr.html#details">More...</a></p>

<p><code>#include &lt;Wt/Dbo/ptr&gt;</code></p>

<p>Inherits Wt::Dbo::ptr_base.</p>

<p><a href="classWt_1_1Dbo_1_1ptr-members.html">List of all members.</a></p>
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1Dbo_1_1ptr.html#a55cf9170cd012a15df206ac54178da3a">ptr</a> (C *obj=0)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Creates a new pointer.  <a href="#a55cf9170cd012a15df206ac54178da3a"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ae8cdf1ba27d9b31cb03c37d16ded0776"></a><!-- doxytag: member="Wt::Dbo::ptr::ptr" ref="ae8cdf1ba27d9b31cb03c37d16ded0776" args="(const ptr&lt; C &gt; &amp;other)" -->
&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1Dbo_1_1ptr.html#ae8cdf1ba27d9b31cb03c37d16ded0776">ptr</a> (const <a class="el" href="classWt_1_1Dbo_1_1ptr.html">ptr</a>&lt; C &gt; &amp;other)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Copy constructor. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1Dbo_1_1ptr.html#a8ba24bdad5f3536eabe1a378d3d2bdec">~ptr</a> ()</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Destructor.  <a href="#a8ba24bdad5f3536eabe1a378d3d2bdec"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1Dbo_1_1ptr.html#aa93933be1dde5b88f8220fd578e0714e">reset</a> (C *obj=0)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Resets the pointer.  <a href="#aa93933be1dde5b88f8220fd578e0714e"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="af8ea4ded2103a4ec31306549cbbf74f5"></a><!-- doxytag: member="Wt::Dbo::ptr::operator=" ref="af8ea4ded2103a4ec31306549cbbf74f5" args="(const ptr&lt; C &gt; &amp;other)" -->
<a class="el" href="classWt_1_1Dbo_1_1ptr.html">ptr</a>&lt; C &gt; &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1Dbo_1_1ptr.html#af8ea4ded2103a4ec31306549cbbf74f5">operator=</a> (const <a class="el" href="classWt_1_1Dbo_1_1ptr.html">ptr</a>&lt; C &gt; &amp;other)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Assignment operator. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">const C *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1Dbo_1_1ptr.html#afe3605c8c5d46ddd078775275fb0cbc9">operator-&gt;</a> () const </td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Dereference operator.  <a href="#afe3605c8c5d46ddd078775275fb0cbc9"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">const C *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1Dbo_1_1ptr.html#a5374f4fe397aff412c7b80511f2080d0">get</a> () const </td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the pointer.  <a href="#a5374f4fe397aff412c7b80511f2080d0"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">const C &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1Dbo_1_1ptr.html#a6cabfa29875c40ce04e57c71df406e9a">operator*</a> () const </td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Dereference operator.  <a href="#a6cabfa29875c40ce04e57c71df406e9a"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">C *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1Dbo_1_1ptr.html#ac14d20e52b5cd9eee356488c7416c044">modify</a> () const </td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Dereference operator, for writing.  <a href="#ac14d20e52b5cd9eee356488c7416c044"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1Dbo_1_1ptr.html#a6992f0c852b65dfe6be35a88dc880e45">operator==</a> (const <a class="el" href="classWt_1_1Dbo_1_1ptr.html">ptr</a>&lt; C &gt; &amp;other) const </td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Comparison operator.  <a href="#a6992f0c852b65dfe6be35a88dc880e45"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1Dbo_1_1ptr.html#a1b8e00b1231dd0d9577c9163dd76a42a">operator!=</a> (const <a class="el" href="classWt_1_1Dbo_1_1ptr.html">ptr</a>&lt; C &gt; &amp;other) const </td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Comparison operator.  <a href="#a1b8e00b1231dd0d9577c9163dd76a42a"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1Dbo_1_1ptr.html#a4c283ff5e8d099e92d1ed0fcdeaecf16">operator&lt;</a> (const <a class="el" href="classWt_1_1Dbo_1_1ptr.html">ptr</a>&lt; C &gt; &amp;other) const </td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Comparison operator.  <a href="#a4c283ff5e8d099e92d1ed0fcdeaecf16"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1Dbo_1_1ptr.html#aa8c343715b6fafc63d34f2af7419f267">operator bool</a> () const </td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Checks for null.  <a href="#aa8c343715b6fafc63d34f2af7419f267"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1Dbo_1_1ptr.html#aaf91f5ef8bcdabfafcd9abb4182625bd">flush</a> () const </td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Flushes the object.  <a href="#aaf91f5ef8bcdabfafcd9abb4182625bd"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1Dbo_1_1ptr.html#af4b26afebd56abc42005ef9f954d8fee">remove</a> ()</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Removes an object from the database.  <a href="#af4b26afebd56abc42005ef9f954d8fee"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1Dbo_1_1ptr.html#abb1db71ef910748437d69bf11a04eb6e">reread</a> ()</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Rereads the database version.  <a href="#abb1db71ef910748437d69bf11a04eb6e"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1Dbo_1_1ptr.html#a7330a5220e3e926b5c084444116499a4">purge</a> ()</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Purges an object from memory.  <a href="#a7330a5220e3e926b5c084444116499a4"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="structWt_1_1Dbo_1_1dbo__traits.html">dbo_traits</a>&lt; C &gt;::IdType&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1Dbo_1_1ptr.html#a71d848cf0e8eaa1a4e01b11ae2f1e865">id</a> () const </td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the object id.  <a href="#a71d848cf0e8eaa1a4e01b11ae2f1e865"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1Dbo_1_1ptr.html#a5c907971ba36fa3c5145b683abc76c76">version</a> () const </td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the object version.  <a href="#a5c907971ba36fa3c5145b683abc76c76"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="classWt_1_1Dbo_1_1Session.html">Session</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1Dbo_1_1ptr.html#a1f82a97723f3cc914e44eb423286ba51">session</a> () const </td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the session with which this pointer is associated.  <a href="#a1f82a97723f3cc914e44eb423286ba51"></a><br/></td></tr>
</table>
<hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
<div class="textblock"><h3>template&lt;class C&gt;<br/>
class Wt::Dbo::ptr&lt; C &gt;</h3>

<p>A smart pointer for a database object. </p>
<p>This smart pointer class implements a reference counted shared pointer for database objects, which also keeps tracking of synchronization between the in-memory copy and the database copy. You should always use this pointer class to reference a database object.</p>
<p>Unlike typical C++ data structures, classes mapped to database tables do not have clear ownership relationships. Therefore, the conventional ownership-based memory allocation/deallocation does not work naturally for database classes.</p>
<p>A pointer may point to a <em>transient</em> object or a <em>persisted</em> object. A persisted object has a corresponding copy in the database while a transient object is only present in memory. To persist a new object, use <a class="el" href="classWt_1_1Dbo_1_1Session.html#abfbd5bea3a6b964e833c893434e38c8f" title="Persists a transient object.">Session::add()</a>. To make a persisted object transient, use <a class="el" href="classWt_1_1Dbo_1_1ptr.html#af4b26afebd56abc42005ef9f954d8fee" title="Removes an object from the database.">remove()</a>.</p>
<p>Unlike a typical smart pointer, this pointer only allows read access to the underlying object by default. To modify the object, you should explicitly use <a class="el" href="classWt_1_1Dbo_1_1ptr.html#ac14d20e52b5cd9eee356488c7416c044" title="Dereference operator, for writing.">modify()</a>. This is used to mark the underyling object as <em>dirty</em> to add it to the queue of objects to be synchronized with the database.</p>
<p>The pointer class provides a number of methods to deal with the persistence state of the object:</p>
<ul>
<li><a class="el" href="classWt_1_1Dbo_1_1ptr.html#a71d848cf0e8eaa1a4e01b11ae2f1e865" title="Returns the object id.">id()</a>: returns the database id</li>
<li><a class="el" href="classWt_1_1Dbo_1_1ptr.html#aaf91f5ef8bcdabfafcd9abb4182625bd" title="Flushes the object.">flush()</a>: forces the object to be synchronized to the database</li>
<li><a class="el" href="classWt_1_1Dbo_1_1ptr.html#af4b26afebd56abc42005ef9f954d8fee" title="Removes an object from the database.">remove()</a>: deletes the object in the underlying database</li>
<li><a class="el" href="classWt_1_1Dbo_1_1ptr.html#abb1db71ef910748437d69bf11a04eb6e" title="Rereads the database version.">reread()</a>: rereads the database copy of the object</li>
<li><a class="el" href="classWt_1_1Dbo_1_1ptr.html#a7330a5220e3e926b5c084444116499a4" title="Purges an object from memory.">purge()</a>: purges the transient version of a non-dirty object. </li>
</ul>
</div><hr/><h2>Constructor &amp; Destructor Documentation</h2>
<a class="anchor" id="a55cf9170cd012a15df206ac54178da3a"></a><!-- doxytag: member="Wt::Dbo::ptr::ptr" ref="a55cf9170cd012a15df206ac54178da3a" args="(C *obj=0)" -->
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;class C&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classWt_1_1Dbo_1_1ptr.html">Wt::Dbo::ptr</a>&lt; C &gt;::<a class="el" href="classWt_1_1Dbo_1_1ptr.html">ptr</a> </td>
          <td>(</td>
          <td class="paramtype">C *&#160;</td>
          <td class="paramname"><em>obj</em> = <code>0</code></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Creates a new pointer. </p>
<p>When <code>obj</code> is not 0, the pointer points to the new unpersisted object. Use <a class="el" href="classWt_1_1Dbo_1_1Session.html#abfbd5bea3a6b964e833c893434e38c8f" title="Persists a transient object.">Session::add()</a> to persist the newly created object. </p>

</div>
</div>
<a class="anchor" id="a8ba24bdad5f3536eabe1a378d3d2bdec"></a><!-- doxytag: member="Wt::Dbo::ptr::~ptr" ref="a8ba24bdad5f3536eabe1a378d3d2bdec" args="()" -->
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;class C &gt; </div>
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classWt_1_1Dbo_1_1ptr.html">Wt::Dbo::ptr</a>&lt; C &gt;::~<a class="el" href="classWt_1_1Dbo_1_1ptr.html">ptr</a> </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td><code> [virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Destructor. </p>
<p>This method will delete the transient copy of the database object if it is not referenced by any other pointer. </p>

</div>
</div>
<hr/><h2>Member Function Documentation</h2>
<a class="anchor" id="aaf91f5ef8bcdabfafcd9abb4182625bd"></a><!-- doxytag: member="Wt::Dbo::ptr::flush" ref="aaf91f5ef8bcdabfafcd9abb4182625bd" args="() const " -->
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;class C &gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="classWt_1_1Dbo_1_1ptr.html">Wt::Dbo::ptr</a>&lt; C &gt;::flush </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Flushes the object. </p>
<p>If dirty, the object is synchronized to the database. This will automatically also flush objects that are referenced by this object if needed. The object is not actually committed to the database before the active transaction has been committed.</p>
<p>Since this may persist object to the database, you should have an active transaction. </p>

</div>
</div>
<a class="anchor" id="a5374f4fe397aff412c7b80511f2080d0"></a><!-- doxytag: member="Wt::Dbo::ptr::get" ref="a5374f4fe397aff412c7b80511f2080d0" args="() const " -->
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;class C &gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">const C * <a class="el" href="classWt_1_1Dbo_1_1ptr.html">Wt::Dbo::ptr</a>&lt; C &gt;::get </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Returns the pointer. </p>
<p>Note that returns a const pointer. Use <a class="el" href="classWt_1_1Dbo_1_1ptr.html#ac14d20e52b5cd9eee356488c7416c044" title="Dereference operator, for writing.">modify()</a> to get a non-const pointer.</p>
<p>Since this may lazy-load the underlying database object, you should have an active transaction.</p>
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="classWt_1_1Dbo_1_1ptr.html#ac14d20e52b5cd9eee356488c7416c044" title="Dereference operator, for writing.">modify()</a> </dd></dl>

</div>
</div>
<a class="anchor" id="a71d848cf0e8eaa1a4e01b11ae2f1e865"></a><!-- doxytag: member="Wt::Dbo::ptr::id" ref="a71d848cf0e8eaa1a4e01b11ae2f1e865" args="() const " -->
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;class C &gt; </div>
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structWt_1_1Dbo_1_1dbo__traits.html">dbo_traits</a>&lt; C &gt;::IdType <a class="el" href="classWt_1_1Dbo_1_1ptr.html">Wt::Dbo::ptr</a>&lt; C &gt;::id </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Returns the object id. </p>
<p>This returns <a class="el" href="structWt_1_1Dbo_1_1dbo__traits.html#aae2a13a4ca038f5bad337fbc2d70d37c" title="Returns the sentinel value for a null id.">dbo_traits&lt;C&gt;::invalidId()</a> for a transient object. </p>

</div>
</div>
<a class="anchor" id="ac14d20e52b5cd9eee356488c7416c044"></a><!-- doxytag: member="Wt::Dbo::ptr::modify" ref="ac14d20e52b5cd9eee356488c7416c044" args="() const " -->
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;class C &gt; </div>
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classWt_1_1Dbo_1_1ptr.html">ptr</a>&lt; C &gt;::mutator <a class="el" href="classWt_1_1Dbo_1_1ptr.html">Wt::Dbo::ptr</a>&lt; C &gt;::modify </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Dereference operator, for writing. </p>
<p>Returns the underlying object (or, rather, a proxy for it) with the intention to modify it. The proxy object will mark the object as dirty from its destructor. An involved modification should therefore preferably be implemented as a separate method or function to make sure that the object is marked as dirty after the whole modification: </p>
<div class="fragment"><pre class="fragment">   ptr&lt;A&gt; a = ...;
   a.modify()-&gt;doSomething();
</pre></div><p>Since this may lazy-load the underlying database object, you should have an active transaction.</p>
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="classWt_1_1Dbo_1_1ptr.html#a5374f4fe397aff412c7b80511f2080d0" title="Returns the pointer.">get()</a> </dd></dl>

</div>
</div>
<a class="anchor" id="aa8c343715b6fafc63d34f2af7419f267"></a><!-- doxytag: member="Wt::Dbo::ptr::operator bool" ref="aa8c343715b6fafc63d34f2af7419f267" args="() const " -->
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;class C &gt; </div>
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classWt_1_1Dbo_1_1ptr.html">Wt::Dbo::ptr</a>&lt; C &gt;::operator bool </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Checks for null. </p>
<p>Returns true if the pointer is pointing to a non-null object. </p>

</div>
</div>
<a class="anchor" id="a1b8e00b1231dd0d9577c9163dd76a42a"></a><!-- doxytag: member="Wt::Dbo::ptr::operator!=" ref="a1b8e00b1231dd0d9577c9163dd76a42a" args="(const ptr&lt; C &gt; &amp;other) const " -->
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;class C&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">bool <a class="el" href="classWt_1_1Dbo_1_1ptr.html">Wt::Dbo::ptr</a>&lt; C &gt;::operator!= </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="classWt_1_1Dbo_1_1ptr.html">ptr</a>&lt; C &gt; &amp;&#160;</td>
          <td class="paramname"><em>other</em></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Comparison operator. </p>
<p>Two pointers are equal if and only if they reference the same database object. </p>

</div>
</div>
<a class="anchor" id="a6cabfa29875c40ce04e57c71df406e9a"></a><!-- doxytag: member="Wt::Dbo::ptr::operator*" ref="a6cabfa29875c40ce04e57c71df406e9a" args="() const " -->
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;class C &gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">const C &amp; <a class="el" href="classWt_1_1Dbo_1_1ptr.html">Wt::Dbo::ptr</a>&lt; C &gt;::operator* </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Dereference operator. </p>
<p>Note that this operator returns a const copy of the referenced object. Use <a class="el" href="classWt_1_1Dbo_1_1ptr.html#ac14d20e52b5cd9eee356488c7416c044" title="Dereference operator, for writing.">modify()</a> to get a non-const reference.</p>
<p>Since this may lazy-load the underlying database object, you should have an active transaction. </p>

</div>
</div>
<a class="anchor" id="afe3605c8c5d46ddd078775275fb0cbc9"></a><!-- doxytag: member="Wt::Dbo::ptr::operator&#45;&gt;" ref="afe3605c8c5d46ddd078775275fb0cbc9" args="() const " -->
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;class C &gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">const C * <a class="el" href="classWt_1_1Dbo_1_1ptr.html">Wt::Dbo::ptr</a>&lt; C &gt;::operator-&gt; </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Dereference operator. </p>
<p>Note that this operator returns a const copy of the referenced object. Use <a class="el" href="classWt_1_1Dbo_1_1ptr.html#ac14d20e52b5cd9eee356488c7416c044" title="Dereference operator, for writing.">modify()</a> to get a non-const reference.</p>
<p>Since this may lazy-load the underlying database object, you should have an active transaction. </p>

</div>
</div>
<a class="anchor" id="a4c283ff5e8d099e92d1ed0fcdeaecf16"></a><!-- doxytag: member="Wt::Dbo::ptr::operator&lt;" ref="a4c283ff5e8d099e92d1ed0fcdeaecf16" args="(const ptr&lt; C &gt; &amp;other) const " -->
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;class C&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">bool <a class="el" href="classWt_1_1Dbo_1_1ptr.html">Wt::Dbo::ptr</a>&lt; C &gt;::operator&lt; </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="classWt_1_1Dbo_1_1ptr.html">ptr</a>&lt; C &gt; &amp;&#160;</td>
          <td class="paramname"><em>other</em></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Comparison operator. </p>
<p>This operator is implemented to be able to store pointers in std::set or std::map containers. </p>

</div>
</div>
<a class="anchor" id="a6992f0c852b65dfe6be35a88dc880e45"></a><!-- doxytag: member="Wt::Dbo::ptr::operator==" ref="a6992f0c852b65dfe6be35a88dc880e45" args="(const ptr&lt; C &gt; &amp;other) const " -->
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;class C&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">bool <a class="el" href="classWt_1_1Dbo_1_1ptr.html">Wt::Dbo::ptr</a>&lt; C &gt;::operator== </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="classWt_1_1Dbo_1_1ptr.html">ptr</a>&lt; C &gt; &amp;&#160;</td>
          <td class="paramname"><em>other</em></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Comparison operator. </p>
<p>Two pointers are equal if and only if they reference the same database object. </p>

</div>
</div>
<a class="anchor" id="a7330a5220e3e926b5c084444116499a4"></a><!-- doxytag: member="Wt::Dbo::ptr::purge" ref="a7330a5220e3e926b5c084444116499a4" args="()" -->
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;class C &gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="classWt_1_1Dbo_1_1ptr.html">Wt::Dbo::ptr</a>&lt; C &gt;::purge </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Purges an object from memory. </p>
<p>When the object is not dirty, the memory copy of the object is deleted, and the object will be reread from the database on the next access.</p>
<p>Purging an object can be useful to conserve memory, but you should never purge an object while the user is editing if you wish to rely on the optimistick locking for detecting concurrent modifications. </p>

</div>
</div>
<a class="anchor" id="af4b26afebd56abc42005ef9f954d8fee"></a><!-- doxytag: member="Wt::Dbo::ptr::remove" ref="af4b26afebd56abc42005ef9f954d8fee" args="()" -->
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;class C &gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="classWt_1_1Dbo_1_1ptr.html">Wt::Dbo::ptr</a>&lt; C &gt;::remove </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Removes an object from the database. </p>
<p>The object is removed from the database, and becomes transient again.</p>
<p>Note that the object is not deleted in memory: you can still continue to read and modify the object, but there will no longer be a database copy of the object, and the object will effectively be treated as a new object (which may be re-added to the database at a later point).</p>
<p>This is the opposite operation of <a class="el" href="classWt_1_1Dbo_1_1Session.html#abfbd5bea3a6b964e833c893434e38c8f" title="Persists a transient object.">Session::add()</a>. </p>

</div>
</div>
<a class="anchor" id="abb1db71ef910748437d69bf11a04eb6e"></a><!-- doxytag: member="Wt::Dbo::ptr::reread" ref="abb1db71ef910748437d69bf11a04eb6e" args="()" -->
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;class C &gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="classWt_1_1Dbo_1_1ptr.html">Wt::Dbo::ptr</a>&lt; C &gt;::reread </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Rereads the database version. </p>
<p>Rereads a persisted object from the database, discarding any possible changes and updating to the latest database version.</p>
<p>This does not actually load the database version, since loading is lazy. </p>

</div>
</div>
<a class="anchor" id="aa93933be1dde5b88f8220fd578e0714e"></a><!-- doxytag: member="Wt::Dbo::ptr::reset" ref="aa93933be1dde5b88f8220fd578e0714e" args="(C *obj=0)" -->
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;class C&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="classWt_1_1Dbo_1_1ptr.html">Wt::Dbo::ptr</a>&lt; C &gt;::reset </td>
          <td>(</td>
          <td class="paramtype">C *&#160;</td>
          <td class="paramname"><em>obj</em> = <code>0</code></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Resets the pointer. </p>
<p>This is equivalent to: </p>
<div class="fragment"><pre class="fragment"> p = ptr&lt;C&gt;(obj);
</pre></div> 
</div>
</div>
<a class="anchor" id="a1f82a97723f3cc914e44eb423286ba51"></a><!-- doxytag: member="Wt::Dbo::ptr::session" ref="a1f82a97723f3cc914e44eb423286ba51" args="() const " -->
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;class C &gt; </div>
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classWt_1_1Dbo_1_1Session.html">Session</a> * <a class="el" href="classWt_1_1Dbo_1_1ptr.html">Wt::Dbo::ptr</a>&lt; C &gt;::session </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Returns the session with which this pointer is associated. </p>
<p>This may return 0 if the pointer is null or not added to a session. </p>

</div>
</div>
<a class="anchor" id="a5c907971ba36fa3c5145b683abc76c76"></a><!-- doxytag: member="Wt::Dbo::ptr::version" ref="a5c907971ba36fa3c5145b683abc76c76" args="() const " -->
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;class C &gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">int <a class="el" href="classWt_1_1Dbo_1_1ptr.html">Wt::Dbo::ptr</a>&lt; C &gt;::version </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Returns the object version. </p>
<p>This returns -1 for a transient object or when versioning is not enabled. </p>

</div>
</div>
</div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Enumerator</a></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>

<hr size="1"><address style="text-align: right; margin: 3px"><small>
Generated on Thu Nov 1 2012 for <a href="http://www.webtoolkit.eu/wt">the
C++ Web Toolkit (Wt)</a> by&nbsp;<a
href="http://www.doxygen.org/index.html"><img src="doxygen.png"
alt="doxygen" border="0" style="vertical-align: middle; display:
inline-block; height: 2em"></a> 1.7.5.1</small></address>
</body>
</html>