![]() |
User Manual, Developers Guide and API Documentation |
![]() |
00001 /******************************************************************************* 00002 * This file is part of openWNS (open Wireless Network Simulator) 00003 * _____________________________________________________________________________ 00004 * 00005 * Copyright (C) 2004-2007 00006 * Chair of Communication Networks (ComNets) 00007 * Kopernikusstr. 16, D-52074 Aachen, Germany 00008 * phone: ++49-241-80-27910, 00009 * fax: ++49-241-80-22242 00010 * email: info@openwns.org 00011 * www: http://www.openwns.org 00012 * _____________________________________________________________________________ 00013 * 00014 * openWNS is free software; you can redistribute it and/or modify it under the 00015 * terms of the GNU Lesser General Public License version 2 as published by the 00016 * Free Software Foundation; 00017 * 00018 * openWNS is distributed in the hope that it will be useful, but WITHOUT ANY 00019 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 00020 * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 00021 * details. 00022 * 00023 * You should have received a copy of the GNU Lesser General Public License 00024 * along with this program. If not, see <http://www.gnu.org/licenses/>. 00025 * 00026 ******************************************************************************/ 00027 00028 #ifndef WNS_CONTAINER_FASTLISTNODE_HPP 00029 #define WNS_CONTAINER_FASTLISTNODE_HPP 00030 00031 namespace wns { namespace container { 00032 00033 // Forward Decleration of FastList 00034 template <typename T> class FastList; 00035 00040 template<typename T> class FastListNode { 00044 friend class FastList<T>; 00045 00046 public: 00051 explicit FastListNode(const T& x) : 00052 data(x), 00053 previousNode(this), 00054 nextNode(this) 00055 {}; 00056 00060 ~FastListNode() {}; 00061 00065 void removeFromList() 00066 { 00067 previousNode->nextNode = nextNode; 00068 nextNode->previousNode = previousNode; 00069 }; 00070 00076 void addToList(FastListNode& begin) 00077 { 00078 nextNode = begin.nextNode; 00079 previousNode = &begin; 00080 00081 begin.nextNode = this; 00082 nextNode->previousNode = this; 00083 }; 00084 00088 FastListNode* getNext() const 00089 { 00090 return nextNode; 00091 } 00092 00096 FastListNode* getPrevious() const 00097 { 00098 return previousNode; 00099 } 00100 00105 T& getData() 00106 { 00107 return data; 00108 }; 00109 00110 protected: 00117 FastListNode() : 00118 previousNode(this), 00119 nextNode(this) 00120 {} 00121 00122 private: 00126 T data; 00127 00131 FastListNode* previousNode; 00132 00136 FastListNode* nextNode; 00137 }; 00138 }} 00139 #endif
1.5.5