LCOV - code coverage report
Current view: top level - vnsw/agent/oper - audit_list.h (source / functions) Hit Total Coverage
Test: OpenSDN C/C++ coverage (all TARGET_SET jobs) Lines: 20 26 76.9 %
Date: 2026-08-24 02:06:43 Functions: 12 14 85.7 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :  * Copyright (c) 2016 Juniper Networks, Inc. All rights reserved.
       3             :  */
       4             : 
       5             : #ifndef vnsw_agent_audit_list_hpp
       6             : #define vnsw_agent_audit_list_hpp
       7             : 
       8             : /////////////////////////////////////////////////////////////////////////////
       9             : // Template function to audit two lists. This is used to synchronize the
      10             : // operational and config list for Floating-IP, Service-Vlans, Static Routes
      11             : // and SG List
      12             : /////////////////////////////////////////////////////////////////////////////
      13             : template<class List, class Iterator>
      14        2574 : bool AuditList(List &list, Iterator old_first, Iterator old_last,
      15             :                Iterator new_first, Iterator new_last) {
      16        2574 :     bool ret = false;
      17        2574 :     Iterator old_iterator = old_first;
      18        2574 :     Iterator new_iterator = new_first;
      19        2669 :     while (old_iterator != old_last && new_iterator != new_last) {
      20          95 :         if (old_iterator->IsLess(new_iterator.operator->())) {
      21           0 :             Iterator bkp = old_iterator++;
      22           0 :             list.Remove(bkp);
      23           0 :             ret = true;
      24          95 :         } else if (new_iterator->IsLess(old_iterator.operator->())) {
      25           0 :             Iterator bkp = new_iterator++;
      26           0 :             list.Insert(bkp.operator->());
      27           0 :             ret = true;
      28             :         } else {
      29          95 :             Iterator old_bkp = old_iterator++;
      30          95 :             Iterator new_bkp = new_iterator++;
      31          95 :             list.Update(old_bkp.operator->(), new_bkp.operator->());
      32          95 :             ret = true;
      33             :         }
      34             :     }
      35             : 
      36        2653 :     while (old_iterator != old_last) {
      37          79 :         Iterator bkp = old_iterator++;
      38          79 :         list.Remove(bkp);
      39          79 :         ret = true;
      40             :     }
      41             : 
      42        2653 :     while (new_iterator != new_last) {
      43          79 :         Iterator bkp = new_iterator++;
      44          79 :         list.Insert(bkp.operator->());
      45          79 :         ret = true;
      46             :     }
      47             : 
      48        2574 :     return ret;
      49             : }
      50             : #endif

Generated by: LCOV version 1.14