OpenSDN source code
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
policy_edge.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
3  */
4 
5 #ifndef ctrlplane_policy_graph_edge_h
6 #define ctrlplane_policy_graph_edge_h
7 
8 #include "base/util.h"
9 
11 
12 class PolicyGraph;
13 class PolicyGraphVertex;
14 
16 public:
19 
20  explicit PolicyGraphEdge(Edge edge_id);
21 
22  Edge edge_id() const { return edge_id_; }
23 
25  const PolicyGraphVertex *source(PolicyGraph *graph) const;
26 
28  const PolicyGraphVertex *target(PolicyGraph *graph) const;
29 
30  virtual bool IsMatchValue() {
31  return false;
32  }
33 
34  virtual bool IsNilMatch() {
35  return false;
36  }
37 
38  virtual bool IsNextFeed() {
39  return false;
40  }
41 
42  bool operator ==(const PolicyGraphEdge &rhs) const {
43  return IsSame(rhs);
44  }
45 
46  virtual bool IsSame(const PolicyGraphEdge &rhs) const = 0;
47 
48  // Comparator used for NextFeeder
49  virtual bool IsLess(const PolicyGraphEdge &rhs) const = 0;
50 
51  bool operator<(const PolicyGraphEdge &rhs) const {
52  return IsLess(rhs);
53  }
54 
55 private:
57 
59 };
60 
62  virtual bool IsMatchValue() {
63  return true;
64  }
65 };
66 
68  virtual bool IsNextFeed() {
69  return false;
70  }
71 };
72 
74  virtual bool IsNilMatch() {
75  return false;
76  }
77 };
78 
79 #endif // ctrlplane_policy_graph_edge_h
PolicyGraphEdge(Edge edge_id)
Definition: policy_edge.cc:9
bool operator<(const PolicyGraphEdge &rhs) const
Definition: policy_edge.h:51
boost::graph_traits< graph_t >::edge_descriptor edge_descriptor
virtual bool IsLess(const PolicyGraphEdge &rhs) const =0
PolicyGraphVertex * source(PolicyGraph *graph)
Definition: policy_edge.cc:13
virtual bool IsSame(const PolicyGraphEdge &rhs) const =0
virtual bool IsNextFeed()
Definition: policy_edge.h:68
virtual bool IsNextFeed()
Definition: policy_edge.h:38
bool operator==(const PolicyGraphEdge &rhs) const
Definition: policy_edge.h:42
PolicyGraphVertex * target(PolicyGraph *graph)
Definition: policy_edge.cc:23
virtual bool IsMatchValue()
Definition: policy_edge.h:30
PolicyGraphBase::vertex_descriptor Vertex
Definition: policy_edge.h:18
virtual bool IsNilMatch()
Definition: policy_edge.h:74
PolicyGraphBase::edge_descriptor Edge
Definition: policy_edge.h:17
Edge edge_id() const
Definition: policy_edge.h:22
DISALLOW_COPY_AND_ASSIGN(PolicyGraphEdge)
virtual bool IsMatchValue()
Definition: policy_edge.h:62
boost::graph_traits< graph_t >::vertex_descriptor vertex_descriptor
virtual bool IsNilMatch()
Definition: policy_edge.h:34