LCOV - code coverage report
Current view: top level - ksync - ksync_index.h (source / functions) Hit Total Coverage
Test: OpenSDN C/C++ coverage (all TARGET_SET jobs) Lines: 17 17 100.0 %
Date: 2026-06-22 02:21:21 Functions: 5 5 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :  * Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
       3             :  */
       4             : 
       5             : #ifndef ctrlplane_ksync_index_table_h
       6             : #define ctrlplane_ksync_index_table_h
       7             : 
       8             : #include <boost/dynamic_bitset.hpp>
       9             : 
      10             : class KSyncIndexTable {
      11             : public:
      12          28 :     KSyncIndexTable() { };
      13             : 
      14           7 :     KSyncIndexTable(unsigned int count) : table_(count) {
      15           7 :         table_.set();
      16           7 :     };
      17             : 
      18          35 :     ~KSyncIndexTable() {
      19             :         //assert(table_.count() == table_.size());
      20          35 :         table_.clear();
      21          35 :     };
      22             : 
      23         413 :     size_t Alloc() {
      24         413 :         size_t index = table_.find_first();
      25         413 :         assert(index != table_.npos);
      26         413 :         table_.set(index, 0);
      27         413 :         return index;
      28             :     };
      29             : 
      30         412 :     void Free(size_t index) {
      31         412 :         assert(index < table_.size());
      32         412 :         assert(table_[index] == 0);
      33         412 :         table_.set(index);
      34         412 :     };
      35             : 
      36             : private:
      37             :     typedef boost::dynamic_bitset<> Bitmap;
      38             :     Bitmap  table_;
      39             : };
      40             : 
      41             : #endif // ctrlplane_ksync_index_table_h

Generated by: LCOV version 1.14