📄 classpabstractlist.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>PAbstractList 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>PAbstractList Class Reference</h1><code>#include <<a class="el" href="lists_8h-source.html">lists.h</a>></code><p><p>Inheritance diagram for PAbstractList:<p><center><img src="classPAbstractList.png" usemap="#PAbstractList_map" border="0" alt=""></center><map name="PAbstractList_map"><area href="classPCollection.html" alt="PCollection" shape="rect" coords="0,112,86,136"><area href="classPContainer.html" alt="PContainer" shape="rect" coords="0,56,86,80"><area href="classPObject.html" alt="PObject" shape="rect" coords="0,0,86,24"></map><a href="classPAbstractList-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 nowrap align=right valign=top>virtual <a class="el" href="classPObject.html#z199_0">Comparison</a> </td><td valign=bottom><a class="el" href="classPAbstractList.html#a0">Compare</a> (const <a class="el" href="classPObject.html">PObject</a> &obj) const</td></tr><tr><td colspan="2"><div class="groupHeader">Construction</div></td></tr><tr><td nowrap align=right valign=top>PINLINE </td><td valign=bottom><a class="el" href="classPAbstractList.html#z171_0">PAbstractList</a> ()</td></tr><tr><td colspan="2"><div class="groupHeader">Overrides from class PContainer</div></td></tr><tr><td nowrap align=right valign=top>virtual BOOL </td><td valign=bottom><a class="el" href="classPAbstractList.html#z173_0">SetSize</a> (PINDEX newSize)</td></tr><tr><td colspan="2"><div class="groupHeader">Overrides from class PCollection</div></td></tr><tr><td nowrap align=right valign=top>virtual PINDEX </td><td valign=bottom><a class="el" href="classPAbstractList.html#z175_0">Append</a> (<a class="el" href="classPObject.html">PObject</a> *obj)</td></tr><tr><td nowrap align=right valign=top>virtual PINDEX </td><td valign=bottom><a class="el" href="classPAbstractList.html#z175_1">Insert</a> (const <a class="el" href="classPObject.html">PObject</a> &before, <a class="el" href="classPObject.html">PObject</a> *obj)</td></tr><tr><td nowrap align=right valign=top>virtual PINDEX </td><td valign=bottom><a class="el" href="classPAbstractList.html#z175_2">InsertAt</a> (PINDEX index, <a class="el" href="classPObject.html">PObject</a> *obj)</td></tr><tr><td nowrap align=right valign=top>virtual BOOL </td><td valign=bottom><a class="el" href="classPAbstractList.html#z175_3">Remove</a> (const <a class="el" href="classPObject.html">PObject</a> *obj)</td></tr><tr><td nowrap align=right valign=top>virtual <a class="el" href="classPObject.html">PObject</a> * </td><td valign=bottom><a class="el" href="classPAbstractList.html#z175_4">RemoveAt</a> (PINDEX index)</td></tr><tr><td nowrap align=right valign=top>virtual BOOL </td><td valign=bottom><a class="el" href="classPAbstractList.html#z175_5">SetAt</a> (PINDEX index, <a class="el" href="classPObject.html">PObject</a> *val)</td></tr><tr><td nowrap align=right valign=top>virtual BOOL </td><td valign=bottom><a class="el" href="classPAbstractList.html#z175_6">ReplaceAt</a> (PINDEX index, <a class="el" href="classPObject.html">PObject</a> *val)</td></tr><tr><td nowrap align=right valign=top>virtual <a class="el" href="classPObject.html">PObject</a> * </td><td valign=bottom><a class="el" href="classPAbstractList.html#z175_7">GetAt</a> (PINDEX index) const</td></tr><tr><td nowrap align=right valign=top>virtual PINDEX </td><td valign=bottom><a class="el" href="classPAbstractList.html#z175_8">GetObjectsIndex</a> (const <a class="el" href="classPObject.html">PObject</a> *obj) const</td></tr><tr><td nowrap align=right valign=top>virtual PINDEX </td><td valign=bottom><a class="el" href="classPAbstractList.html#z175_9">GetValuesIndex</a> (const <a class="el" href="classPObject.html">PObject</a> &obj) const</td></tr><tr><td colspan=2><br><h2>Protected Methods</h2></td></tr><tr><td nowrap align=right valign=top>PINLINE <a class="el" href="classPObject.html">PObject</a> & </td><td valign=bottom><a class="el" href="classPAbstractList.html#b0">GetReferenceAt</a> (PINDEX index) const</td></tr><tr><td nowrap align=right valign=top>BOOL </td><td valign=bottom><a class="el" href="classPAbstractList.html#b1">SetCurrent</a> (PINDEX index) const</td></tr><tr><td colspan=2><br><h2>Protected Attributes</h2></td></tr><tr><td nowrap align=right valign=top><a class="el" href="classPAbstractList_1_1Info.html">PAbstractList::Info</a> * </td><td valign=bottom><a class="el" href="classPAbstractList.html#n0">info</a></td></tr></table><hr><a name="_details"></a><h2>Detailed Description</h2>This class is a collection of objects which are descendents of the <a class="el" href="classPObject.html#b0">PObject</a># class. It is implemeted as a doubly linked list.<p>The implementation of a list allows very fast inserting and deleting of objects in the collection, but has severe penalties for random access. All object access should be done sequentially to avoid these speed penalties.<p>The class remembers the last accessed element. This state information is used to optimise access by the "virtual array" model of collections. If access via ordinal index is made sequentially there is little overhead.<p>The PAbstractList class would very rarely be descended from directly by the user. The <a class="el" href="lists_8h.html#a1">PDECLARE_LIST</a># and <a class="el" href="pasn_8h.html#a3">PLIST</a># macros would normally be used to create descendent classes. They will instantiate the template based on PList# or directly declare and define the class (using inline functions) if templates are not being used.<p>The PList# class or <a class="el" href="lists_8h.html#a1">PDECLARE_LIST</a># macro will define the correctly typed operators for subscript access (operator[]#). <p><hr><h2>Constructor & Destructor Documentation</h2><a name="z171_0" doxytag="PAbstractList::PAbstractList"></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 PAbstractList::PAbstractList </td> <td class="md" valign="top">( </td> <td class="mdname1" valign="top" nowrap> </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, empty, list.<p>Note that by default, objects placed into the list will be deleted when removed or when all references to the list are destroyed. </td> </tr></table><hr><h2>Member Function Documentation</h2><a name="z175_0" doxytag="PAbstractList::Append"></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 PINDEX PAbstractList::Append </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top"><a class="el" href="classPObject.html">PObject</a> * </td> <td class="mdname1" valign="top" nowrap> <em>obj</em> </td> <td class="md" valign="top">) </td> <td class="md" nowrap><code> [virtual]</code></td> </tr> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p>Append a new object to the collection. This places a new link at the "tail" of the list.<p><dl compact><dt><b>Returns: </b></dt><dd> index of the newly added object. </dl><dl compact><dt><b>Parameters: </b></dt><dd><table border=0 cellspacing=2 cellpadding=0><tr><td valign=top><em>obj</em> </td><td>New object to place into the collection. </td></tr></table></dl><p>Implements <a class="el" href="classPCollection.html#z75_0">PCollection</a>. </td> </tr></table><a name="a0" doxytag="PAbstractList::Compare"></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 <a class="el" href="classPObject.html#z199_0">Comparison</a> PAbstractList::Compare </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">const <a class="el" href="classPObject.html">PObject</a> & </td> <td class="mdname1" valign="top" nowrap> <em>obj</em> </td> <td class="md" valign="top">) </td> <td class="md" nowrap> const<code> [virtual]</code></td> </tr> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p>Get the relative rank of the two lists. The following algorithm is employed for the comparison: \begin{description} \item[<a class="el" href="classPObject.html#z199_0s1">EqualTo</a>#] if the two lists are identical in length and each objects values, not pointer, are equal.<p>\item[<a class="el" href="classPObject.html#z199_0s0">LessThan</a>#] if the instances object value at an ordinal position is less than the corresponding objects value in the obj# parameters list.<p>This is also returned if all objects are equal and the instances list length is less than the obj# parameters list length.<p>\item[<a class="el" href="classPObject.html#z199_0s2">GreaterThan</a>#] if the instances object value at an ordinal position is greater than the corresponding objects value in the obj# parameters list.<p>This is also returned if all objects are equal and the instances list length is greater than the obj# parameters list length. \end{description}<p><dl compact><dt><b>Returns: </b></dt><dd> comparison of the two objects, <a class="el" href="classPObject.html#z199_0s1">EqualTo</a># for same, <a class="el" href="classPObject.html#z199_0s0">LessThan</a># for obj# logically less than the object and <a class="el" href="classPObject.html#z199_0s2">GreaterThan</a># for obj# logically greater than the object. </dl><p>Reimplemented from <a class="el" href="classPObject.html#z199_1">PObject</a>. </td> </tr></table><a name="z175_7" doxytag="PAbstractList::GetAt"></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 <a class="el" href="classPObject.html">PObject</a>* PAbstractList::GetAt </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">PINDEX </td> <td class="mdname1" valign="top" nowrap> <em>index</em> </td> <td class="md" valign="top">) </td> <td class="md" nowrap> const<code> [virtual]</code></td> </tr> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p>Get the object at the specified ordinal position. If the index was greater than the size of the collection then NULL is returned.<p>The object accessed in this way is remembered by the class and further access will be fast. Access to elements one either side of that saved element, and the head and tail of the list, will always be fast.<p><dl compact><dt><b>Returns: </b></dt><dd> pointer to object at the specified index. </dl><p>Implements <a class="el" href="classPCollection.html#z75_7">PCollection</a>. </td> </tr></table><a name="z175_8" doxytag="PAbstractList::GetObjectsIndex"></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 PINDEX PAbstractList::GetObjectsIndex </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">const <a class="el" href="classPObject.html">PObject</a> * </td> <td class="mdname1" valign="top" nowrap> <em>obj</em> </td> <td class="md" valign="top">) </td> <td class="md" nowrap> const<code> [virtual]</code></td> </tr> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p>Search the collection for the specific instance of the object. The object pointers are compared, not the values. A simple linear search from "head" of the list is performed.<p><dl compact><dt><b>Returns: </b></dt><dd> ordinal index position of the object, or P_MAX_INDEX. </dl><dl compact><dt><b>Parameters: </b></dt><dd><table border=0 cellspacing=2 cellpadding=0><tr><td valign=top><em>obj</em> </td><td>Object to find. </td></tr>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -