LCOV - code coverage report
Current view: top level - core/include/mcrl2/core/detail - construction_utility.h (source / functions) Hit Total Coverage
Test: mcrl2_coverage.info.cleaned Lines: 7 7 100.0 %
Date: 2019-06-26 00:32:26 Functions: 35 35 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : // Author(s): Jeroen  van der Wulp
       2             : // Copyright: see the accompanying file COPYING or copy at
       3             : // https://github.com/mCRL2org/mCRL2/blob/master/COPYING
       4             : //
       5             : // Distributed under the Boost Software License, Version 1.0.
       6             : // (See accompanying file LICENSE_1_0.txt or copy at
       7             : // http://www.boost.org/LICENSE_1_0.txt)
       8             : //
       9             : /// \file mcrl2/core/construction_utility.h
      10             : /// \brief construction utility
      11             : 
      12             : #ifndef MCRL2_CORE_DETAIL_CONSTRUCTION_UTILITY_H
      13             : #define MCRL2_CORE_DETAIL_CONSTRUCTION_UTILITY_H
      14             : 
      15             : #include "mcrl2/atermpp/aterm_appl.h"
      16             : #include "mcrl2/core/identifier_string.h"
      17             : 
      18             : namespace mcrl2
      19             : {
      20             : namespace core
      21             : {
      22             : namespace detail
      23             : {
      24             : 
      25             : // Component that helps applying the Singleton design pattern
      26             : template < typename Derived, typename Expression = atermpp::aterm_appl >
      27     2664669 : struct singleton_expression : public Expression
      28             : {
      29     2664669 :   static Expression const& instance()
      30             :   {
      31     2664669 :     static Expression single_instance = Expression(Derived::initialise());
      32             : 
      33     2664669 :     return single_instance;
      34             :   }
      35             : 
      36     2664669 :   singleton_expression() : Expression(instance())
      37     2664669 :   { }
      38             : };
      39             : 
      40             : template < typename Derived >
      41     5329338 : struct singleton_identifier : public singleton_expression< Derived, core::identifier_string >
      42             :   {};
      43             : 
      44             : } // namespace detail
      45             : } // namespace core
      46             : } // namespace mcrl2
      47             : 
      48             : 
      49             : #endif
      50             : 

Generated by: LCOV version 1.12