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-30 02:00:48 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     3727800 : DBGraphVertex::adjacency_iterator::adjacency_iterator()
      14     3727800 :     : graph_(NULL) {
      15     3727800 : }
      16             : 
      17     1150378 : DBGraphVertex::adjacency_iterator::adjacency_iterator(DBGraph *graph,
      18     1150378 :                                                       Vertex vertex)
      19     1150378 :     : graph_(graph) {
      20     1150378 :     boost::tie(iter_, end_) = adjacent_vertices(vertex, *graph_->graph());
      21     1150378 : }
      22             : 
      23     3483603 : DBGraphVertex &DBGraphVertex::adjacency_iterator::dereference() const {
      24     3483603 :     Vertex adj = *iter_;
      25     3483603 :     return *(graph_->vertex_data(adj));
      26             : }
      27             : 
      28     1460665 : DBGraphVertex::edge_iterator::edge_iterator()
      29     1460665 :     : graph_(NULL), vertex_(NULL) {
      30     1460665 : }
      31             : 
      32      362321 : DBGraphVertex::edge_iterator::edge_iterator(DBGraph *graph,
      33      362321 :                                             DBGraphVertex *vertex)
      34      362321 :     : graph_(graph), vertex_(vertex) {
      35      362321 :     boost::tie(iter_, end_) = out_edges(vertex->vertex(), *graph_->graph());
      36      362321 : }
      37             : 
      38     1095218 : DBGraphEdge &DBGraphVertex::edge_iterator::dereference() const {
      39     1095218 :     Edge edge = *iter_;
      40     2190436 :     return *(graph_->edge_data(edge));
      41             : }
      42             : 
      43      292738 : DBGraphVertex *DBGraphVertex::edge_iterator::target() const {
      44      292738 :     Edge descriptor = *iter_;
      45      292738 :     DBGraphEdge *edge = graph_->edge_data(descriptor);
      46      292738 :     DBGraphVertex *v_target = edge->target(graph_);
      47      292738 :     if (v_target == vertex_) {
      48      115232 :         return edge->source(graph_);
      49             :     }
      50      177506 :     return v_target;
      51             : }
      52             : 
      53      109367 : bool DBGraphVertex::HasAdjacencies(DBGraph *graph) const {
      54      109367 :     DBGraphBase::adjacency_iterator iter, end;
      55      109367 :     boost::tie(iter, end) = adjacent_vertices(vertex_id_, *graph->graph());
      56      218734 :     return (iter != end);
      57             : }

Generated by: LCOV version 1.14