1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464
|
<!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>MySQL++ Reference Manual</title>
<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.15"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>MySQL++: mysqlpp::RefCountedPointer< T, Destroyer > Class Template Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.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">MySQL++
 <span id="projectnumber">3.2.5</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.15 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<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&dn=gpl-2.0.txt GPL-v2 */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</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>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><b>mysqlpp</b></li><li class="navelem"><a class="el" href="classmysqlpp_1_1RefCountedPointer.html">RefCountedPointer</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#pub-types">Public Types</a> |
<a href="#pub-methods">Public Member Functions</a> |
<a href="classmysqlpp_1_1RefCountedPointer-members.html">List of all members</a> </div>
<div class="headertitle">
<div class="title">mysqlpp::RefCountedPointer< T, Destroyer > Class Template Reference</div> </div>
</div><!--header-->
<div class="contents">
<p>Creates an object that acts as a reference-counted pointer to another object.
<a href="classmysqlpp_1_1RefCountedPointer.html#details">More...</a></p>
<p><code>#include <<a class="el" href="refcounted_8h_source.html">refcounted.h</a>></code></p>
<div class="dynheader">
Inheritance diagram for mysqlpp::RefCountedPointer< T, Destroyer >:</div>
<div class="dyncontent">
<div class="center"><img src="classmysqlpp_1_1RefCountedPointer__inherit__graph.png" border="0" usemap="#mysqlpp_1_1RefCountedPointer_3_01T_00_01Destroyer_01_4_inherit__map" alt="Inheritance graph"/></div>
<map name="mysqlpp_1_1RefCountedPointer_3_01T_00_01Destroyer_01_4_inherit__map" id="mysqlpp_1_1RefCountedPointer_3_01T_00_01Destroyer_01_4_inherit__map">
<area shape="rect" title="Creates an object that acts as a reference-counted pointer to another object." alt="" coords="5,100,197,139"/>
<area shape="rect" href="classmysqlpp_1_1RefCountedPointer.html" title=" " alt="" coords="400,5,592,44"/>
<area shape="rect" href="classmysqlpp_1_1RefCountedPointer.html" title=" " alt="" coords="400,68,592,107"/>
<area shape="rect" href="classmysqlpp_1_1RefCountedPointer.html" title=" " alt="" coords="400,131,592,169"/>
<area shape="rect" href="classmysqlpp_1_1RefCountedPointer.html" title=" " alt="" coords="400,193,592,232"/>
</map>
<center><span class="legend">[<a href="graph_legend.html">legend</a>]</span></center></div>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-types"></a>
Public Types</h2></td></tr>
<tr class="memitem:a745d3cf3d478d70c09474eb8766bae3a"><td class="memItemLeft" align="right" valign="top"><a id="a745d3cf3d478d70c09474eb8766bae3a"></a>
typedef <a class="el" href="classmysqlpp_1_1RefCountedPointer.html">RefCountedPointer</a>< T > </td><td class="memItemRight" valign="bottom"><a class="el" href="classmysqlpp_1_1RefCountedPointer.html#a745d3cf3d478d70c09474eb8766bae3a">ThisType</a></td></tr>
<tr class="memdesc:a745d3cf3d478d70c09474eb8766bae3a"><td class="mdescLeft"> </td><td class="mdescRight">alias for this object's type <br /></td></tr>
<tr class="separator:a745d3cf3d478d70c09474eb8766bae3a"><td class="memSeparator" colspan="2"> </td></tr>
</table><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:a02aa2860b0644b6333cee8f321477fee"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classmysqlpp_1_1RefCountedPointer.html#a02aa2860b0644b6333cee8f321477fee">RefCountedPointer</a> ()</td></tr>
<tr class="memdesc:a02aa2860b0644b6333cee8f321477fee"><td class="mdescLeft"> </td><td class="mdescRight">Default constructor. <a href="#a02aa2860b0644b6333cee8f321477fee">More...</a><br /></td></tr>
<tr class="separator:a02aa2860b0644b6333cee8f321477fee"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a586313b144a88e487d77adf7d64bd3bb"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classmysqlpp_1_1RefCountedPointer.html#a586313b144a88e487d77adf7d64bd3bb">RefCountedPointer</a> (T *c)</td></tr>
<tr class="memdesc:a586313b144a88e487d77adf7d64bd3bb"><td class="mdescLeft"> </td><td class="mdescRight">Standard constructor. <a href="#a586313b144a88e487d77adf7d64bd3bb">More...</a><br /></td></tr>
<tr class="separator:a586313b144a88e487d77adf7d64bd3bb"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ae25ec10685c0c1ae2c7afa6bd72f483c"><td class="memItemLeft" align="right" valign="top"><a id="ae25ec10685c0c1ae2c7afa6bd72f483c"></a>
 </td><td class="memItemRight" valign="bottom"><a class="el" href="classmysqlpp_1_1RefCountedPointer.html#ae25ec10685c0c1ae2c7afa6bd72f483c">RefCountedPointer</a> (const <a class="el" href="classmysqlpp_1_1RefCountedPointer.html#a745d3cf3d478d70c09474eb8766bae3a">ThisType</a> &other)</td></tr>
