aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorymherklotz <ymherklotz@gmail.com>2016-12-09 22:48:28 +0000
committerymherklotz <ymherklotz@gmail.com>2016-12-09 22:48:28 +0000
commit0c5b64e10694bddf1f5eb904fcd64c4aac81a8a5 (patch)
tree6bb2dcdf2ebdd41cec9b7eeb8ab0de36c13e1be9
parentdba9dfca366570496d0b5e0bdf60621a6b0ff804 (diff)
downloadA-star-algorithm-0c5b64e10694bddf1f5eb904fcd64c4aac81a8a5.tar.gz
A-star-algorithm-0c5b64e10694bddf1f5eb904fcd64c4aac81a8a5.zip
annotated priority_queue.hpp
-rwxr-xr-xbin/mainbin209256 -> 208440 bytes
-rw-r--r--include/astar.hpp1
-rw-r--r--include/priority_queue.hpp6
-rw-r--r--src/astar.cpp3
4 files changed, 10 insertions, 0 deletions
diff --git a/bin/main b/bin/main
index 26bf836..7121c91 100755
--- a/bin/main
+++ b/bin/main
Binary files differ
diff --git a/include/astar.hpp b/include/astar.hpp
index d40b97f..9dde48f 100644
--- a/include/astar.hpp
+++ b/include/astar.hpp
@@ -10,6 +10,7 @@
// TODO add constructors and functions to calculate heuristics etc..
class AStar {
public:
+ AStar();
private:
};
diff --git a/include/priority_queue.hpp b/include/priority_queue.hpp
index 5d8b5df..fe53335 100644
--- a/include/priority_queue.hpp
+++ b/include/priority_queue.hpp
@@ -6,7 +6,9 @@
template<typename T>
class PriorityQueue {
public:
+ // creates a new object of type T
PriorityQueue();
+ // deletes the array priority_array so that there are no memory leaks
~PriorityQueue();
// pushes element to the queue which is sorted by smallest element first
@@ -23,10 +25,14 @@ private:
// array that will represent the priority queue
T *priority_array;
+ // resize the queue's array accordingly by some factor
void resize_queue(double factor);
+ // insert and element into the queue
+ // this assumes that the capacity is larger than the size
void insert_queue(const T& element, const unsigned int& loc);
+ // removes an element from the queue
T remove_queue(const unsigned int& loc);
};
diff --git a/src/astar.cpp b/src/astar.cpp
index 9dd9332..f5cabfb 100644
--- a/src/astar.cpp
+++ b/src/astar.cpp
@@ -1,5 +1,8 @@
#include "astar.hpp"
+AStar::AStar() {
+}
+
Node::Node() : previous_node(NULL), f_score(-1), g_score(0), h_score(-1) {
update_f_score();
}