HOG2
NodeLimitAbstraction.h
Go to the documentation of this file.
1 /*
2  * NodeLimitAbstraction.h
3  * hog
4  *
5  * Created by Nathan Sturtevant on 3/24/07.
6  * Copyright 2007 __MyCompanyName__. All rights reserved.
7  *
8  * This file is part of HOG.
9  *
10  * HOG is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * HOG is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with HOG; if not, write to the Free Software
22  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23  *
24  */
25 
26 #include "MapAbstraction.h"
27 
28 #ifndef NodeLimitABSTRACTION_H
29 #define NodeLimitABSTRACTION_H
30 
31 class NodeLimitAbstraction : public MapAbstraction {
32 public:
35  MapAbstraction *Clone(Map *_m) { return new NodeLimitAbstraction(_m, nodeLimit); }
36 
37  virtual bool Pathable(node *from, node *to);
38 
39  // utility functions
41  virtual void VerifyHierarchy();
42 
43  // hierarchical modifications
45  virtual void RemoveNode(node *n);
47  virtual void RemoveEdge(edge *e, unsigned int absLevel);
49  virtual void AddNode(node *n);
51  virtual void AddEdge(edge *e, unsigned int absLevel);
54  virtual void RepairAbstraction();
55 private:
56  void buildAbstraction();
57  void buildNodeIntoParent(node *n, node *parent);
58  void abstractionBFS(node *which, node *parent, int depth);
59 
60  void addEdges(Graph *g);
61  void addNodes(Graph *g);
62 
63  int nodeLimit;
64 };
65 
66 #endif
NodeLimitAbstraction::buildAbstraction
void buildAbstraction()
Definition: NodeLimitAbstraction.cpp:99
NodeLimitAbstraction::Clone
MapAbstraction * Clone(Map *_m)
Definition: NodeLimitAbstraction.h:35
NodeLimitAbstraction::nodeLimit
int nodeLimit
Definition: NodeLimitAbstraction.h:63
NodeLimitAbstraction::buildNodeIntoParent
void buildNodeIntoParent(node *n, node *parent)
Definition: NodeLimitAbstraction.cpp:209
NodeLimitAbstraction::addEdges
void addEdges(Graph *g)
Definition: NodeLimitAbstraction.cpp:137
NodeLimitAbstraction::RepairAbstraction
virtual void RepairAbstraction()
This must be called after any of the above add/remove operations.
Definition: NodeLimitAbstraction.cpp:95
NodeLimitAbstraction::Pathable
virtual bool Pathable(node *from, node *to)
Definition: NodeLimitAbstraction.cpp:44
Graph
A generic Graph class.
Definition: Graph.h:66
NodeLimitAbstraction::NodeLimitAbstraction
NodeLimitAbstraction(Map *, int nodeLimit)
Definition: NodeLimitAbstraction.cpp:32
NodeLimitAbstraction::RemoveEdge
virtual void RemoveEdge(edge *e, unsigned int absLevel)
remove edge from abstraction
Definition: NodeLimitAbstraction.cpp:75
NodeLimitAbstraction::abstractionBFS
void abstractionBFS(node *which, node *parent, int depth)
Definition: NodeLimitAbstraction.cpp:158
NodeLimitAbstraction::VerifyHierarchy
virtual void VerifyHierarchy()
verify that the hierarchy is consistent
Definition: NodeLimitAbstraction.cpp:64
NodeLimitAbstraction
Definition: NodeLimitAbstraction.h:31
NodeLimitAbstraction::~NodeLimitAbstraction
~NodeLimitAbstraction()
Definition: NodeLimitAbstraction.cpp:40
NodeLimitAbstraction::AddNode
virtual void AddNode(node *n)
add node to abstraction
Definition: NodeLimitAbstraction.cpp:80
NodeLimitAbstraction::addNodes
void addNodes(Graph *g)
Definition: NodeLimitAbstraction.cpp:112
MapAbstraction.h
NodeLimitAbstraction::AddEdge
virtual void AddEdge(edge *e, unsigned int absLevel)
add edge to abstraction
Definition: NodeLimitAbstraction.cpp:87
NodeLimitAbstraction::RemoveNode
virtual void RemoveNode(node *n)
remove node from abstraction
Definition: NodeLimitAbstraction.cpp:70
node
Nodes to be stored within a Graph.
Definition: Graph.h:170
Map
A tile-based representation of the world.
Definition: Map.h:142
edge
Edge class for connections between node in a Graph.
Definition: Graph.h:129