LCOV - code coverage report
Current view: top level - protocols/bdx - BdxTransferDiagnosticLogPool.h (source / functions) Hit Total Coverage
Test: lcov_final.info Lines: 0 5 0.0 %
Date: 2024-02-15 08:20:41 Functions: 0 6 0.0 %

          Line data    Source code
       1             : /*
       2             :  *
       3             :  *    Copyright (c) 2024 Project CHIP Authors
       4             :  *    All rights reserved.
       5             :  *
       6             :  *    Licensed under the Apache License, Version 2.0 (the "License");
       7             :  *    you may not use this file except in compliance with the License.
       8             :  *    You may obtain a copy of the License at
       9             :  *
      10             :  *        http://www.apache.org/licenses/LICENSE-2.0
      11             :  *
      12             :  *    Unless required by applicable law or agreed to in writing, software
      13             :  *    distributed under the License is distributed on an "AS IS" BASIS,
      14             :  *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      15             :  *    See the License for the specific language governing permissions and
      16             :  *    limitations under the License.
      17             :  */
      18             : 
      19             : #pragma once
      20             : 
      21             : #include <lib/support/Pool.h>
      22             : #include <protocols/bdx/BdxTransferServerDelegate.h>
      23             : #include <system/SystemLayer.h>
      24             : 
      25             : namespace chip {
      26             : namespace bdx {
      27             : 
      28             : class BdxTransferDiagnosticLog;
      29             : 
      30             : class BdxTransferDiagnosticLogPoolDelegate
      31             : {
      32             : public:
      33           0 :     virtual ~BdxTransferDiagnosticLogPoolDelegate() {}
      34             : 
      35             :     virtual BdxTransferDiagnosticLog * Allocate(BDXTransferServerDelegate * delegate, System::Layer * systemLayer) = 0;
      36             : 
      37             :     virtual void Release(BdxTransferDiagnosticLog * client) = 0;
      38             : };
      39             : 
      40             : template <size_t N>
      41             : class BdxTransferDiagnosticLogPool : public BdxTransferDiagnosticLogPoolDelegate
      42             : {
      43             : public:
      44           0 :     ~BdxTransferDiagnosticLogPool() override { mTransferPool.ReleaseAll(); }
      45             : 
      46           0 :     BdxTransferDiagnosticLog * Allocate(BDXTransferServerDelegate * delegate, System::Layer * systemLayer) override
      47             :     {
      48           0 :         return mTransferPool.CreateObject(delegate, this, systemLayer);
      49             :     }
      50             : 
      51           0 :     void Release(BdxTransferDiagnosticLog * transfer) override { mTransferPool.ReleaseObject(transfer); }
      52             : 
      53             : private:
      54             :     ObjectPool<BdxTransferDiagnosticLog, N> mTransferPool;
      55             : };
      56             : 
      57             : } // namespace bdx
      58             : } // namespace chip

Generated by: LCOV version 1.14