File: graph.hh

package info (click to toggle)
jlint 3.0-4.2
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 776 kB
  • ctags: 662
  • sloc: cpp: 5,837; ansic: 1,496; makefile: 299; perl: 93; sh: 49
file content (63 lines) | stat: -rw-r--r-- 1,109 bytes parent folder | download | duplicates (5)
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
53
54
55
56
57
58
59
60
61
62
63
#ifndef GRAPH_HH
#define GRAPH_HH

#include "types.hh"
#include "method_desc.hh"

class callee_desc;
class graph_vertex;

class graph_edge { 
public:
  graph_edge*   next;
  callee_desc*  invocation;
  method_desc*  caller;
  graph_vertex* vertex;
  int           mask;

  void message(int loop_id);

  graph_edge(graph_vertex* node, method_desc* method, callee_desc* call) { 
    invocation = call;
    caller = method;
    vertex = node;
    mask = 0;
  }
};

class graph_vertex { 
public:
  graph_edge*   edges;
  graph_vertex* next;
  class_desc*   cls;
  int           visited;
  int           marker;
  int           n_loops;
  enum { 
    flag_vertex_on_path    = 0x80000000,
    flag_vertex_not_marked = 0x7fffffff
  };

  static int n_vertexes;

  static graph_vertex* graph;
    
  static void verify();

  void attach(graph_edge* edge) { 
    edge->next = edges;
    edges = edge;
  }

  graph_vertex(class_desc* vertex_class) { 
    cls = vertex_class;
    visited = 0;
    marker = flag_vertex_not_marked;
    next = graph;
    graph = this;
    edges = NULL;
    n_vertexes += 1;
  }
};

#endif