#include <fast_ptr_list.h>
Inheritance diagram for NL3D::CFastPtrListBase:
Nevrax France
Definition at line 80 of file fast_ptr_list.h.
Public Member Functions | |
void ** | begin () |
Get the head on the array of elements. NULL if none. | |
CFastPtrListBase (const CFastPtrListBase &o) | |
CFastPtrListBase () | |
Constructor. | |
void | clear () |
clear the list | |
bool | empty () const |
void | erase (CFastPtrListNode *node) |
erase an element in the list through its Node. No-op if the list does not have this element | |
void | insert (void *element, CFastPtrListNode *node) |
insert an element in the list through its Node, unlinking older if necessary | |
CFastPtrListBase & | operator= (const CFastPtrListBase &o) |
uint | size () const |
get the number of elements | |
~CFastPtrListBase () | |
Private Attributes | |
std::vector< void * > | _Elements |
std::vector< CFastPtrListNode * > | _Nodes |
|
Constructor.
Definition at line 84 of file fast_ptr_list.h.
00084 {} |
|
Definition at line 85 of file fast_ptr_list.h.
00085 {} |
|
Definition at line 49 of file fast_ptr_list.cpp. References clear().
00050 { 00051 clear(); 00052 } |
|
Get the head on the array of elements. NULL if none.
Reimplemented in NL3D::CFastPtrList< T >, NL3D::CFastPtrList< CQuadGridClipCluster >, NL3D::CFastPtrList< CPointLightModel >, and NL3D::CFastPtrList< CTransform >. Definition at line 94 of file fast_ptr_list.h. References _Elements.
|
|
clear the list
Reimplemented in NL3D::CFastPtrList< T >, NL3D::CFastPtrList< CQuadGridClipCluster >, NL3D::CFastPtrList< CPointLightModel >, and NL3D::CFastPtrList< CTransform >. Definition at line 56 of file fast_ptr_list.cpp. References _Nodes, erase(), and size(). Referenced by ~CFastPtrListBase().
|
|
Reimplemented in NL3D::CFastPtrList< T >, NL3D::CFastPtrList< CQuadGridClipCluster >, NL3D::CFastPtrList< CPointLightModel >, and NL3D::CFastPtrList< CTransform >. Definition at line 97 of file fast_ptr_list.h. References _Elements.
00097 {return _Elements.empty();} |
|
erase an element in the list through its Node. No-op if the list does not have this element
Reimplemented in NL3D::CFastPtrList< T >, NL3D::CFastPtrList< CQuadGridClipCluster >, NL3D::CFastPtrList< CPointLightModel >, and NL3D::CFastPtrList< CTransform >. Definition at line 87 of file fast_ptr_list.cpp. References _Elements, NL3D::CFastPtrListNode::_IndexInOwner, _Nodes, NL3D::CFastPtrListNode::_Owner, and uint. Referenced by clear(), and NL3D::CFastPtrListNode::unlink().
00088 { 00089 // not mine? 00090 if(node->_Owner!=this) 00091 return; 00092 00093 // Take the indexes, 00094 uint nodeIndex= node->_IndexInOwner; 00095 uint lastIndex= _Nodes.size()-1; 00096 00097 // swap the last element and the erased one. 00098 swap(_Elements[nodeIndex], _Elements[lastIndex]); 00099 swap(_Nodes[nodeIndex], _Nodes[lastIndex]); 00100 // change the swapped node index. NB: work also in the particular case nodeIndex==lastIndex 00101 _Nodes[nodeIndex]->_IndexInOwner= nodeIndex; 00102 // erase the last elements 00103 _Elements.pop_back(); 00104 _Nodes.pop_back(); 00105 00106 // reset erased node. 00107 node->_Owner= NULL; 00108 } |
|
insert an element in the list through its Node, unlinking older if necessary
Definition at line 67 of file fast_ptr_list.cpp. References _Elements, NL3D::CFastPtrListNode::_IndexInOwner, _Nodes, NL3D::CFastPtrListNode::_Owner, nlassert, and NL3D::CFastPtrListNode::unlink().
00068 { 00069 nlassert(element); 00070 nlassert(node); 00071 00072 // if this node is already linked to me, no-op! 00073 if(node->_Owner==this) 00074 return; 00075 00076 // first unlink the node from its older list if any. 00077 node->unlink(); 00078 00079 // then add the elements to the list, and update node info 00080 _Elements.push_back(element); 00081 _Nodes.push_back(node); 00082 node->_Owner= this; 00083 node->_IndexInOwner= _Nodes.size()-1; 00084 } |
|
Definition at line 103 of file fast_ptr_list.h.
00103 {return *this;} |
|
get the number of elements
Reimplemented in NL3D::CFastPtrList< T >, NL3D::CFastPtrList< CQuadGridClipCluster >, NL3D::CFastPtrList< CPointLightModel >, and NL3D::CFastPtrList< CTransform >. Definition at line 96 of file fast_ptr_list.h. References _Elements, and uint. Referenced by clear().
00096 {return _Elements.size();} |
|
Definition at line 108 of file fast_ptr_list.h. Referenced by begin(), empty(), erase(), insert(), and size(). |
|
Definition at line 109 of file fast_ptr_list.h. |