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-06-18 01:51:13 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             :  */
       4             : 
       5             : #include "route/route.h"
       6             : 
       7             : #include "base/time_util.h"
       8             : 
       9     4274192 : Route::Route() {
      10     4273872 : }
      11             : 
      12     4273460 : Route::~Route() {
      13     4273460 : }
      14             : 
      15             : // Selected path
      16     8664747 : const Path *Route::front() const {
      17     8664747 :     PathList::const_iterator it = path_.begin();
      18    17327778 :     if (it == path_.end())
      19     2335600 :         return NULL;
      20     6328083 :     return it.operator->();
      21             : }
      22             : 
      23             : // Insert a path
      24     1041981 : void Route::insert(const Path *ipath) {
      25     1041981 :     Path *path = const_cast<Path *> (ipath);
      26             : 
      27     1041981 :     path->set_time_stamp_usecs(UTCTimestampUsec());
      28     1042020 :     path_.push_back(*path);
      29     1041983 : }
      30             : 
      31             : // Remove a path
      32     1041417 : void Route::remove(const Path *ipath) {
      33     1041417 :     Path *path = const_cast<Path *> (ipath);
      34             : 
      35     1041417 :     path->set_time_stamp_usecs(UTCTimestampUsec());
      36     1041851 :     PathList::const_iterator eraseIt = path_.iterator_to(*path);
      37     2083416 :     path_.erase(eraseIt);
      38     1041751 : }
      39             : 
      40     2302213 : void Route::Sort(Compare compare, const Path *prev_front) {
      41     2302213 :     path_.sort(compare);
      42             : 
      43     2302152 :     set_last_update_at_to_now();
      44             :     // If the best path changes, update route's time stamp.
      45     2302150 :     if (prev_front != front()) {
      46     1977596 :         set_last_change_at_to_now();
      47             :     }
      48     2302026 : }

Generated by: LCOV version 1.14