00001 #pragma once 00002 00003 #include "vector" 00004 00005 #include "moses/Syntax/PVertex.h" 00006 00007 namespace Moses 00008 { 00009 namespace Syntax 00010 { 00011 namespace F2S 00012 { 00013 00014 class Forest 00015 { 00016 public: 00017 struct Vertex; 00018 00019 struct Hyperedge { 00020 Vertex *head; 00021 std::vector<Vertex *> tail; 00022 float weight; 00023 }; 00024 00025 struct Vertex { 00026 Vertex(const PVertex &v) : pvertex(v) {} 00027 ~Vertex(); // Deletes incoming hyperedges. 00028 PVertex pvertex; 00029 std::vector<Hyperedge *> incoming; 00030 }; 00031 00032 // Constructor. 00033 Forest() {} 00034 00035 // Destructor (deletes vertices). 00036 ~Forest(); 00037 00038 // Delete all vertices. 00039 void Clear(); 00040 00041 std::vector<Vertex *> vertices; 00042 00043 private: 00044 // Copying is not allowed. 00045 Forest(const Forest &); 00046 Forest &operator=(const Forest &); 00047 }; 00048 00049 } // namespace F2S 00050 } // namespace Syntax 00051 } // namespace Moses