LCOV - code coverage report
Current view: top level - bes/include/mcrl2/bes - io.h (source / functions) Hit Total Coverage
Test: mcrl2_coverage.info.cleaned Lines: 5 7 71.4 %
Date: 2020-10-20 00:45:57 Functions: 2 3 66.7 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : // Author(s): anonymous
       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/bes/io.h
      10             : /// \brief add your file description here.
      11             : 
      12             : #ifndef MCRL2_BES_IO_H
      13             : #define MCRL2_BES_IO_H
      14             : 
      15             : #include "mcrl2/bes/boolean_equation_system.h"
      16             : #include "mcrl2/utilities/file_utility.h"
      17             : #include "mcrl2/pbes/pbes.h"
      18             : 
      19             : namespace mcrl2
      20             : {
      21             : 
      22             : namespace bes
      23             : {
      24             : 
      25             : const std::vector<utilities::file_format>& bes_file_formats();
      26             : 
      27             : inline
      28           8 : const utilities::file_format& bes_format_internal() { return bes_file_formats()[0]; }
      29             : inline
      30           0 : const utilities::file_format& bes_format_pgsolver() { return bes_file_formats()[1]; }
      31             : 
      32             : inline
      33           2 : utilities::file_format guess_format(const std::string& filename)
      34             : {
      35           6 :   for (const utilities::file_format& fmt: bes_file_formats())
      36             :   {
      37           4 :     if (fmt.matches(filename))
      38             :     {
      39           0 :       return fmt;
      40             :     }
      41             :   }
      42           2 :   return utilities::file_format();
      43             : }
      44             : 
      45             : // Implemented in pgsolver.cpp
      46             : void save_bes_pgsolver(const boolean_equation_system& bes, std::ostream& stream, bool maxpg=true);
      47             : 
      48             : /// \brief Save a BES in the format specified.
      49             : /// \param bes The bes to be stored
      50             : /// \param stream The name of the file to which the output is stored.
      51             : /// \param format Determines the format in which the result is written.
      52             : void save_bes(const boolean_equation_system& bes,
      53             :               std::ostream& stream,
      54             :               utilities::file_format format);
      55             : 
      56             : /// \brief Load bes from a stream.
      57             : /// \param bes The bes to which the result is loaded.
      58             : /// \param stream The file from which to load the BES.
      59             : /// \param format The format that should be assumed for the stream.
      60             : /// \param source The source from which the stream originates. Used for error messages.
      61             : void load_bes(boolean_equation_system& bes, std::istream& stream, utilities::file_format format, const std::string& source = "");
      62             : 
      63             : ///
      64             : /// \brief save_bes Saves a BES to a file.
      65             : /// \param bes The BES to save.
      66             : /// \param filename The file to save the BES in.
      67             : /// \param format The format in which to save the BES.
      68             : ///
      69             : void save_bes(const boolean_equation_system& bes,
      70             :               const std::string& filename,
      71             :               utilities::file_format format = utilities::file_format());
      72             : 
      73             : /// \brief Loads a BES from a file.
      74             : /// \param bes The object in which the result is stored.
      75             : /// \param filename The file from which to load the BES.
      76             : /// \param format An indication of the file format. If this is file_format() the
      77             : ///        format of the file in infilename is guessed.
      78             : void load_bes(boolean_equation_system& bes,
      79             :               const std::string& filename,
      80             :               utilities::file_format format = utilities::file_format());
      81             : 
      82             : /// \brief Loads a PBES from a file. If the file stores a BES, then it is converted to a PBES.
      83             : /// \param pbes The object in which the result is stored.
      84             : /// \param filename The file from which to load the PBES.
      85             : /// \param format An indication of the file format. If this is file_format() the
      86             : ///        format of the file in infilename is guessed.
      87             : void load_pbes(pbes_system::pbes& pbes,
      88             :                const std::string& filename,
      89             :                utilities::file_format format = utilities::file_format());
      90             : 
      91             : /// \brief Saves a PBES to a stream. If the PBES is not a BES and a BES file format is requested, an
      92             : ///        exception is thrown.
      93             : /// \param pbes The object in which the PBES is stored.
      94             : /// \param stream The stream which to save the PBES to.
      95             : /// \param format The file format to store the PBES in.
      96             : ///
      97             : /// This function converts the pbes_system::pbes to a boolean_equation_system if the requested file
      98             : /// format does not provide a save routine for pbes_system::pbes structures.
      99             : void save_pbes(const pbes_system::pbes& pbes,
     100             :                std::ostream& stream,
     101             :                const utilities::file_format& format = utilities::file_format());
     102             : 
     103             : /// \brief Saves a PBES to a file. If the PBES is not a BES and a BES file format is requested, an
     104             : ///        exception is thrown.
     105             : /// \param pbes The object in which the PBES is stored.
     106             : /// \param filename The file which to save the PBES to.
     107             : /// \param format The file format to store the PBES in.
     108             : ///
     109             : /// The format of the file in infilename is guessed.
     110             : void save_pbes(const pbes_system::pbes& pbes,
     111             :                const std::string& filename,
     112             :                utilities::file_format format = utilities::file_format());
     113             : 
     114             : /// \brief Writes the bes to a stream.
     115             : atermpp::aterm_ostream& operator<<(atermpp::aterm_ostream& stream, const boolean_equation_system& bes);
     116             : 
     117             : /// \brief Reads the bes from a stream.
     118             : atermpp::aterm_istream& operator>>(atermpp::aterm_istream& stream, boolean_equation_system& bes);
     119             : 
     120             : } // namespace bes
     121             : 
     122             : } // namespace mcrl2
     123             : 
     124             : #endif // MCRL2_BES_IO_H

Generated by: LCOV version 1.13