Declaration and implementation of embedded stack and list functionality which is useful for embedded chains of elements (classes with internal next and previous pointer).
More...
Declaration and implementation of embedded stack and list functionality which is useful for embedded chains of elements (classes with internal next and previous pointer).
- The templates declared in this file can be used whenever
- a so called embedded list has to be implemented. Example:
- Author:
- Martin Gronemann
class MyNode
{
public:
...
private:
MyNode* prev;
MyNode* next;
};
class MyDataStructure
{
private:
MyNode* m_head;
MyNode* m_tail;
int m_numNodes;
MyNode* m_stackTop;
public:
typedef EList< MyDataStructure,
MyNode,
&MyDataStructure::m_numNodes,
&MyDataStructure::m_head,
&MyDataStructure::m_tail,
&MyNode::prev,
&MyNode::next> NodeChain;
typedef EStack< MyDataStructure,
MyNode,
&MyDataStructure::m_stackTop,
&MyNode::next> NodeStack;
};
...
MyDataStructure ds;
MyDataStructure::NodeChain.init(&ds);
MyDataStructure::NodeStack.init(&ds);
...
MyNode* ptr = new MyNode();
MyDataStructure::NodeChain.pushBack(&ds, ptr);
...
ptr = MyDataStructure::NodeChain.front(&ds);
MyDataStructure::NodeStack.push(&ds,ptr);
...
for (MyDataStructure::NodeChain::iterator it = MyDataStructure::NodeChain.begin(&ds);
it.valid(); it++)
{
ptr = *it;
}
- License:
- This file is part of the Open Graph Drawing Framework (OGDF).
- Copyright (C)
See README.txt in the root directory of the OGDF installation for details.
- This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License Version 2 or 3 as published by the Free Software Foundation; see the file LICENSE.txt included in the packaging of this file for details.
- This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
- You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- See also:
- http://www.gnu.org/copyleft/gpl.html
Definition in file EList.h.