<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> <title>Crystal Space 1.2.1: CS::CowWrapper< T, MemoryAllocator > Class Template Reference (Crystal Space 1.2.1 Public API Reference)</title> <link href="tabs.css" rel="stylesheet" type="text/css"> <link href="doxygen.css" rel="stylesheet" type="text/css"> </head><body> <table border="0" cellpadding="0" cellspacing="0" width="100%" class="head"> <tr height="59"> <td class="head" width="202" valign="bottom" style="padding-left:0;"><a href="http://www.crystalspace3d.org/"><img src="csblur.png" width="236" height="59" alt="CrystalSpace" border="0"></a></td> <td class="head"><h2>Public API Reference</h2></td> </tr> <tr height="11"> <td colspan="2" class="headshadow" valign="top" style="padding-left:0;"><img src="csblurb.png" width="236" height="11" alt="" border="0"></td> </tr> </table> <div class="content"> <!-- Generated by Doxygen 1.5.3 --> <div class="tabs"> <ul> <li><a href="index.html"><span>Main Page</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="classes.html"><span>Classes</span></a></li> <li><a href="files.html"><span>Files</span></a></li> <li><a href="pages.html"><span>Related Pages</span></a></li> </ul> </div> <div class="tabs"> <ul> <li><a href="classes.html"><span>Alphabetical List</span></a></li> <li><a href="annotated.html"><span>Class List</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 class="nav"> <a class="el" href="namespaceCS.html">CS</a>::<a class="el" href="classCS_1_1CowWrapper.html">CowWrapper</a></div> <h1>CS::CowWrapper< T, MemoryAllocator > Class Template Reference</h1><!-- doxytag: class="CS::CowWrapper" -->Copy-on-write wrapper for arbitrary types. <a href="#_details">More...</a> <p> <code>#include <<a class="el" href="cowwrapper_8h-source.html">csutil/cowwrapper.h</a>></code> <p> <p> <a href="classCS_1_1CowWrapper-members.html">List of all members.</a><table border="0" cellpadding="0" cellspacing="0"> <tr><td></td></tr> <tr><td colspan="2"><br><h2>Public Member Functions</h2></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classCS_1_1CowWrapper.html#041c1152ca5b28f7808b5041f319ec9c">CowWrapper</a> (const T &other)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Create a new wrapper and initialize with <code>other</code>. <a href="#041c1152ca5b28f7808b5041f319ec9c"></a><br></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classCS_1_1CowWrapper.html#9bed6919141dbe1aac3708367e8641d9">CowWrapper</a> (const <a class="el" href="classCS_1_1CowWrapper.html">CowWrapper</a> &other)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Copy reference to data from <code>other</code>. <a href="#9bed6919141dbe1aac3708367e8641d9"></a><br></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">T & </td><td class="memItemRight" valign="bottom"><a class="el" href="classCS_1_1CowWrapper.html#649b992bc45e17dbe3a76223c061d9bc">operator *</a> ()</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Return a non-const reference to the contained data. <a href="#649b992bc45e17dbe3a76223c061d9bc"></a><br></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">const T & </td><td class="memItemRight" valign="bottom"><a class="el" href="classCS_1_1CowWrapper.html#803d8ead4e91477282bcc9e6ec4c794d">operator *</a> () const </td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Return a const reference to the contained data. <a href="#803d8ead4e91477282bcc9e6ec4c794d"></a><br></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">T * </td><td class="memItemRight" valign="bottom"><a class="el" href="classCS_1_1CowWrapper.html#071b643a9ec30d989db6fcb68e3a4acf">operator-></a> ()</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Return a non-const pointer to the contained data. <a href="#071b643a9ec30d989db6fcb68e3a4acf"></a><br></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">const T * </td><td class="memItemRight" valign="bottom"><a class="el" href="classCS_1_1CowWrapper.html#5a11d334c8fc1946bc530e8ad8ff3959">operator-></a> () const </td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Return a const pointer to the contained data. <a href="#5a11d334c8fc1946bc530e8ad8ff3959"></a><br></td></tr> <tr><td colspan="2"><br><h2>Static Public Attributes</h2></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="d67ec763181398cbbba500f71b04fbe0"></a><!-- doxytag: member="CS::CowWrapper::allocSize" ref="d67ec763181398cbbba500f71b04fbe0" args="" --> static const size_t </td><td class="memItemRight" valign="bottom"><a class="el" href="classCS_1_1CowWrapper.html#d67ec763181398cbbba500f71b04fbe0">allocSize</a> = sizeof (WrappedData)</td></tr> </table> <hr><a name="_details"></a><h2>Detailed Description</h2> <h3>template<typename T, class MemoryAllocator = Memory::AllocatorMalloc><br> class CS::CowWrapper< T, MemoryAllocator ></h3> Copy-on-write wrapper for arbitrary types. <p> <pre> _________________________________________ / Instances transparently maintain a \ | reference-counted pointer to the actual | | data; if an instance is copied, merely | | this pointer is copied. | | | | As long as all access to the data is | | constant, the data is shared between | | instances. Only if non-const access is | | requested the data is duplicated. | | | \ The wrapper itself acts like a pointer. / ----------------------------------------- \ ^__^ \ (oo)\_______ (__)\ )\/\ ||----w | || || </pre><p> <dl class="remark" compact><dt><b>Remarks:</b></dt><dd>Contained types must have a proper copy constructor. <p> Care should be taken that the data is accessed with proper const-ness, since only the then data can be shared. Otherwise, data may be duplicated needlessly. </dd></dl> <p>Definition at line <a class="el" href="cowwrapper_8h-source.html#l00062">62</a> of file <a class="el" href="cowwrapper_8h-source.html">cowwrapper.h</a>.</p> <hr><h2>Constructor & Destructor Documentation</h2> <a class="anchor" name="9bed6919141dbe1aac3708367e8641d9"></a><!-- doxytag: member="CS::CowWrapper::CowWrapper" ref="9bed6919141dbe1aac3708367e8641d9" args="(const CowWrapper &other)" --> <div class="memitem"> <div class="memproto"> <div class="memtemplate"> template<typename T, class MemoryAllocator = Memory::AllocatorMalloc> </div> <table class="memname"> <tr> <td class="memname"><a class="el" href="classCS_1_1CowWrapper.html">CS::CowWrapper</a>< T, MemoryAllocator >::<a class="el" href="classCS_1_1CowWrapper.html">CowWrapper</a> </td> <td>(</td> <td class="paramtype">const <a class="el" href="classCS_1_1CowWrapper.html">CowWrapper</a>< T, MemoryAllocator > & </td> <td class="paramname"> <em>other</em> </td> <td> ) </td> <td width="100%"><code> [inline]</code></td> </tr> </table> </div> <div class="memdoc"> <p> Copy reference to data from <code>other</code>. <p> <p>Definition at line <a class="el" href="cowwrapper_8h-source.html#l00098">98</a> of file <a class="el" href="cowwrapper_8h-source.html">cowwrapper.h</a>.</p> </div> </div><p> <a class="anchor" name="041c1152ca5b28f7808b5041f319ec9c"></a><!-- doxytag: member="CS::CowWrapper::CowWrapper" ref="041c1152ca5b28f7808b5041f319ec9c" args="(const T &other)" --> <div class="memitem"> <div class="memproto"> <div class="memtemplate"> template<typename T, class MemoryAllocator = Memory::AllocatorMalloc> </div> <table class="memname"> <tr> <td class="memname"><a class="el" href="classCS_1_1CowWrapper.html">CS::CowWrapper</a>< T, MemoryAllocator >::<a class="el" href="classCS_1_1CowWrapper.html">CowWrapper</a> </td> <td>(</td> <td class="paramtype">const T & </td> <td class="paramname"> <em>other</em> </td> <td> ) </td> <td width="100%"><code> [inline]</code></td> </tr> </table> </div> <div class="memdoc"> <p> Create a new wrapper and initialize with <code>other</code>. <p> <p>Definition at line <a class="el" href="cowwrapper_8h-source.html#l00100">100</a> of file <a class="el" href="cowwrapper_8h-source.html">cowwrapper.h</a>.</p> </div> </div><p> <hr><h2>Member Function Documentation</h2> <a class="anchor" name="649b992bc45e17dbe3a76223c061d9bc"></a><!-- doxytag: member="CS::CowWrapper::operator *" ref="649b992bc45e17dbe3a76223c061d9bc" args="()" --> <div class="memitem"> <div class="memproto"> <div class="memtemplate"> template<typename T, class MemoryAllocator = Memory::AllocatorMalloc> </div> <table class="memname"> <tr> <td class="memname">T& <a class="el" href="classCS_1_1CowWrapper.html">CS::CowWrapper</a>< T, MemoryAllocator >::operator * </td> <td>(</td> <td class="paramname"> </td> <td> ) </td> <td width="100%"><code> [inline]</code></td> </tr> </table> </div> <div class="memdoc"> <p> Return a non-const reference to the contained data. <p> <dl class="remark" compact><dt><b>Remarks:</b></dt><dd>This will copy the contained data, so only use when really necessary. </dd></dl> <p>Definition at line <a class="el" href="cowwrapper_8h-source.html#l00115">115</a> of file <a class="el" href="cowwrapper_8h-source.html">cowwrapper.h</a>.</p> </div> </div><p> <a class="anchor" name="803d8ead4e91477282bcc9e6ec4c794d"></a><!-- doxytag: member="CS::CowWrapper::operator *" ref="803d8ead4e91477282bcc9e6ec4c794d" args="() const " --> <div class="memitem"> <div class="memproto"> <div class="memtemplate"> template<typename T, class MemoryAllocator = Memory::AllocatorMalloc> </div> <table class="memname"> <tr> <td class="memname">const T& <a class="el" href="classCS_1_1CowWrapper.html">CS::CowWrapper</a>< T, MemoryAllocator >::operator * </td> <td>(</td> <td class="paramname"> </td> <td> ) </td> <td width="100%"> const<code> [inline]</code></td> </tr> </table> </div> <div class="memdoc"> <p> Return a const reference to the contained data. <p> <p>Definition at line <a class="el" href="cowwrapper_8h-source.html#l00106">106</a> of file <a class="el" href="cowwrapper_8h-source.html">cowwrapper.h</a>.</p> <p>Referenced by <a class="el" href="cowwrapper_8h-source.html#l00125">CS::CowWrapper< T, MemoryAllocator >::operator->()</a>.</p> </div> </div><p> <a class="anchor" name="071b643a9ec30d989db6fcb68e3a4acf"></a><!-- doxytag: member="CS::CowWrapper::operator->" ref="071b643a9ec30d989db6fcb68e3a4acf" args="()" --> <div class="memitem"> <div class="memproto"> <div class="memtemplate"> template<typename T, class MemoryAllocator = Memory::AllocatorMalloc> </div> <table class="memname"> <tr> <td class="memname">T* <a class="el" href="classCS_1_1CowWrapper.html">CS::CowWrapper</a>< T, MemoryAllocator >::operator-> </td> <td>(</td> <td class="paramname"> </td> <td> ) </td> <td width="100%"><code> [inline]</code></td> </tr> </table> </div> <div class="memdoc"> <p> Return a non-const pointer to the contained data. <p> <dl class="remark" compact><dt><b>Remarks:</b></dt><dd>This will copy the contained data, so only use when really necessary. </dd></dl> <p>Definition at line <a class="el" href="cowwrapper_8h-source.html#l00132">132</a> of file <a class="el" href="cowwrapper_8h-source.html">cowwrapper.h</a>.</p> <p>References <a class="el" href="cowwrapper_8h-source.html#l00106">CS::CowWrapper< T, MemoryAllocator >::operator *()</a>.</p> </div> </div><p> <a class="anchor" name="5a11d334c8fc1946bc530e8ad8ff3959"></a><!-- doxytag: member="CS::CowWrapper::operator->" ref="5a11d334c8fc1946bc530e8ad8ff3959" args="() const " --> <div class="memitem"> <div class="memproto"> <div class="memtemplate"> template<typename T, class MemoryAllocator = Memory::AllocatorMalloc> </div> <table class="memname"> <tr> <td class="memname">const T* <a class="el" href="classCS_1_1CowWrapper.html">CS::CowWrapper</a>< T, MemoryAllocator >::operator-> </td> <td>(</td> <td class="paramname"> </td> <td> ) </td> <td width="100%"> const<code> [inline]</code></td> </tr> </table> </div> <div class="memdoc"> <p> Return a const pointer to the contained data. <p> <p>Definition at line <a class="el" href="cowwrapper_8h-source.html#l00125">125</a> of file <a class="el" href="cowwrapper_8h-source.html">cowwrapper.h</a>.</p> <p>References <a class="el" href="cowwrapper_8h-source.html#l00106">CS::CowWrapper< T, MemoryAllocator >::operator *()</a>.</p> </div> </div><p> <hr>The documentation for this class was generated from the following file:<ul> <li>csutil/<a class="el" href="cowwrapper_8h-source.html">cowwrapper.h</a></ul> <hr size="1"><address><small>Generated for Crystal Space 1.2.1 by <a href="http://www.doxygen.org/index.html">doxygen</a> 1.5.3 </small></address> </div></body> </html>