LCOV - code coverage report
Current view: top level - pbes/include/mcrl2/pbes/tools - pbespp.h (source / functions) Hit Total Coverage
Test: mcrl2_coverage.info.cleaned Lines: 0 23 0.0 %
Date: 2020-02-13 00:44:47 Functions: 0 1 0.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/pbes/tools/pbespp.h
      10             : /// \brief add your file description here.
      11             : 
      12             : #ifndef MCRL2_PBES_TOOLS_PBESPP_H
      13             : #define MCRL2_PBES_TOOLS_PBESPP_H
      14             : 
      15             : #include "mcrl2/pbes/io.h"
      16             : #include "mcrl2/pbes/detail/pfnf_print.h"
      17             : 
      18             : namespace mcrl2 {
      19             : 
      20             : namespace pbes_system {
      21             : 
      22           0 : void pbespp(const std::string& input_filename,
      23             :             const std::string& output_filename,
      24             :             const utilities::file_format& input_format,
      25             :             core::print_format_type format,
      26             :             bool use_pfnf_printer
      27             :            )
      28             : {
      29           0 :   pbes p;
      30           0 :   load_pbes(p, input_filename, input_format);
      31             : 
      32           0 :   mCRL2log(log::verbose) << "printing PBES from "
      33           0 :                          << (input_filename.empty()?"standard input":input_filename)
      34           0 :                          << " to " << (output_filename.empty()?"standard output":output_filename)
      35           0 :                          << " in the " << core::pp_format_to_string(format) << " format" << std::endl;
      36             : 
      37           0 :   if (output_filename.empty())
      38             :   {
      39           0 :     if (format == core::print_internal)
      40             :     {
      41           0 :       std::cout << pbes_to_aterm(p);
      42             :     }
      43           0 :     else if(use_pfnf_printer && detail::is_pfnf(p))
      44             :     {
      45           0 :       std::cout << pfnf_pp(p);
      46             :     }
      47             :     else
      48             :     {
      49           0 :       std::cout << pp(p);
      50             :     }
      51             :   }
      52             :   else
      53             :   {
      54           0 :     std::ofstream out(output_filename.c_str());
      55           0 :     if (out)
      56             :     {
      57           0 :       if (format == core::print_internal)
      58             :       {
      59           0 :         out << pbes_to_aterm(p);
      60             :       }
      61           0 :       else if(use_pfnf_printer && detail::is_pfnf(p))
      62             :       {
      63           0 :         out << pfnf_pp(p);
      64             :       }
      65             :       else
      66             :       {
      67           0 :         out << pp(p);
      68             :       }
      69           0 :       out.close();
      70             :     }
      71             :     else
      72             :     {
      73           0 :       throw mcrl2::runtime_error("could not open output file " + output_filename + " for writing");
      74             :     }
      75             :   }
      76           0 : }
      77             : 
      78             : } // namespace pbes_system
      79             : 
      80             : } // namespace mcrl2
      81             : 
      82             : #endif // MCRL2_PBES_TOOLS_PBESPP_H

Generated by: LCOV version 1.13