From 7b9821d42d980e5788bbc65563973eddd6e4c40d Mon Sep 17 00:00:00 2001 From: Michael Andreen Date: Sun, 8 May 2005 10:34:23 +0000 Subject: [PATCH] Might be good to have a destructor too --- planner.cpp | 7 +++++++ planner.h | 1 + 2 files changed, 8 insertions(+) diff --git a/planner.cpp b/planner.cpp index cf78015..6d70ae4 100644 --- a/planner.cpp +++ b/planner.cpp @@ -20,6 +20,13 @@ Planner::Planner(std::vector actions, literals init, literals goal){ makePlan(finish); } +Planner::~Planner(){ + for (hash_map::iterator node = _addedNodes.begin(); node != _addedNodes.end(); ++node){ + cerr << "Deleting node " << node->second->action().executable() << endl; + delete node->second; + } +} + void Planner::makePlan(Node* node){ cerr << "Fetching preconditions for action: " << node->action().executable() << ".. "; diff --git a/planner.h b/planner.h index ce7aef0..ab8f4ee 100644 --- a/planner.h +++ b/planner.h @@ -39,6 +39,7 @@ size_t operator()(const std::basic_string& s) const { class Planner { public: Planner(std::vector actions, literals init, literals goal); + ~Planner(); void execute(); -- 2.39.2