📄 classpcontainer.html
字号:
<!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>PContainer class Reference</title><link href="doxygen.css" rel="stylesheet" type="text/css"></head><body><!-- Generated by Doxygen 1.2.18 --><center><a class="qindex" href="index.html">Main Page</a> <a class="qindex" href="namespaces.html">Namespace List</a> <a class="qindex" href="hierarchy.html">Class Hierarchy</a> <a class="qindex" href="annotated.html">Compound List</a> <a class="qindex" href="files.html">File List</a> <a class="qindex" href="functions.html">Compound Members</a> <a class="qindex" href="globals.html">File Members</a> </center><hr><h1>PContainer Class Reference</h1><code>#include <<a class="el" href="contain_8h-source.html">contain.h</a>></code><p><p>Inheritance diagram for PContainer:<p><center><img src="classPContainer.png" usemap="#PContainer_map" border="0" alt=""></center><map name="PContainer_map"><area href="classPObject.html" alt="PObject" shape="rect" coords="135,0,260,24"><area href="classPAbstractArray.html" alt="PAbstractArray" shape="rect" coords="0,112,125,136"><area href="classPCollection.html" alt="PCollection" shape="rect" coords="135,112,260,136"><area href="classPHTTPSpace.html" alt="PHTTPSpace" shape="rect" coords="270,112,395,136"><area href="classPAbstractList.html" alt="PAbstractList" shape="rect" coords="0,168,125,192"><area href="classPAbstractSortedList.html" alt="PAbstractSortedList" shape="rect" coords="135,168,260,192"><area href="classPHashTable.html" alt="PHashTable" shape="rect" coords="270,168,395,192"><area href="classPAbstractDictionary.html" alt="PAbstractDictionary" shape="rect" coords="202,224,327,248"><area href="classPAbstractSet.html" alt="PAbstractSet" shape="rect" coords="337,224,462,248"></map><a href="classPContainer-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 Methods</h2></td></tr><tr><td colspan="2"><div class="groupHeader">Construction</div></td></tr><tr><td nowrap align=right valign=top> </td><td valign=bottom><a class="el" href="classPContainer.html#z67_0">PContainer</a> (PINDEX initialSize=0)</td></tr><tr><td nowrap align=right valign=top> </td><td valign=bottom><a class="el" href="classPContainer.html#z67_1">PContainer</a> (const PContainer &cont)</td></tr><tr><td nowrap align=right valign=top>PContainer & </td><td valign=bottom><a class="el" href="classPContainer.html#z67_2">operator=</a> (const PContainer &cont)</td></tr><tr><td nowrap align=right valign=top>virtual </td><td valign=bottom><a class="el" href="classPContainer.html#z67_3">~PContainer</a> ()</td></tr><tr><td colspan="2"><div class="groupHeader">Common functions for containers</div></td></tr><tr><td nowrap align=right valign=top>virtual PINDEX </td><td valign=bottom><a class="el" href="classPContainer.html#z69_0">GetSize</a> () const</td></tr><tr><td nowrap align=right valign=top>virtual BOOL </td><td valign=bottom><a class="el" href="classPContainer.html#z69_1">SetSize</a> (PINDEX newSize)=0</td></tr><tr><td nowrap align=right valign=top>BOOL </td><td valign=bottom><a class="el" href="classPContainer.html#z69_2">SetMinSize</a> (PINDEX minSize)</td></tr><tr><td nowrap align=right valign=top>virtual BOOL </td><td valign=bottom><a class="el" href="classPContainer.html#z69_3">IsEmpty</a> () const</td></tr><tr><td nowrap align=right valign=top>BOOL </td><td valign=bottom><a class="el" href="classPContainer.html#z69_4">IsUnique</a> () const</td></tr><tr><td nowrap align=right valign=top>virtual BOOL </td><td valign=bottom><a class="el" href="classPContainer.html#z69_5">MakeUnique</a> ()</td></tr><tr><td colspan=2><br><h2>Protected Methods</h2></td></tr><tr><td nowrap align=right valign=top> </td><td valign=bottom><a class="el" href="classPContainer.html#b0">PContainer</a> (int dummy, const PContainer *cont)</td></tr><tr><td nowrap align=right valign=top>virtual void </td><td valign=bottom><a class="el" href="classPContainer.html#b1">DestroyContents</a> ()=0</td></tr><tr><td nowrap align=right valign=top>virtual void </td><td valign=bottom><a class="el" href="classPContainer.html#b2">AssignContents</a> (const PContainer &c)</td></tr><tr><td nowrap align=right valign=top>void </td><td valign=bottom><a class="el" href="classPContainer.html#b3">CopyContents</a> (const PContainer &c)</td></tr><tr><td nowrap align=right valign=top>void </td><td valign=bottom><a class="el" href="classPContainer.html#b4">CloneContents</a> (const PContainer *src)</td></tr><tr><td nowrap align=right valign=top>void </td><td valign=bottom><a class="el" href="classPContainer.html#b5">Destruct</a> ()</td></tr><tr><td colspan=2><br><h2>Protected Attributes</h2></td></tr><tr><td nowrap align=right valign=top><a class="el" href="classPContainer_1_1Reference.html">PContainer::Reference</a> * </td><td valign=bottom><a class="el" href="classPContainer.html#n0">reference</a></td></tr></table><hr><a name="_details"></a><h2>Detailed Description</h2>Abstract class to embody the base functionality of a {\it container}.<p>Fundamentally, a container is an object that contains other objects. There are two main areas of support for tha that are provided by this class. The first is simply to keep a count of the number of things that the container contains. The current size is stored and accessed by members of this class. The setting of size is determined by the semantics of the descendent class and so is a pure function.<p>The second area of support is for reference integrity. When an instance of a container is copied to another instance, the two instance contain the same thing. There can therefore be multiple references to the same things. When one reference is destroyed this must {\bf not} destroy the contained object as it may be referenced by another instance of a container class. To this end a reference count is provided by the PContainer class. This assures that the container only destroys the objects it contains when there are no more references to them.<p>In support of this, descendent classes must provide a <a class="el" href="classPContainer.html#b1">DestroyContents()</a># function. As the normal destructor cannot be used, this function will free the memory or unlock the resource the container is wrapping. <p><hr><h2>Constructor & Destructor Documentation</h2><a name="z67_0" doxytag="PContainer::PContainer"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> PContainer::PContainer </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">PINDEX </td> <td class="mdname1" valign="top" nowrap> <em>initialSize</em> = 0 </td> <td class="md" valign="top">) </td> <td class="md" nowrap></td> </tr> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p>Create a new unique container. <dl compact><dt><b>Parameters: </b></dt><dd><table border=0 cellspacing=2 cellpadding=0><tr><td valign=top><em>initialSize</em> </td><td>Initial number of things in the container. </td></tr></table></dl> </td> </tr></table><a name="z67_1" doxytag="PContainer::PContainer"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> PContainer::PContainer </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">const PContainer & </td> <td class="mdname1" valign="top" nowrap> <em>cont</em> </td> <td class="md" valign="top">) </td> <td class="md" nowrap></td> </tr> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p>Create a new refernce to container. Create a new container referencing the same contents as the container specified in the parameter. <dl compact><dt><b>Parameters: </b></dt><dd><table border=0 cellspacing=2 cellpadding=0><tr><td valign=top><em>cont</em> </td><td>Container to create a new reference from. </td></tr></table></dl> </td> </tr></table><a name="z67_3" doxytag="PContainer::~PContainer"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> virtual PContainer::~PContainer </td> <td class="md" valign="top">( </td> <td class="mdname1" valign="top" nowrap> </td> <td class="md" valign="top">) </td> <td class="md" nowrap><code> [inline, virtual]</code></td> </tr> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p>Destroy the container class. This will decrement the reference count on the contents and if unique, will destroy it using the <a class="el" href="classPContainer.html#b1">DestroyContents()</a># function. </td> </tr></table><a name="b0" doxytag="PContainer::PContainer"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> PContainer::PContainer </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">int </td> <td class="mdname" nowrap> <em>dummy</em>, </td> </tr> <tr> <td></td> <td></td> <td class="md" nowrap>const PContainer * </td> <td class="mdname" nowrap> <em>cont</em></td> </tr> <tr> <td></td> <td class="md">) </td> <td class="md" colspan="2"><code> [protected]</code></td> </tr> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p>Constructor used in support of the <a class="el" href="classPObject.html#z203_0">Clone()</a> function. This creates a new unique reference of a copy of the contents. It does {\bf not} create another reference.<p>The dummy parameter is there to prevent the contructor from being invoked automatically by the compiler when a pointer is used by accident when a normal instance or reference was expected. The container would be silently cloned and the copy used instead of the container expected leading to unpredictable results. <dl compact><dt><b>Parameters: </b></dt><dd><table border=0 cellspacing=2 cellpadding=0><tr><td valign=top><em>cont</em> </td><td>Dummy to prevent accidental use of the constructor. Container class to clone. </td></tr></table></dl> </td> </tr></table><hr><h2>Member Function Documentation</h2><a name="b2" doxytag="PContainer::AssignContents"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> virtual void PContainer::AssignContents </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">const PContainer & </td> <td class="mdname1" valign="top" nowrap> <em>c</em> </td> <td class="md" valign="top">) </td> <td class="md" nowrap><code> [protected, virtual]</code></td> </tr> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p>Copy the container contents. This copies the contents from one reference to another.<p>No duplication of contents occurs, for instance if the container is an array, the pointer to the array memory is copied, not the array memory block itself.<p>This function will get called by the base assignment operator. </td> </tr></table><a name="b4" doxytag="PContainer::CloneContents"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> PINLINE void PContainer::CloneContents </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">const PContainer * </td> <td class="mdname1" valign="top" nowrap> <em>src</em> </td> <td class="md" valign="top">) </td> <td class="md" nowrap><code> [protected]</code></td> </tr> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p>Create a duplicate of the container contents. This copies the contents from one container to another, unique container. It is automatically declared when the PDECLARE_CONTAINER()# macro is used.<p>This class will duplicate the contents completely, for instance if the container is an array, the actual array memory is copied, not just the pointer. If the container contains objects that descend from <a class="el" href="classPObject.html#b0">PObject</a>#, they too should also be cloned and not simply copied.<p>This function will get called once for every class in the heirarchy, so the ancestor function should {\bf not} be called.<p>{\it {\bf Note well}}, the logic of the function must be able to accept the passed in parameter to clone being the same instance as the destination object, ie during execution this == src#. </td> </tr></table><a name="b3" doxytag="PContainer::CopyContents"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> PINLINE void PContainer::CopyContents </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">const PContainer & </td> <td class="mdname1" valign="top" nowrap> <em>c</em> </td> <td class="md" valign="top">) </td> <td class="md" nowrap><code> [protected]</code></td> </tr> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p>Copy the container contents. This copies the contents from one reference to another. It is automatically declared when the PDECLARE_CONTAINER()# macro is used.<p>No duplication of contents occurs, for instance if the container is an array, the pointer to the array memory is copied, not the array memory block itself.<p>This function will get called once for every class in the heirarchy, so the ancestor function should {\bf not} be called. </td> </tr></table><a name="b1" doxytag="PContainer::DestroyContents"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> virtual void PContainer::DestroyContents </td> <td class="md" valign="top">( </td> <td class="mdname1" valign="top" nowrap> </td> <td class="md" valign="top">) </td> <td class="md" nowrap><code> [protected, pure virtual]</code></td> </tr>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -