LCOV - code coverage report
Current view: top level - lps/include/mcrl2/lps - stochastic_distribution.h (source / functions) Hit Total Coverage
Test: mcrl2_coverage.info.cleaned Lines: 25 25 100.0 %
Date: 2024-04-26 03:18:02 Functions: 15 22 68.2 %
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/lps/stochastic_distribution.h
      10             : /// \brief add your file description here.
      11             : 
      12             : #ifndef MCRL2_LPS_STOCHASTIC_DISTRIBUTION_H
      13             : #define MCRL2_LPS_STOCHASTIC_DISTRIBUTION_H
      14             : 
      15             : #include "mcrl2/data/variable.h"
      16             : 
      17             : namespace mcrl2 {
      18             : 
      19             : namespace lps {
      20             : 
      21             : //--- start generated class stochastic_distribution ---//
      22             : /// \\brief A stochastic distribution
      23             : class stochastic_distribution: public atermpp::aterm_appl
      24             : {
      25             :   public:
      26             :     /// \\brief Default constructor.
      27       11045 :     stochastic_distribution()
      28       11045 :       : atermpp::aterm_appl(core::detail::default_values::Distribution)
      29       11045 :     {}
      30             : 
      31             :     /// \\brief Constructor.
      32             :     /// \\param term A term
      33       25705 :     explicit stochastic_distribution(const atermpp::aterm& term)
      34       25705 :       : atermpp::aterm_appl(term)
      35             :     {
      36       25705 :       assert(core::detail::check_term_Distribution(*this));
      37       25705 :     }
      38             : 
      39             :     /// \\brief Constructor.
      40       29736 :     stochastic_distribution(const data::variable_list& variables, const data::data_expression& distribution)
      41       29736 :       : atermpp::aterm_appl(core::detail::function_symbol_Distribution(), variables, distribution)
      42       29736 :     {}
      43             : 
      44             :     /// Move semantics
      45       67758 :     stochastic_distribution(const stochastic_distribution&) noexcept = default;
      46       69780 :     stochastic_distribution(stochastic_distribution&&) noexcept = default;
      47       11227 :     stochastic_distribution& operator=(const stochastic_distribution&) noexcept = default;
      48        9630 :     stochastic_distribution& operator=(stochastic_distribution&&) noexcept = default;
      49             : 
      50       96785 :     const data::variable_list& variables() const
      51             :     {
      52       96785 :       return atermpp::down_cast<data::variable_list>((*this)[0]);
      53             :     }
      54             : 
      55       35064 :     const data::data_expression& distribution() const
      56             :     {
      57       35064 :       return atermpp::down_cast<data::data_expression>((*this)[1]);
      58             :     }
      59             : //--- start user section stochastic_distribution ---//
      60             :     /// \brief Returns true if the distribution is defined, i.e. it contains a valid distribution.
      61             :     /// This is encoded by a non-empty list of variables.
      62       36985 :     bool is_defined() const
      63             :     {
      64       36985 :       return !variables().empty();
      65             :     }
      66             : //--- end user section stochastic_distribution ---//
      67             : };
      68             : 
      69             : /// \\brief Make_stochastic_distribution constructs a new term into a given address.
      70             : /// \\ \param t The reference into which the new stochastic_distribution is constructed. 
      71             : template <class... ARGUMENTS>
      72         319 : inline void make_stochastic_distribution(atermpp::aterm_appl& t, const ARGUMENTS&... args)
      73             : {
      74         319 :   atermpp::make_term_appl(t, core::detail::function_symbol_Distribution(), args...);
      75         319 : }
      76             : 
      77             : /// \\brief list of stochastic_distributions
      78             : typedef atermpp::term_list<stochastic_distribution> stochastic_distribution_list;
      79             : 
      80             : /// \\brief vector of stochastic_distributions
      81             : typedef std::vector<stochastic_distribution>    stochastic_distribution_vector;
      82             : 
      83             : /// \\brief Test for a stochastic_distribution expression
      84             : /// \\param x A term
      85             : /// \\return True if \\a x is a stochastic_distribution expression
      86             : inline
      87             : bool is_stochastic_distribution(const atermpp::aterm_appl& x)
      88             : {
      89             :   return x.function() == core::detail::function_symbols::Distribution;
      90             : }
      91             : 
      92             : // prototype declaration
      93             : std::string pp(const stochastic_distribution& x);
      94             : 
      95             : /// \\brief Outputs the object to a stream
      96             : /// \\param out An output stream
      97             : /// \\param x Object x
      98             : /// \\return The output stream
      99             : inline
     100           1 : std::ostream& operator<<(std::ostream& out, const stochastic_distribution& x)
     101             : {
     102           1 :   return out << lps::pp(x);
     103             : }
     104             : 
     105             : /// \\brief swap overload
     106             : inline void swap(stochastic_distribution& t1, stochastic_distribution& t2)
     107             : {
     108             :   t1.swap(t2);
     109             : }
     110             : //--- end generated class stochastic_distribution ---//
     111             : 
     112             : } // namespace lps
     113             : 
     114             : } // namespace mcrl2
     115             : 
     116             : #endif // MCRL2_LPS_STOCHASTIC_DISTRIBUTION_H

Generated by: LCOV version 1.14