LCOV - code coverage report
Current view: top level - data/include/mcrl2/data - untyped_data_specification.h (source / functions) Hit Total Coverage
Test: mcrl2_coverage.info.cleaned Lines: 18 19 94.7 %
Date: 2024-03-08 02:52:28 Functions: 6 6 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : // Author(s): Wieger Wesselink
       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/data/untyped_data_specification.h
      10             : /// \brief add your file description here.
      11             : 
      12             : #ifndef MCRL2_DATA_UNTYPED_DATA_SPECIFICATION_H
      13             : #define MCRL2_DATA_UNTYPED_DATA_SPECIFICATION_H
      14             : 
      15             : #include "mcrl2/data/data_specification.h"
      16             : 
      17             : namespace mcrl2 {
      18             : 
      19             : namespace data {
      20             : 
      21             : struct untyped_data_specification
      22             : {
      23             :   std::vector<basic_sort> basic_sorts;
      24             :   std::vector<alias> aliases;
      25             :   std::vector<function_symbol> constructors;
      26             :   std::vector<function_symbol> mappings;
      27             :   std::vector<data_equation> equations;
      28             : 
      29          72 :   void add_sort(const basic_sort& x) { basic_sorts.push_back(x); }
      30         544 :   void add_alias(const alias& x) { aliases.push_back(x); }
      31          45 :   void add_constructor(const function_symbol& x) { constructors.push_back(x); }
      32         511 :   void add_mapping(const function_symbol& x) { mappings.push_back(x); }
      33         548 :   void add_equation(const data_equation& x) { equations.push_back(x); }
      34             : 
      35        1785 :   data_specification construct_data_specification() const
      36             :   {
      37        1785 :     data_specification dataspec;
      38        1857 :     for (const basic_sort& x: basic_sorts)
      39             :     {
      40          72 :       dataspec.add_sort(x);
      41             :     }
      42        2329 :     for (const alias& x: aliases)
      43             :     {
      44         544 :       dataspec.add_alias(x);
      45             :     }
      46        1830 :     for (const function_symbol& x: constructors)
      47             :     {
      48          45 :       dataspec.add_constructor(x);
      49             :     }
      50        2296 :     for (const function_symbol& x: mappings)
      51             :     {
      52         511 :       dataspec.add_mapping(x);
      53             :     }
      54        2333 :     for (const data_equation& x: equations)
      55             :     {
      56         548 :       dataspec.add_equation(x);
      57             :     }
      58        1785 :     return dataspec;
      59           0 :   }
      60             : };
      61             : 
      62             : } // namespace data
      63             : 
      64             : } // namespace mcrl2
      65             : 
      66             : #endif // MCRL2_DATA_UNTYPED_DATA_SPECIFICATION_H

Generated by: LCOV version 1.14