#ifndef SEARCH_EDGE_GENERATOR__ #define SEARCH_EDGE_GENERATOR__ #include "search/edge.hh" #include #include #include namespace lm { namespace ngram { class ChartState; } // namespace ngram } // namespace lm namespace search { template class Context; class VertexGenerator; struct PartialEdgePointerLess : std::binary_function { bool operator()(const PartialEdge *first, const PartialEdge *second) const { return *first < *second; } }; class EdgeGenerator { public: // True if it has a hypothesis. bool Init(Edge &edge, VertexGenerator &parent); Score Top() const { return top_; } template bool Pop(Context &context, VertexGenerator &parent); private: const Rule &GetRule() const { return from_->GetRule(); } Score top_; typedef std::priority_queue, PartialEdgePointerLess> Generate; Generate generate_; Edge *from_; }; } // namespace search #endif // SEARCH_EDGE_GENERATOR__