LCOV - code coverage report
Current view: top level - core/include/mcrl2/core - identifier_string.h (source / functions) Hit Total Coverage
Test: mcrl2_coverage.info.cleaned Lines: 4 6 66.7 %
Date: 2024-04-21 03:44:01 Functions: 2 3 66.7 %
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/core/identifier_string.h
      10             : /// \brief aterm representations of identifier strings.
      11             : 
      12             : #ifndef MCRL2_CORE_IDENTIFIER_STRING_H
      13             : #define MCRL2_CORE_IDENTIFIER_STRING_H
      14             : 
      15             : #include "mcrl2/atermpp/aterm_string.h"
      16             : #include "mcrl2/core/detail/function_symbols.h"
      17             : 
      18             : namespace mcrl2
      19             : {
      20             : 
      21             : namespace core
      22             : {
      23             : 
      24             : /// \brief String type of the LPS library.
      25             : /// Identifier strings are represented internally as ATerms.
      26             : typedef atermpp::aterm_string identifier_string;
      27             : 
      28             : //--- start generated class identifier_string ---//
      29             : /// \\brief list of identifier_strings
      30             : typedef atermpp::term_list<identifier_string> identifier_string_list;
      31             : 
      32             : /// \\brief vector of identifier_strings
      33             : typedef std::vector<identifier_string>    identifier_string_vector;
      34             : 
      35             : // prototype declaration
      36             : std::string pp(const identifier_string& x);
      37             : 
      38             : /// \\brief Outputs the object to a stream
      39             : /// \\param out An output stream
      40             : /// \\param x Object x
      41             : /// \\return The output stream
      42             : inline
      43           0 : std::ostream& operator<<(std::ostream& out, const identifier_string& x)
      44             : {
      45           0 :   return out << core::pp(x);
      46             : }
      47             : 
      48             : /// \\brief swap overload
      49             : inline void swap(identifier_string& t1, identifier_string& t2)
      50             : {
      51             :   t1.swap(t2);
      52             : }
      53             : //--- end generated class identifier_string ---//
      54             : 
      55             : /// \brief Tests if a term is an identifier string.
      56             : /// \param[in] t A term
      57             : /// \return Whether t is an identifier string.
      58             : inline
      59             : bool is_identifier_string(const atermpp::aterm& t)
      60             : {
      61             :   return t.type_is_appl() && atermpp::down_cast<atermpp::aterm_appl>(t).size() == 0;
      62             : }
      63             : 
      64             : /// \brief Provides the empty identifier string.
      65             : /// \return The empty identifier string. 
      66             : inline
      67       34875 : identifier_string empty_identifier_string()
      68             : {
      69       34875 :   return atermpp::empty_string();
      70             : }
      71             : 
      72             : } // namespace core
      73             : 
      74             : } // namespace mcrl2
      75             : 
      76             : 
      77             : namespace std {
      78             : 
      79             : /// \brief hash specialization
      80             : template<>
      81             : struct hash<mcrl2::core::identifier_string>
      82             : {
      83    19772110 :   std::size_t operator()(const mcrl2::core::identifier_string& x) const
      84             :   {
      85    19772110 :     return std::hash<atermpp::aterm>()(static_cast<const atermpp::aterm&>(x));
      86             :   }
      87             : };
      88             : 
      89             : } // namespace std
      90             : 
      91             : #endif // MCRL2_CORE_IDENTIFIER_STRING_H

Generated by: LCOV version 1.14