LCOV - code coverage report
Current view: top level - root/contrail/src/contrail-common/base - index_allocator.h (source / functions) Hit Total Coverage
Test: OpenSDN C/C++ coverage (all TARGET_SET jobs) Lines: 2 2 100.0 %
Date: 2026-08-03 02:19:58 Functions: 1 1 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :  * Copyright (c) 2016 Juniper Networks, Inc. All rights reserved.
       3             :  */
       4             : 
       5             : #ifndef ctrlplane_index_allocator_h
       6             : #define ctrlplane_index_allocator_h
       7             : 
       8             : #include <assert.h>
       9             : #include <inttypes.h>
      10             : #include <string>
      11             : #include <vector>
      12             : #include <base/bitset.h>
      13             : 
      14             : class IndexAllocator {
      15             : public:
      16          17 :     IndexAllocator(size_t max_index)
      17          17 :         : max_index_(max_index), last_index_(BitSet::npos) { }
      18             : 
      19             :     size_t AllocIndex();
      20             :     void FreeIndex(size_t index);
      21             :     bool NoneIndexSet();
      22             :     bool AnyIndexSet();
      23             : 
      24             : private:
      25             :     BitSet bitset_;
      26             :     size_t max_index_;
      27             :     size_t last_index_;
      28             : };
      29             : 
      30             : #endif

Generated by: LCOV version 1.14