给下列程序添加注释:DijkstraExpansion::DijkstraExpansion(PotentialCalculator* p_calc, int nx, int ny) : Expander(p_calc, nx, ny), pending_(NULL), precise_(false) { // priority buffers buffer1_ = new int[PRIORITYBUFSIZE]; buffer2_ = new int[PRIORITYBUFSIZE]; buffer3_ = new int[PRIORITYBUFSIZE]; priorityIncrement_ = 2 * neutral_cost_; } DijkstraExpansion::~DijkstraExpansion() { delete[] buffer1_; delete[] buffer2_; delete[] buffer3_; if (pending_) delete[] pending_; }
时间: 2024-03-31 09:32:27 浏览: 181
程序注释工具
// Constructor for the DijkstraExpansion class. It takes in a PotentialCalculator object, and the dimensions of the grid.
DijkstraExpansion::DijkstraExpansion(PotentialCalculator* p_calc, int nx, int ny) : Expander(p_calc, nx, ny), pending_(NULL), precise_(false) {
// Initialize priority buffers
buffer1_ = new int[PRIORITYBUFSIZE];
buffer2_ = new int[PRIORITYBUFSIZE];
buffer3_ = new int[PRIORITYBUFSIZE];
priorityIncrement_ = 2 * neutral_cost_;
}
// Destructor for the DijkstraExpansion class.
DijkstraExpansion::~DijkstraExpansion() {
// Delete priority buffers and pending array
delete[] buffer1_;
delete[] buffer2_;
delete[] buffer3_;
if (pending_) delete[] pending_;
}
阅读全文