LCOV - code coverage report
Current view: top level - route - route.cc (source / functions) Hit Total Coverage
Test: OpenSDN C/C++ coverage (all TARGET_SET jobs) Lines: 26 26 100.0 %
Date: 2026-11-09 02:10:49 Functions: 6 7 85.7 %
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 "route/route.h"
       7             : 
       8             : #include "base/time_util.h"
       9             : 
      10     4340856 : Route::Route() {
      11     4340569 : }
      12             : 
      13     4340191 : Route::~Route() {
      14     4340191 : }
      15             : 
      16             : // Selected path
      17     8965054 : const Path *Route::front() const {
      18     8965054 :     PathList::const_iterator it = path_.begin();
      19    17927841 :     if (it == path_.end())
      20     2353590 :         return NULL;
      21     6609978 :     return it.operator->();
      22             : }
      23             : 
      24             : // Insert a path
      25     1047636 : void Route::insert(const Path *ipath) {
      26     1047636 :     Path *path = const_cast<Path *> (ipath);
      27             : 
      28     1047636 :     path->set_time_stamp_usecs(UTCTimestampUsec());
      29     1047671 :     path_.push_back(*path);
      30     1047637 : }
      31             : 
      32             : // Remove a path
      33     1046798 : void Route::remove(const Path *ipath) {
      34     1046798 :     Path *path = const_cast<Path *> (ipath);
      35             : 
      36     1046798 :     path->set_time_stamp_usecs(UTCTimestampUsec());
      37     1047442 :     PathList::const_iterator eraseIt = path_.iterator_to(*path);
      38     2094402 :     path_.erase(eraseIt);
      39     1047308 : }
      40             : 
      41     2330080 : void Route::Sort(Compare compare, const Path *prev_front) {
      42     2330080 :     path_.sort(compare);
      43             : 
      44     2330002 :     set_last_update_at_to_now();
      45             :     // If the best path changes, update route's time stamp.
      46     2329985 :     if (prev_front != front()) {
      47     1986964 :         set_last_change_at_to_now();
      48             :     }
      49     2329684 : }

Generated by: LCOV version 1.14