LCOV - code coverage report
Current view: top level - source/common/singleton - const_singleton.h (source / functions) Hit Total Coverage
Test: coverage.dat Lines: 4 4 100.0 %
Date: 2024-01-05 06:35:25 Functions: 55 111 49.5 %

          Line data    Source code
       1             : #pragma once
       2             : 
       3             : namespace Envoy {
       4             : 
       5             : /**
       6             :  * ConstSingleton allows easy global cross-thread access to a const object.
       7             :  *
       8             :  * This singleton should be used for data which is initialized once at
       9             :  * start-up and then be treated as immutable const data thereafter.
      10             :  */
      11             : template <class T> class ConstSingleton {
      12             : public:
      13             :   /**
      14             :    * Obtain an instance of the singleton for class T.
      15             :    * @return const T& a reference to the singleton for class T.
      16             :    */
      17      700306 :   static const T& get() {
      18      700306 :     static T* instance = new T();
      19      700306 :     return *instance;
      20      700306 :   }
      21             : };
      22             : 
      23             : } // namespace Envoy

Generated by: LCOV version 1.15