File size: 766 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#pragma once

#include "vector"

#include "moses/Syntax/PVertex.h"

namespace Moses
{
namespace Syntax
{
namespace F2S
{

class Forest
{
public:
  struct Vertex;

  struct Hyperedge {
    Vertex *head;
    std::vector<Vertex *> tail;
    float weight;
  };

  struct Vertex {
    Vertex(const PVertex &v) : pvertex(v) {}
    ~Vertex();  // Deletes incoming hyperedges.
    PVertex pvertex;
    std::vector<Hyperedge *> incoming;
  };

  // Constructor.
  Forest() {}

  // Destructor (deletes vertices).
  ~Forest();

  // Delete all vertices.
  void Clear();

  std::vector<Vertex *> vertices;

private:
  // Copying is not allowed.
  Forest(const Forest &);
  Forest &operator=(const Forest &);
};

}  // namespace F2S
}  // namespace Syntax
}  // namespace Moses