Line data Source code
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: 19 : typedef DBGraphBase::vertex_descriptor Vertex; 20 : typedef DBGraphBase::edge_descriptor Edge; 21 : 22 : DBGraphEdge(); 23 : 24 : void SetEdge(Edge edge); 25 : 26 161111 : Edge edge_id() const { 27 161111 : assert(!IsDeleted()); 28 : // Don't access the edge id after deleting from graph 29 161111 : 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: 40 : Edge edge_id_; 41 : 42 : DISALLOW_COPY_AND_ASSIGN(DBGraphEdge); 43 : }; 44 : 45 : #endif