LCOV - code coverage report
Current view: top level - db - db_graph_vertex.cc (source / functions) Hit Total Coverage
Test: OpenSDN C/C++ coverage (all TARGET_SET jobs) Lines: 33 33 100.0 %
Date: 2026-11-23 02:04:52 Functions: 8 8 100.0 %
Legend: Lines: hit not hit

          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             : #include "db/db_graph_vertex.h"
       7             : 
       8             : #include "db/db_graph.h"
       9             : #include "db/db_graph_edge.h"
      10             : 
      11             : using namespace boost;
      12             : 
      13     3738496 : DBGraphVertex::adjacency_iterator::adjacency_iterator()
      14     3738496 :     : graph_(NULL) {
      15     3738496 : }
      16             : 
      17     1149850 : DBGraphVertex::adjacency_iterator::adjacency_iterator(DBGraph *graph,
      18     1149850 :                                                       Vertex vertex)
      19     1149850 :     : graph_(graph) {
      20     1149850 :     boost::tie(iter_, end_) = adjacent_vertices(vertex, *graph_->graph());
      21     1149850 : }
      22             : 
      23     3494266 : DBGraphVertex &DBGraphVertex::adjacency_iterator::dereference() const {
      24     3494266 :     Vertex adj = *iter_;
      25     3494266 :     return *(graph_->vertex_data(adj));
      26             : }
      27             : 
      28     1461090 : DBGraphVertex::edge_iterator::edge_iterator()
      29     1461090 :     : graph_(NULL), vertex_(NULL) {
      30     1461090 : }
      31             : 
      32      362872 : DBGraphVertex::edge_iterator::edge_iterator(DBGraph *graph,
      33      362872 :                                             DBGraphVertex *vertex)
      34      362872 :     : graph_(graph), vertex_(vertex) {
      35      362872 :     boost::tie(iter_, end_) = out_edges(vertex->vertex(), *graph_->graph());
      36      362872 : }
      37             : 
      38     1095120 : DBGraphEdge &DBGraphVertex::edge_iterator::dereference() const {
      39     1095120 :     Edge edge = *iter_;
      40     2190240 :     return *(graph_->edge_data(edge));
      41             : }
      42             : 
      43      292552 : DBGraphVertex *DBGraphVertex::edge_iterator::target() const {
      44      292552 :     Edge descriptor = *iter_;
      45      292552 :     DBGraphEdge *edge = graph_->edge_data(descriptor);
      46      292552 :     DBGraphVertex *v_target = edge->target(graph_);
      47      292552 :     if (v_target == vertex_) {
      48      115242 :         return edge->source(graph_);
      49             :     }
      50      177310 :     return v_target;
      51             : }
      52             : 
      53      109181 : bool DBGraphVertex::HasAdjacencies(DBGraph *graph) const {
      54      109181 :     DBGraphBase::adjacency_iterator iter, end;
      55      109181 :     boost::tie(iter, end) = adjacent_vertices(vertex_id_, *graph->graph());
      56      218362 :     return (iter != end);
      57             : }

Generated by: LCOV version 1.14