OpenSDN source code
db_graph_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 __DB_DB_GRAPH_EDGE_H__
7 #define __DB_DB_GRAPH_EDGE_H__
8 
9 #include "base/util.h"
10 
11 #include "db/db_entry.h"
12 #include "db/db_graph_base.h"
13 
14 class DBGraph;
15 class DBGraphVertex;
16 
17 class DBGraphEdge : public DBEntry {
18 public:
21 
22  DBGraphEdge();
23 
24  void SetEdge(Edge edge);
25 
26  Edge edge_id() const {
27  assert(!IsDeleted());
28  // Don't access the edge id after deleting from graph
29  return edge_id_;
30  }
31 
32  DBGraphVertex *source(DBGraph *graph);
33  const DBGraphVertex *source(DBGraph *graph) const;
34 
35  DBGraphVertex *target(DBGraph *graph);
36  const DBGraphVertex *target(DBGraph *graph) const;
37 
38  virtual const std::string &name() const = 0;
39 private:
41 
43 };
44 
45 #endif
bool IsDeleted() const
Definition: db_entry.h:49
boost::graph_traits< graph_t >::vertex_descriptor vertex_descriptor
Definition: db_graph_base.h:59
boost::graph_traits< graph_t >::edge_descriptor edge_descriptor
Definition: db_graph_base.h:60
void SetEdge(Edge edge)
Edge edge_id() const
Definition: db_graph_edge.h:26
DBGraphVertex * source(DBGraph *graph)
DBGraphBase::vertex_descriptor Vertex
Definition: db_graph_edge.h:19
DBGraphBase::edge_descriptor Edge
Definition: db_graph_edge.h:20
DISALLOW_COPY_AND_ASSIGN(DBGraphEdge)
DBGraphVertex * target(DBGraph *graph)
virtual const std::string & name() const =0