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