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-11 01:56:02 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         150 :     KSyncIndexTable() { };
      13             : 
      14           7 :     KSyncIndexTable(unsigned int count) : table_(count) {
      15           7 :         table_.set();
      16           7 :     };
      17             : 
      18         157 :     ~KSyncIndexTable() {
      19             :         //assert(table_.count() == table_.size());
      20         157 :         table_.clear();
      21         157 :     };
      22             : 
      23         409 :     size_t Alloc() {
      24         409 :         size_t index = table_.find_first();
      25         409 :         assert(index != table_.npos);
      26         409 :         table_.set(index, 0);
      27         409 :         return index;
      28             :     };
      29             : 
      30         408 :     void Free(size_t index) {
      31         408 :         assert(index < table_.size());
      32         408 :         assert(table_[index] == 0);
      33         408 :         table_.set(index);
      34         408 :     };
      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