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-11-09 02:10:49 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             :  * Copyright Contributors to the OpenSDN project
       4             :  */
       5             : 
       6             : #ifndef vnsw_agent_audit_list_hpp
       7             : #define vnsw_agent_audit_list_hpp
       8             : 
       9             : /////////////////////////////////////////////////////////////////////////////
      10             : // Template function to audit two lists. This is used to synchronize the
      11             : // operational and config list for Floating-IP, Service-Vlans, Static Routes
      12             : // and SG List
      13             : /////////////////////////////////////////////////////////////////////////////
      14             : template<class List, class Iterator>
      15       17251 : bool AuditList(List &list, Iterator old_first, Iterator old_last,
      16             :                Iterator new_first, Iterator new_last) {
      17       17251 :     bool ret = false;
      18       17251 :     Iterator old_iterator = old_first;
      19       17251 :     Iterator new_iterator = new_first;
      20       18173 :     while (old_iterator != old_last && new_iterator != new_last) {
      21         922 :         if (old_iterator->IsLess(new_iterator.operator->())) {
      22           0 :             Iterator bkp = old_iterator++;
      23           0 :             list.Remove(bkp);
      24           0 :             ret = true;
      25         922 :         } else if (new_iterator->IsLess(old_iterator.operator->())) {
      26           0 :             Iterator bkp = new_iterator++;
      27           0 :             list.Insert(bkp.operator->());
      28           0 :             ret = true;
      29             :         } else {
      30         922 :             Iterator old_bkp = old_iterator++;
      31         922 :             Iterator new_bkp = new_iterator++;
      32         922 :             list.Update(old_bkp.operator->(), new_bkp.operator->());
      33         922 :             ret = true;
      34             :         }
      35             :     }
      36             : 
      37       17558 :     while (old_iterator != old_last) {
      38         307 :         Iterator bkp = old_iterator++;
      39         307 :         list.Remove(bkp);
      40         307 :         ret = true;
      41             :     }
      42             : 
      43       17558 :     while (new_iterator != new_last) {
      44         307 :         Iterator bkp = new_iterator++;
      45         307 :         list.Insert(bkp.operator->());
      46         307 :         ret = true;
      47             :     }
      48             : 
      49       17251 :     return ret;
      50             : }
      51             : #endif

Generated by: LCOV version 1.14