LCOV - code coverage report
Current view: top level - adcore/common - singleton.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 5 5
Test Date: 2026-08-12 11:04:53 Functions: 75.0 % 36 27

            Line data    Source code
       1              : /**
       2              :  * Copyright (c) 2025 Huawei Technologies Co., Ltd.
       3              :  * This program is free software, you can redistribute it and/or modify it under the terms and conditions of
       4              :  * CANN Open Software License Agreement Version 2.0 (the "License").
       5              :  * Please refer to the License for details. You may not use this file except in compliance with the License.
       6              :  * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
       7              :  * INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
       8              :  * See LICENSE in the root of the software repository for the full text of the License.
       9              :  */
      10              : 
      11              : #ifndef ADX_COMMON_SINGLETON_SINGLETON_H
      12              : #define ADX_COMMON_SINGLETON_SINGLETON_H
      13              : 
      14              : namespace Adx {
      15              : namespace Common {
      16              : namespace Singleton {
      17              : template <class T>
      18              : class Singleton {
      19              : public:
      20         1918 :     static T& Instance()
      21              :     {
      22         1918 :         static T instance;
      23         1918 :         return instance;
      24              :     }
      25           25 :     virtual ~Singleton() {}                          // dtor hidden
      26              :     Singleton(Singleton const&) = delete;            // copy ctor hidden
      27              :     Singleton& operator=(Singleton const&) = delete; // assign op. hidden
      28              : protected:
      29           25 :     Singleton() {}                                   // ctor hidden
      30              : };
      31              : } // namespace Singleton
      32              : } // namespace Common
      33              : } // namespace Adx
      34              : 
      35              : #endif
        

Generated by: LCOV version 2.0-1