LCOV - code coverage report
Current view: top level - data/include/mcrl2/data - container_type.h (source / functions) Hit Total Coverage
Test: mcrl2_coverage.info.cleaned Lines: 49 53 92.5 %
Date: 2024-04-17 03:40:49 Functions: 16 18 88.9 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : // Author(s): Jeroen Keiren
       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/container.h
      10             : /// \brief The class container_type.
      11             : 
      12             : #ifndef MCRL2_DATA_CONTAINER_TYPE_H
      13             : #define MCRL2_DATA_CONTAINER_TYPE_H
      14             : 
      15             : #include "mcrl2/core/detail/default_values.h"
      16             : #include "mcrl2/core/detail/soundness_checks.h"
      17             : 
      18             : namespace mcrl2
      19             : {
      20             : 
      21             : namespace data
      22             : {
      23             : 
      24             : //--- start generated classes ---//
      25             : /// \\brief Container type
      26             : class container_type: public atermpp::aterm_appl
      27             : {
      28             :   public:
      29             :     /// \\brief Default constructor.
      30             :     container_type()
      31             :       : atermpp::aterm_appl(core::detail::default_values::SortConsType)
      32             :     {}
      33             : 
      34             :     /// \\brief Constructor.
      35             :     /// \\param term A term
      36     2553172 :     explicit container_type(const atermpp::aterm& term)
      37     2553172 :       : atermpp::aterm_appl(term)
      38             :     {
      39     2553172 :       assert(core::detail::check_rule_SortConsType(*this));
      40     2553172 :     }
      41             : 
      42             :     /// Move semantics
      43             :     container_type(const container_type&) noexcept = default;
      44             :     container_type(container_type&&) noexcept = default;
      45             :     container_type& operator=(const container_type&) noexcept = default;
      46             :     container_type& operator=(container_type&&) noexcept = default;
      47             : };
      48             : 
      49             : /// \\brief list of container_types
      50             : typedef atermpp::term_list<container_type> container_type_list;
      51             : 
      52             : /// \\brief vector of container_types
      53             : typedef std::vector<container_type>    container_type_vector;
      54             : 
      55             : // prototype declaration
      56             : std::string pp(const container_type& x);
      57             : 
      58             : /// \\brief Outputs the object to a stream
      59             : /// \\param out An output stream
      60             : /// \\param x Object x
      61             : /// \\return The output stream
      62             : inline
      63           0 : std::ostream& operator<<(std::ostream& out, const container_type& x)
      64             : {
      65           0 :   return out << data::pp(x);
      66             : }
      67             : 
      68             : /// \\brief swap overload
      69             : inline void swap(container_type& t1, container_type& t2)
      70             : {
      71             :   t1.swap(t2);
      72             : }
      73             : 
      74             : 
      75             : /// \\brief Container type for lists
      76             : class list_container: public container_type
      77             : {
      78             :   public:
      79             :     /// \\brief Default constructor.
      80      241542 :     list_container()
      81      241542 :       : container_type(core::detail::default_values::SortList)
      82      241542 :     {}
      83             : 
      84             :     /// \\brief Constructor.
      85             :     /// \\param term A term
      86        1661 :     explicit list_container(const atermpp::aterm& term)
      87        1661 :       : container_type(term)
      88             :     {
      89        1661 :       assert(core::detail::check_term_SortList(*this));
      90        1661 :     }
      91             : 
      92             :     /// Move semantics
      93             :     list_container(const list_container&) noexcept = default;
      94             :     list_container(list_container&&) noexcept = default;
      95             :     list_container& operator=(const list_container&) noexcept = default;
      96             :     list_container& operator=(list_container&&) noexcept = default;
      97             : };
      98             : 
      99             : /// \\brief Test for a list_container expression
     100             : /// \\param x A term
     101             : /// \\return True if \\a x is a list_container expression
     102             : inline
     103       32757 : bool is_list_container(const atermpp::aterm_appl& x)
     104             : {
     105       32757 :   return x.function() == core::detail::function_symbols::SortList;
     106             : }
     107             : 
     108             : // prototype declaration
     109             : std::string pp(const list_container& x);
     110             : 
     111             : /// \\brief Outputs the object to a stream
     112             : /// \\param out An output stream
     113             : /// \\param x Object x
     114             : /// \\return The output stream
     115             : inline
     116           0 : std::ostream& operator<<(std::ostream& out, const list_container& x)
     117             : {
     118           0 :   return out << data::pp(x);
     119             : }
     120             : 
     121             : /// \\brief swap overload
     122             : inline void swap(list_container& t1, list_container& t2)
     123             : {
     124             :   t1.swap(t2);
     125             : }
     126             : 
     127             : 
     128             : /// \\brief Container type for sets
     129             : class set_container: public container_type
     130             : {
     131             :   public:
     132             :     /// \\brief Default constructor.
     133      169213 :     set_container()
     134      169213 :       : container_type(core::detail::default_values::SortSet)
     135      169213 :     {}
     136             : 
     137             :     /// \\brief Constructor.
     138             :     /// \\param term A term
     139         558 :     explicit set_container(const atermpp::aterm& term)
     140         558 :       : container_type(term)
     141             :     {
     142         558 :       assert(core::detail::check_term_SortSet(*this));
     143         558 :     }
     144             : 
     145             :     /// Move semantics
     146             :     set_container(const set_container&) noexcept = default;
     147             :     set_container(set_container&&) noexcept = default;
     148             :     set_container& operator=(const set_container&) noexcept = default;
     149             :     set_container& operator=(set_container&&) noexcept = default;
     150             : };
     151             : 
     152             : /// \\brief Test for a set_container expression
     153             : /// \\param x A term
     154             : /// \\return True if \\a x is a set_container expression
     155             : inline
     156       26852 : bool is_set_container(const atermpp::aterm_appl& x)
     157             : {
     158       26852 :   return x.function() == core::detail::function_symbols::SortSet;
     159             : }
     160             : 
     161             : // prototype declaration
     162             : std::string pp(const set_container& x);
     163             : 
     164             : /// \\brief Outputs the object to a stream
     165             : /// \\param out An output stream
     166             : /// \\param x Object x
     167             : /// \\return The output stream
     168             : inline
     169             : std::ostream& operator<<(std::ostream& out, const set_container& x)
     170             : {
     171             :   return out << data::pp(x);
     172             : }
     173             : 
     174             : /// \\brief swap overload
     175             : inline void swap(set_container& t1, set_container& t2)
     176             : {
     177             :   t1.swap(t2);
     178             : }
     179             : 
     180             : 
     181             : /// \\brief Container type for bags
     182             : class bag_container: public container_type
     183             : {
     184             :   public:
     185             :     /// \\brief Default constructor.
     186      117116 :     bag_container()
     187      117116 :       : container_type(core::detail::default_values::SortBag)
     188      117116 :     {}
     189             : 
     190             :     /// \\brief Constructor.
     191             :     /// \\param term A term
     192         324 :     explicit bag_container(const atermpp::aterm& term)
     193         324 :       : container_type(term)
     194             :     {
     195         324 :       assert(core::detail::check_term_SortBag(*this));
     196         324 :     }
     197             : 
     198             :     /// Move semantics
     199             :     bag_container(const bag_container&) noexcept = default;
     200             :     bag_container(bag_container&&) noexcept = default;
     201             :     bag_container& operator=(const bag_container&) noexcept = default;
     202             :     bag_container& operator=(bag_container&&) noexcept = default;
     203             : };
     204             : 
     205             : /// \\brief Test for a bag_container expression
     206             : /// \\param x A term
     207             : /// \\return True if \\a x is a bag_container expression
     208             : inline
     209       21231 : bool is_bag_container(const atermpp::aterm_appl& x)
     210             : {
     211       21231 :   return x.function() == core::detail::function_symbols::SortBag;
     212             : }
     213             : 
     214             : // prototype declaration
     215             : std::string pp(const bag_container& x);
     216             : 
     217             : /// \\brief Outputs the object to a stream
     218             : /// \\param out An output stream
     219             : /// \\param x Object x
     220             : /// \\return The output stream
     221             : inline
     222             : std::ostream& operator<<(std::ostream& out, const bag_container& x)
     223             : {
     224             :   return out << data::pp(x);
     225             : }
     226             : 
     227             : /// \\brief swap overload
     228             : inline void swap(bag_container& t1, bag_container& t2)
     229             : {
     230             :   t1.swap(t2);
     231             : }
     232             : 
     233             : 
     234             : /// \\brief Container type for finite sets
     235             : class fset_container: public container_type
     236             : {
     237             :   public:
     238             :     /// \\brief Default constructor.
     239      317494 :     fset_container()
     240      317494 :       : container_type(core::detail::default_values::SortFSet)
     241      317494 :     {}
     242             : 
     243             :     /// \\brief Constructor.
     244             :     /// \\param term A term
     245         704 :     explicit fset_container(const atermpp::aterm& term)
     246         704 :       : container_type(term)
     247             :     {
     248         704 :       assert(core::detail::check_term_SortFSet(*this));
     249         704 :     }
     250             : 
     251             :     /// Move semantics
     252             :     fset_container(const fset_container&) noexcept = default;
     253             :     fset_container(fset_container&&) noexcept = default;
     254             :     fset_container& operator=(const fset_container&) noexcept = default;
     255             :     fset_container& operator=(fset_container&&) noexcept = default;
     256             : };
     257             : 
     258             : /// \\brief Test for a fset_container expression
     259             : /// \\param x A term
     260             : /// \\return True if \\a x is a fset_container expression
     261             : inline
     262       17231 : bool is_fset_container(const atermpp::aterm_appl& x)
     263             : {
     264       17231 :   return x.function() == core::detail::function_symbols::SortFSet;
     265             : }
     266             : 
     267             : // prototype declaration
     268             : std::string pp(const fset_container& x);
     269             : 
     270             : /// \\brief Outputs the object to a stream
     271             : /// \\param out An output stream
     272             : /// \\param x Object x
     273             : /// \\return The output stream
     274             : inline
     275             : std::ostream& operator<<(std::ostream& out, const fset_container& x)
     276             : {
     277             :   return out << data::pp(x);
     278             : }
     279             : 
     280             : /// \\brief swap overload
     281             : inline void swap(fset_container& t1, fset_container& t2)
     282             : {
     283             :   t1.swap(t2);
     284             : }
     285             : 
     286             : 
     287             : /// \\brief Container type for finite bags
     288             : class fbag_container: public container_type
     289             : {
     290             :   public:
     291             :     /// \\brief Default constructor.
     292      217879 :     fbag_container()
     293      217879 :       : container_type(core::detail::default_values::SortFBag)
     294      217879 :     {}
     295             : 
     296             :     /// \\brief Constructor.
     297             :     /// \\param term A term
     298        1409 :     explicit fbag_container(const atermpp::aterm& term)
     299        1409 :       : container_type(term)
     300             :     {
     301        1409 :       assert(core::detail::check_term_SortFBag(*this));
     302        1409 :     }
     303             : 
     304             :     /// Move semantics
     305             :     fbag_container(const fbag_container&) noexcept = default;
     306             :     fbag_container(fbag_container&&) noexcept = default;
     307             :     fbag_container& operator=(const fbag_container&) noexcept = default;
     308             :     fbag_container& operator=(fbag_container&&) noexcept = default;
     309             : };
     310             : 
     311             : /// \\brief Test for a fbag_container expression
     312             : /// \\param x A term
     313             : /// \\return True if \\a x is a fbag_container expression
     314             : inline
     315        8998 : bool is_fbag_container(const atermpp::aterm_appl& x)
     316             : {
     317        8998 :   return x.function() == core::detail::function_symbols::SortFBag;
     318             : }
     319             : 
     320             : // prototype declaration
     321             : std::string pp(const fbag_container& x);
     322             : 
     323             : /// \\brief Outputs the object to a stream
     324             : /// \\param out An output stream
     325             : /// \\param x Object x
     326             : /// \\return The output stream
     327             : inline
     328             : std::ostream& operator<<(std::ostream& out, const fbag_container& x)
     329             : {
     330             :   return out << data::pp(x);
     331             : }
     332             : 
     333             : /// \\brief swap overload
     334             : inline void swap(fbag_container& t1, fbag_container& t2)
     335             : {
     336             :   t1.swap(t2);
     337             : }
     338             : //--- end generated classes ---//
     339             : 
     340             : } // namespace data
     341             : 
     342             : } // namespace mcrl2
     343             : 
     344             : #endif // MCRL2_DATA_CONTAINER_TYPE_H

Generated by: LCOV version 1.14