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