File size: 597 Bytes
158b61b |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
#include "CubeQueue.h"
namespace Moses
{
namespace Syntax
{
CubeQueue::~CubeQueue()
{
while (!m_queue.empty()) {
Cube *cube = m_queue.top();
m_queue.pop();
delete cube;
}
}
SHyperedge *CubeQueue::Pop()
{
// pop the most promising cube
Cube *cube = m_queue.top();
m_queue.pop();
// pop the most promising hyperedge from the cube
SHyperedge *hyperedge = cube->Pop();
// if the cube contains more items then push it back onto the queue
if (!cube->IsEmpty()) {
m_queue.push(cube);
} else {
delete cube;
}
return hyperedge;
}
} // Syntax
} // Moses
|