<tr class="memdesc:ae25ec10685c0c1ae2c7afa6bd72f483c"><td class="mdescLeft"> </td><td class="mdescRight">Copy constructor. <br /></td></tr>
<tr class="separator:ae25ec10685c0c1ae2c7afa6bd72f483c"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a67b7d093310fa6112a45c361c37d5ed3"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classmysqlpp_1_1RefCountedPointer.html#a67b7d093310fa6112a45c361c37d5ed3">~RefCountedPointer</a> ()</td></tr>
<tr class="memdesc:a67b7d093310fa6112a45c361c37d5ed3"><td class="mdescLeft"> </td><td class="mdescRight">Destructor. <a href="#a67b7d093310fa6112a45c361c37d5ed3">More...</a><br /></td></tr>
<tr class="separator:a67b7d093310fa6112a45c361c37d5ed3"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ac6a54b0c4fdac3d05389639c5bc71168"><td class="memItemLeft" align="right" valign="top"><a class="el" href="classmysqlpp_1_1RefCountedPointer.html#a745d3cf3d478d70c09474eb8766bae3a">ThisType</a> & </td><td class="memItemRight" valign="bottom"><a class="el" href="classmysqlpp_1_1RefCountedPointer.html#ac6a54b0c4fdac3d05389639c5bc71168">assign</a> (T *c)</td></tr>
<tr class="memdesc:ac6a54b0c4fdac3d05389639c5bc71168"><td class="mdescLeft"> </td><td class="mdescRight">Sets (or resets) the pointer to the counted object. <a href="#ac6a54b0c4fdac3d05389639c5bc71168">More...</a><br /></td></tr>
<tr class="separator:ac6a54b0c4fdac3d05389639c5bc71168"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:aa806e37d44b4d0384dc0bcd1deefd1b9"><td class="memItemLeft" align="right" valign="top"><a class="el" href="classmysqlpp_1_1RefCountedPointer.html#a745d3cf3d478d70c09474eb8766bae3a">ThisType</a> & </td><td class="memItemRight" valign="bottom"><a class="el" href="classmysqlpp_1_1RefCountedPointer.html#aa806e37d44b4d0384dc0bcd1deefd1b9">assign</a> (const <a class="el" href="classmysqlpp_1_1RefCountedPointer.html#a745d3cf3d478d70c09474eb8766bae3a">ThisType</a> &other)</td></tr>
<tr class="memdesc:aa806e37d44b4d0384dc0bcd1deefd1b9"><td class="mdescLeft"> </td><td class="mdescRight">Copy an existing refcounted pointer. <a href="#aa806e37d44b4d0384dc0bcd1deefd1b9">More...</a><br /></td></tr>
<tr class="separator:aa806e37d44b4d0384dc0bcd1deefd1b9"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a33e254256ace5abc2b07d8a630e55188"><td class="memItemLeft" align="right" valign="top"><a class="el" href="classmysqlpp_1_1RefCountedPointer.html#a745d3cf3d478d70c09474eb8766bae3a">ThisType</a> & </td><td class="memItemRight" valign="bottom"><a class="el" href="classmysqlpp_1_1RefCountedPointer.html#a33e254256ace5abc2b07d8a630e55188">operator=</a> (T *c)</td></tr>
<tr class="memdesc:a33e254256ace5abc2b07d8a630e55188"><td class="mdescLeft"> </td><td class="mdescRight"><a class="el" href="classmysqlpp_1_1Set.html" title="A special std::set derivative for holding MySQL data sets.">Set</a> (or reset) the pointer to the counted object. <a href="#a33e254256ace5abc2b07d8a630e55188">More...</a><br /></td></tr>
<tr class="separator:a33e254256ace5abc2b07d8a630e55188"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a506a85c3e871b5436eb20d6436fb5d9d"><td class="memItemLeft" align="right" valign="top"><a class="el" href="classmysqlpp_1_1RefCountedPointer.html#a745d3cf3d478d70c09474eb8766bae3a">ThisType</a> & </td><td class="memItemRight" valign="bottom"><a class="el" href="classmysqlpp_1_1RefCountedPointer.html#a506a85c3e871b5436eb20d6436fb5d9d">operator=</a> (const <a class="el" href="classmysqlpp_1_1RefCountedPointer.html#a745d3cf3d478d70c09474eb8766bae3a">ThisType</a> &rhs)</td></tr>
<tr class="memdesc:a506a85c3e871b5436eb20d6436fb5d9d"><td class="mdescLeft"> </td><td class="mdescRight">Copy an existing refcounted pointer. <a href="#a506a85c3e871b5436eb20d6436fb5d9d">More...</a><br /></td></tr>
<tr class="separator:a506a85c3e871b5436eb20d6436fb5d9d"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a0da9202a1a89d96bbc5654b9c974b6fd"><td class="memItemLeft" align="right" valign="top"><a id="a0da9202a1a89d96bbc5654b9c974b6fd"></a>
T * </td><td class="memItemRight" valign="bottom"><a class="el" href="classmysqlpp_1_1RefCountedPointer.html#a0da9202a1a89d96bbc5654b9c974b6fd">operator -></a> () const</td></tr>
<tr class="memdesc:a0da9202a1a89d96bbc5654b9c974b6fd"><td class="mdescLeft"> </td><td class="mdescRight">Access the object through the smart pointer. <br /></td></tr>
<tr class="separator:a0da9202a1a89d96bbc5654b9c974b6fd"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ac5ac8567c830e0f3985af0125ff676e4"><td class="memItemLeft" align="right" valign="top"><a id="ac5ac8567c830e0f3985af0125ff676e4"></a>
T & </td><td class="memItemRight" valign="bottom"><a class="el" href="classmysqlpp_1_1RefCountedPointer.html#ac5ac8567c830e0f3985af0125ff676e4">operator *</a> () const</td></tr>
<tr class="memdesc:ac5ac8567c830e0f3985af0125ff676e4"><td class="mdescLeft"> </td><td class="mdescRight">Dereference the smart pointer. <br /></td></tr>
<tr class="separator:ac5ac8567c830e0f3985af0125ff676e4"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a48f681f74dbe025e8c639f65850e2302"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classmysqlpp_1_1RefCountedPointer.html#a48f681f74dbe025e8c639f65850e2302">operator void *</a> ()</td></tr>
<tr class="memdesc:a48f681f74dbe025e8c639f65850e2302"><td class="mdescLeft"> </td><td class="mdescRight">Returns the internal raw pointer converted to void*. <a href="#a48f681f74dbe025e8c639f65850e2302">More...</a><br /></td></tr>
<tr class="separator:a48f681f74dbe025e8c639f65850e2302"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a70e3f29073ff9707cec12ba841910ca8"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classmysqlpp_1_1RefCountedPointer.html#a70e3f29073ff9707cec12ba841910ca8">operator const void *</a> () const</td></tr>
<tr class="memdesc:a70e3f29073ff9707cec12ba841910ca8"><td class="mdescLeft"> </td><td class="mdescRight">Returns the internal raw pointer converted to const void*. <a href="#a70e3f29073ff9707cec12ba841910ca8">More...</a><br /></td></tr>
<tr class="separator:a70e3f29073ff9707cec12ba841910ca8"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a26757f1138dded33faeb1978004d0639"><td class="memItemLeft" align="right" valign="top"><a id="a26757f1138dded33faeb1978004d0639"></a>
T * </td><td class="memItemRight" valign="bottom"><a class="el" href="classmysqlpp_1_1RefCountedPointer.html#a26757f1138dded33faeb1978004d0639">raw</a> ()</td></tr>
<tr class="memdesc:a26757f1138dded33faeb1978004d0639"><td class="mdescLeft"> </td><td class="mdescRight">Return the raw pointer in T* context. <br /></td></tr>
<tr class="separator:a26757f1138dded33faeb1978004d0639"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:aca68d9c999240bd05e992b15fa38fef9"><td class="memItemLeft" align="right" valign="top"><a id="aca68d9c999240bd05e992b15fa38fef9"></a>
const T * </td><td class="memItemRight" valign="bottom"><a class="el" href="classmysqlpp_1_1RefCountedPointer.html#aca68d9c999240bd05e992b15fa38fef9">raw</a> () const</td></tr>
<tr class="memdesc:aca68d9c999240bd05e992b15fa38fef9"><td class="mdescLeft"> </td><td class="mdescRight">Return the raw pointer when used in const T* context. <br /></td></tr>
<tr class="separator:aca68d9c999240bd05e992b15fa38fef9"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ac6de38aa306bfe6166384e70bc9dbaef"><td class="memItemLeft" align="right" valign="top"><a id="ac6de38aa306bfe6166384e70bc9dbaef"></a>
void </td><td class="memItemRight" valign="bottom"><a class="el" href="classmysqlpp_1_1RefCountedPointer.html#ac6de38aa306bfe6166384e70bc9dbaef">swap</a> (<a class="el" href="classmysqlpp_1_1RefCountedPointer.html#a745d3cf3d478d70c09474eb8766bae3a">ThisType</a> &other)</td></tr>
<tr class="memdesc:ac6de38aa306bfe6166384e70bc9dbaef"><td class="mdescLeft"> </td><td class="mdescRight">Exchange our managed memory with another pointer. <br /></td></tr>
<tr class="separator:ac6de38aa306bfe6166384e70bc9dbaef"><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<class T, class Destroyer = RefCountedPointerDestroyer<T>><br />
class mysqlpp::RefCountedPointer< T, Destroyer ></h3>
<p>Creates an object that acts as a reference-counted pointer to another object. </p>
<p>Resulting type acts like a pointer in all respects, except that it manages the memory it points to by observing how many users there are for the object.</p>
<p>This attempts to be as automatic as reference counting in a programming language with memory management. Like all automatic memory management schemes, it has penalties: it turns the single indirection of an unmanaged pointer into a double indirection, and has additional management overhead in the assignment operators due to the reference counter. This is an acceptable tradeoff when wrapping objects that are expensive to copy, and which need to be "owned" by disparate parties: you can allocate the object just once, then pass around the reference counted pointer, knowing that the last user will "turn out the lights".</p>
<p><b>Implementation</b> <b>detail:</b> You may notice that this class manages two pointers, one to the data we're managing, and one to the reference count. You might wonder why we don't wrap these up into a structure and keep just a pointer to an instance of it to simplify the memory management. It would indeed do that, but then every access to the data we manage would be a triple indirection instead of just double. It's a tradeoff, and we've chosen to take a minor complexity hit to avoid the performance hit. </p>
</div><h2 class="groupheader">Constructor & Destructor Documentation</h2>
<a id="a02aa2860b0644b6333cee8f321477fee"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a02aa2860b0644b6333cee8f321477fee">◆ </a></span>RefCountedPointer() <span class="overload">[1/2]</span></h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template<class T, class Destroyer = RefCountedPointerDestroyer<T>> </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classmysqlpp_1_1RefCountedPointer.html">mysqlpp::RefCountedPointer</a>< T, Destroyer >::<a class="el" href="classmysqlpp_1_1RefCountedPointer.html">RefCountedPointer</a> </td>
<td>(</td>
<td class="paramname"></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">
<p>Default constructor. </p>
<p>An object constructed this way is useless until you vivify it with <a class="el" href="classmysqlpp_1_1RefCountedPointer.html#a33e254256ace5abc2b07d8a630e55188" title="Set (or reset) the pointer to the counted object.">operator =()</a> or <a class="el" href="classmysqlpp_1_1RefCountedPointer.html#ac6a54b0c4fdac3d05389639c5bc71168" title="Sets (or resets) the pointer to the counted object.">assign()</a>. </p>
</div>
</div>
<a id="a586313b144a88e487d77adf7d64bd3bb"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a586313b144a88e487d77adf7d64bd3bb">◆ </a></span>RefCountedPointer() <span class="overload">[2/2]</span></h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template<class T, class Destroyer = RefCountedPointerDestroyer<T>> </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classmysqlpp_1_1RefCountedPointer.html">mysqlpp::RefCountedPointer</a>< T, Destroyer >::<a class="el" href="classmysqlpp_1_1RefCountedPointer.html">RefCountedPointer</a> </td>
<td>(</td>
<td class="paramtype">T * </td>
<td class="paramname"><em>c</em></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">explicit</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Standard constructor. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">c</td><td>A pointer to the object to be managed. If you pass 0, it's like calling the default ctor instead, only more work: the object's useless until you vivify it with <a class="el" href="classmysqlpp_1_1RefCountedPointer.html#a33e254256ace5abc2b07d8a630e55188" title="Set (or reset) the pointer to the counted object.">operator =()</a> or <a class="el" href="classmysqlpp_1_1RefCountedPointer.html#ac6a54b0c4fdac3d05389639c5bc71168" title="Sets (or resets) the pointer to the counted object.">assign()</a>. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a id="a67b7d093310fa6112a45c361c37d5ed3"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a67b7d093310fa6112a45c361c37d5ed3">◆ </a></span>~RefCountedPointer()</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template<class T, class Destroyer = RefCountedPointerDestroyer<T>> </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classmysqlpp_1_1RefCountedPointer.html">mysqlpp::RefCountedPointer</a>< T, Destroyer >::~<a class="el" href="classmysqlpp_1_1RefCountedPointer.html">RefCountedPointer</a> </td>
<td>(</td>
<td class="paramname"></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">
<p>Destructor. </p>
<p>This only destroys the managed memory if the reference count drops to 0. </p>
</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a id="ac6a54b0c4fdac3d05389639c5bc71168"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ac6a54b0c4fdac3d05389639c5bc71168">◆ </a></span>assign() <span class="overload">[1/2]</span></h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template<class T, class Destroyer = RefCountedPointerDestroyer<T>> </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classmysqlpp_1_1RefCountedPointer.html#a745d3cf3d478d70c09474eb8766bae3a">ThisType</a>& <a class="el" href="classmysqlpp_1_1RefCountedPointer.html">mysqlpp::RefCountedPointer</a>< T, Destroyer >::assign </td>
<td>(</td>
<td class="paramtype">T * </td>
<td class="paramname"><em>c</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">
<p>Sets (or resets) the pointer to the counted object. </p>
<p>If we are managing a pointer, this decrements the refcount for it and destroys the managed object if the refcount falls to 0.</p>
<p>This is a no-op if you pass the same pointer we're already managing. </p>
<p class="reference">Referenced by <a class="el" href="classmysqlpp_1_1RefCountedPointer.html#a33e254256ace5abc2b07d8a630e55188">mysqlpp::RefCountedPointer< SQLBuffer >::operator=()</a>.</p>
</div>
</div>
<a id="aa806e37d44b4d0384dc0bcd1deefd1b9"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aa806e37d44b4d0384dc0bcd1deefd1b9">◆ </a></span>assign() <span class="overload">[2/2]</span></h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template<class T, class Destroyer = RefCountedPointerDestroyer<T>> </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classmysqlpp_1_1RefCountedPointer.html#a745d3cf3d478d70c09474eb8766bae3a">ThisType</a>& <a class="el" href="classmysqlpp_1_1RefCountedPointer.html">mysqlpp::RefCountedPointer</a>< T, Destroyer >::assign </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="classmysqlpp_1_1RefCountedPointer.html#a745d3cf3d478d70c09474eb8766bae3a">ThisType</a> & </td>
<td class="paramname"><em>other</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">
<p>Copy an existing refcounted pointer. </p>
<p>If we are managing a pointer, this decrements the refcount for it and destroys the managed object if the refcount falls to 0. Then we increment the other object's reference count and copy that refcount and the managed pointer into this object.</p>
<p>This is a no-op if you pass a reference to this same object. </p>
</div>
</div>
<a id="a70e3f29073ff9707cec12ba841910ca8"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a70e3f29073ff9707cec12ba841910ca8">◆ </a></span>operator const void *()</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template<class T, class Destroyer = RefCountedPointerDestroyer<T>> </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classmysqlpp_1_1RefCountedPointer.html">mysqlpp::RefCountedPointer</a>< T, Destroyer >::operator const void * </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td> const</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Returns the internal raw pointer converted to const void*. </p>
<dl class="section see"><dt>See also</dt><dd>comments for operator void*() </dd></dl>
</div>
</div>
<a id="a48f681f74dbe025e8c639f65850e2302"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a48f681f74dbe025e8c639f65850e2302">◆ </a></span>operator void *()</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template<class T, class Destroyer = RefCountedPointerDestroyer<T>> </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classmysqlpp_1_1RefCountedPointer.html">mysqlpp::RefCountedPointer</a>< T, Destroyer >::operator void * </td>
<td>(</td>
<td class="paramname"></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">
<p>Returns the internal raw pointer converted to void*. </p>
<p>This isn't intended to be used directly; if you need the pointer, call <a class="el" href="classmysqlpp_1_1RefCountedPointer.html#a26757f1138dded33faeb1978004d0639" title="Return the raw pointer in T* context.">raw()</a> instead. It's used internally by the compiler to implement operators bool, ==, and !=</p>
<p><b>WARNING:</b> This makes it possible to say </p><div class="fragment"><div class="line">RefCountedPointer<Foo> bar(<span class="keyword">new</span> Foo);</div><div class="line"><span class="keyword">delete</span> bar;</div></div><!-- fragment --><p>This will almost kinda sorta do the right thing: the Foo object held by the refcounted pointer will be destroyed as you wanted, but then when the refcounted pointer goes out of scope, the memory is deleted a second time, which will probably crash your program. This is easy to accidentally do when converting a good ol' unmanaged pointer to a refcounted pointer and forgetting to remove the delete calls needed previously. </p>
</div>
</div>
<a id="a33e254256ace5abc2b07d8a630e55188"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a33e254256ace5abc2b07d8a630e55188">◆ </a></span>operator=() <span class="overload">[1/2]</span></h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template<class T, class Destroyer = RefCountedPointerDestroyer<T>> </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classmysqlpp_1_1RefCountedPointer.html#a745d3cf3d478d70c09474eb8766bae3a">ThisType</a>& <a class="el" href="classmysqlpp_1_1RefCountedPointer.html">mysqlpp::RefCountedPointer</a>< T, Destroyer >::operator= </td>
<td>(</td>
<td class="paramtype">T * </td>
<td class="paramname"><em>c</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">
<p><a class="el" href="classmysqlpp_1_1Set.html" title="A special std::set derivative for holding MySQL data sets.">Set</a> (or reset) the pointer to the counted object. </p>
<p>This is essentially the same thing as <a class="el" href="classmysqlpp_1_1RefCountedPointer.html#ac6a54b0c4fdac3d05389639c5bc71168" title="Sets (or resets) the pointer to the counted object.">assign(T*)</a>. The choice between the two is just a matter of syntactic preference. </p>
</div>
</div>
<a id="a506a85c3e871b5436eb20d6436fb5d9d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a506a85c3e871b5436eb20d6436fb5d9d">◆ </a></span>operator=() <span class="overload">[2/2]</span></h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template<class T, class Destroyer = RefCountedPointerDestroyer<T>> </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classmysqlpp_1_1RefCountedPointer.html#a745d3cf3d478d70c09474eb8766bae3a">ThisType</a>& <a class="el" href="classmysqlpp_1_1RefCountedPointer.html">mysqlpp::RefCountedPointer</a>< T, Destroyer >::operator= </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="classmysqlpp_1_1RefCountedPointer.html#a745d3cf3d478d70c09474eb8766bae3a">ThisType</a> & </td>
<td class="paramname"><em>rhs</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">
<p>Copy an existing refcounted pointer. </p>
<p>This is essentially the same thing as <a class="el" href="classmysqlpp_1_1RefCountedPointer.html#aa806e37d44b4d0384dc0bcd1deefd1b9" title="Copy an existing refcounted pointer.">assign(const ThisType&)</a>. The choice between the two is just a matter of syntactic preference. </p>
</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="refcounted_8h_source.html">refcounted.h</a></li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Sun Jul 21 2019 05:32:21 for MySQL++ by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.15
</small></address>
</body>
</html>
|