OpenSDN source code
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
db_graph_edge.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
3  */
4 
5 #ifndef __DB_DB_GRAPH_EDGE_H__
6 #define __DB_DB_GRAPH_EDGE_H__
7 
8 #include "base/util.h"
9 
10 #include "db/db_entry.h"
11 #include "db/db_graph_base.h"
12 
13 class DBGraph;
14 class DBGraphVertex;
15 
16 class DBGraphEdge : public DBEntry {
17 public:
20 
21  DBGraphEdge();
22 
23  void SetEdge(Edge edge);
24 
25  Edge edge_id() const {
26  assert(!IsDeleted());
27  // Don't access the edge id after deleting from graph
28  return edge_id_;
29  }
30 
31  DBGraphVertex *source(DBGraph *graph);
32  const DBGraphVertex *source(DBGraph *graph) const;
33 
34  DBGraphVertex *target(DBGraph *graph);
35  const DBGraphVertex *target(DBGraph *graph) const;
36 
37  virtual const std::string &name() const = 0;
38 private:
40 
42 };
43 
44 #endif
DBGraphBase::vertex_descriptor Vertex
Definition: db_graph_edge.h:18
bool IsDeleted() const
Definition: db_entry.h:49
DISALLOW_COPY_AND_ASSIGN(DBGraphEdge)
boost::graph_traits< graph_t >::vertex_descriptor vertex_descriptor
Definition: db_graph_base.h:58
void SetEdge(Edge edge)
Edge edge_id() const
Definition: db_graph_edge.h:25
DBGraphVertex * target(DBGraph *graph)
boost::graph_traits< graph_t >::edge_descriptor edge_descriptor
Definition: db_graph_base.h:59
virtual const std::string & name() const =0
DBGraphVertex * source(DBGraph *graph)
DBGraphBase::edge_descriptor Edge
Definition: db_graph_edge.h:19