LCOV - code coverage report
Current view: top level - vnsw/agent/resource_manager - index_resource.h (source / functions) Hit Total Coverage
Test: OpenSDN C/C++ coverage (all TARGET_SET jobs) Lines: 0 3 0.0 %
Date: 2026-11-09 02:10:49 Functions: 0 3 0.0 %
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_index_resource_hpp
       7             : #define vnsw_agent_index_resource_hpp
       8             : 
       9             : #include "resource_manager/index_vector_resource.h"
      10             : #include "resource_cmn.h"
      11             : class ResourceTable;
      12             : class ResourceManager;
      13             : class ResourceKey;
      14             : class ResourceData;
      15             : 
      16             : class IndexResourceKey : public ResourceKey {
      17             : public:
      18             :     IndexResourceKey(ResourceManager *rm, Resource::Type resource_key_type);
      19             :     virtual ~IndexResourceKey();
      20             : 
      21           0 :     virtual const std::string ToString() {return "";}
      22             :     virtual bool IsLess(const ResourceKey &rhs) const = 0;
      23             :     virtual void  Backup(ResourceData *data, uint16_t op) = 0;
      24             : 
      25             : };
      26             : 
      27             : class IndexResourceData : public ResourceData {
      28             : public:
      29             :     //Used by allocation & restore of resource
      30             :     IndexResourceData(ResourceManager *rm,
      31             :                       uint32_t index);
      32             :     virtual ~IndexResourceData();
      33             : 
      34             :     uint32_t index() const;
      35           0 :     virtual const std::string ToString() {return "";}
      36             : private:
      37             :     uint32_t index_;
      38             :     DISALLOW_COPY_AND_ASSIGN(IndexResourceData);
      39             : };
      40             : // This Class is responsible for allocating the unique resource index
      41             : // for each key we are adding to the table.
      42             : class IndexResourceTable : public ResourceTable {
      43             : public:
      44             :     IndexResourceTable(ResourceManager *rm);
      45             :     virtual ~IndexResourceTable();
      46             :     void ReserveIndex(uint32_t index);
      47             :     void ReleaseIndex(uint32_t index);
      48             :     void Release(uint32_t index);
      49             :     virtual ResourceTable::DataPtr AllocateData(ResourceKeyPtr key);
      50           0 :     virtual const std::string ToString() {return "";}
      51             : 
      52             :     uint32_t  AllocateIndex(ResourceKeyPtr key);
      53             :     void RestoreIndex(uint32_t index, ResourceKeyPtr key);
      54             :     void RestoreKey(KeyPtr key, DataPtr data);
      55             :     void ReleaseKey(KeyPtr key, DataPtr data);
      56             : 
      57             : private:
      58             :     IndexVectorResource<ResourceKeyPtr> index_vector_;
      59             :     DISALLOW_COPY_AND_ASSIGN(IndexResourceTable);
      60             : };
      61             : 
      62             : #endif

Generated by: LCOV version 1.14