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-09 02:10:49 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     3780668 : DBGraphVertex::adjacency_iterator::adjacency_iterator()
      14     3780668 :     : graph_(NULL) {
      15     3780668 : }
      16             : 
      17     1161735 : DBGraphVertex::adjacency_iterator::adjacency_iterator(DBGraph *graph,
      18     1161735 :                                                       Vertex vertex)
      19     1161735 :     : graph_(graph) {
      20     1161735 :     boost::tie(iter_, end_) = adjacent_vertices(vertex, *graph_->graph());
      21     1161735 : }
      22             : 
      23     3538345 : DBGraphVertex &DBGraphVertex::adjacency_iterator::dereference() const {
      24     3538345 :     Vertex adj = *iter_;
      25     3538345 :     return *(graph_->vertex_data(adj));
      26             : }
      27             : 
      28     1481157 : DBGraphVertex::edge_iterator::edge_iterator()
      29     1481157 :     : graph_(NULL), vertex_(NULL) {
      30     1481157 : }
      31             : 
      32      369450 : DBGraphVertex::edge_iterator::edge_iterator(DBGraph *graph,
      33      369450 :                                             DBGraphVertex *vertex)
      34      369450 :     : graph_(graph), vertex_(vertex) {
      35      369450 :     boost::tie(iter_, end_) = out_edges(vertex->vertex(), *graph_->graph());
      36      369450 : }
      37             : 
      38     1108499 : DBGraphEdge &DBGraphVertex::edge_iterator::dereference() const {
      39     1108499 :     Edge edge = *iter_;
      40     2216998 :     return *(graph_->edge_data(edge));
      41             : }
      42             : 
      43      296769 : DBGraphVertex *DBGraphVertex::edge_iterator::target() const {
      44      296769 :     Edge descriptor = *iter_;
      45      296769 :     DBGraphEdge *edge = graph_->edge_data(descriptor);
      46      296769 :     DBGraphVertex *v_target = edge->target(graph_);
      47      296769 :     if (v_target == vertex_) {
      48      116957 :         return edge->source(graph_);
      49             :     }
      50      179812 :     return v_target;
      51             : }
      52             : 
      53      111159 : bool DBGraphVertex::HasAdjacencies(DBGraph *graph) const {
      54      111159 :     DBGraphBase::adjacency_iterator iter, end;
      55      111159 :     boost::tie(iter, end) = adjacent_vertices(vertex_id_, *graph->graph());
      56      222318 :     return (iter != end);
      57             : }

Generated by: LCOV version 1.14