![]() |
Shadowrun: Awakened 29 September 2011 - Build 871
|
#include <DS_Tree.h>
Inheritance diagram for DataStructures::Tree< TreeType >:Public Member Functions | |
| void | AddChild (TreeType &newData) |
| void | DeleteDecendants (void) |
| void | LevelOrderTraversal (DataStructures::List< Tree * > &output) |
| Tree (TreeType &inputData) | |
| Tree () | |
| ~Tree () | |
Public Attributes | |
| DataStructures::List< Tree * > | children |
| TreeType | data |
| DataStructures::Tree< TreeType >::Tree | ( | ) |
| DataStructures::Tree< TreeType >::Tree | ( | TreeType & | inputData | ) |
| DataStructures::Tree< TreeType >::~Tree | ( | ) |
Definition at line 50 of file DS_Tree.h.
{
DeleteDecendants();
}
| void DataStructures::Tree< TreeType >::AddChild | ( | TreeType & | newData | ) |
Definition at line 75 of file DS_Tree.h.
References _FILE_AND_LINE_.
{
children.Insert(RakNet::OP_NEW<Tree>(newData, _FILE_AND_LINE_));
}
| void DataStructures::Tree< TreeType >::DeleteDecendants | ( | void | ) |
Definition at line 81 of file DS_Tree.h.
References _FILE_AND_LINE_, and RakNet::OP_DELETE().
Referenced by DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::GetSpanningTree().
{
/*
DataStructures::List<Tree*> output;
LevelOrderTraversal(output);
unsigned i;
for (i=0; i < output.Size(); i++)
RakNet::OP_DELETE(output[i], _FILE_AND_LINE_);
*/
// Already recursive to do this
unsigned int i;
for (i=0; i < children.Size(); i++)
RakNet::OP_DELETE(children[i], _FILE_AND_LINE_);
}
| void DataStructures::Tree< TreeType >::LevelOrderTraversal | ( | DataStructures::List< Tree< TreeType > * > & | output | ) |
Definition at line 56 of file DS_Tree.h.
References _FILE_AND_LINE_, DataStructures::Tree< TreeType >::children, DataStructures::List< list_type >::Insert(), DataStructures::Queue< queue_type >::Pop(), DataStructures::Queue< queue_type >::Push(), DataStructures::List< list_type >::Size(), and DataStructures::Queue< queue_type >::Size().
{
unsigned i;
Tree<TreeType> *node;
DataStructures::Queue<Tree<TreeType>*> queue;
for (i=0; i < children.Size(); i++)
queue.Push(children[i]);
while (queue.Size())
{
node=queue.Pop();
output.Insert(node, _FILE_AND_LINE_);
for (i=0; i < node->children.Size(); i++)
queue.Push(node->children[i]);
}
}
| DataStructures::List<Tree *> DataStructures::Tree< TreeType >::children |
Definition at line 34 of file DS_Tree.h.
Referenced by DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::GetSpanningTree(), and DataStructures::Tree< TreeType >::LevelOrderTraversal().
| TreeType DataStructures::Tree< TreeType >::data |
Definition at line 33 of file DS_Tree.h.
Referenced by DataStructures::WeightedGraph< node_type, weight_type, allow_unlinkedNodes >::GetSpanningTree().
Copyright © 2007-2010 by The Shadowrun: Awakened Team. This work is licensed under the GNU Lesser General Public License 3.