LCOV - code coverage report
Current view: top level - pbes/include/mcrl2/pbes - io.h (source / functions) Hit Total Coverage
Test: mcrl2_coverage.info.cleaned Lines: 11 12 91.7 %
Date: 2020-09-16 00:45:56 Functions: 4 4 100.0 %
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/pbes/io.h
      10             : /// \brief IO routines for boolean equation systems.
      11             : 
      12             : #ifndef MCRL2_PBES_IO_H
      13             : #define MCRL2_PBES_IO_H
      14             : 
      15             : #include "mcrl2/pbes/pbes.h"
      16             : #include "mcrl2/utilities/file_utility.h"
      17             : 
      18             : namespace mcrl2
      19             : {
      20             : 
      21             : namespace pbes_system
      22             : {
      23             : 
      24             : const std::vector<utilities::file_format>& pbes_file_formats();
      25             : 
      26             : inline
      27           1 : bool is_pbes_file_format(const utilities::file_format& format)
      28             : {
      29           3 :   for (const utilities::file_format& i: pbes_file_formats())
      30             :   {
      31           2 :     if (i == format)
      32             :     {
      33           0 :       return true;
      34             :     }
      35             :   }
      36           1 :   return false;
      37             : }
      38             : 
      39             : inline
      40          15 : const utilities::file_format& pbes_format_internal() { return pbes_file_formats()[0]; }
      41             : inline
      42           4 : const utilities::file_format& pbes_format_text() { return pbes_file_formats()[1]; }
      43             : 
      44             : inline
      45           7 : const utilities::file_format guess_format(const std::string& filename)
      46             : {
      47          15 :   for (const utilities::file_format& it : pbes_file_formats())
      48             :   {
      49          11 :     if (it.matches(filename))
      50             :     {
      51           3 :       return it;
      52             :     }
      53             :   }
      54           4 :   return utilities::file_format();
      55             : }
      56             : 
      57             : /// \brief Save a PBES in the format specified.
      58             : /// \param pbes The PBES to be stored
      59             : /// \param stream The stream to which the output is saved.
      60             : /// \param format Determines the format in which the result is written. If unspecified, or
      61             : ///        pbes_file_unknown is specified, then a default format is chosen.
      62             : void save_pbes(const pbes& pbes,
      63             :                std::ostream& stream,
      64             :                utilities::file_format format = utilities::file_format());
      65             : 
      66             : /// \brief Load a PBES from file.
      67             : /// \param pbes The PBES to which the result is loaded.
      68             : /// \param stream The stream from which to load the PBES.
      69             : /// \param format The format that should be assumed for the file in infilename. If unspecified, or
      70             : ///        pbes_file_unknown is specified, then a default format is chosen.
      71             : /// \param source The source from which the stream originates. Used for error messages.
      72             : void load_pbes(pbes& pbes, std::istream& stream, utilities::file_format format, const std::string& source = "");
      73             : 
      74             : /// \brief save_pbes Saves a PBES to a file.
      75             : /// \param pbes The PBES to save.
      76             : /// \param filename The file to save the PBES in.
      77             : /// \param format The format in which to save the PBES.
      78             : /// \param welltypedness_check If set to false, skips checking whether pbes is well typed before
      79             : ///                            saving it to file.
      80             : ///
      81             : /// The format of the file in infilename is guessed if format is not given or if it is equal to
      82             : /// utilities::file_format().
      83             : void save_pbes(const pbes& pbes, const std::string& filename,
      84             :                utilities::file_format format = utilities::file_format(),
      85             :                bool welltypedness_check = true);
      86             : 
      87             : /// \brief Load pbes from file.
      88             : /// \param pbes The pbes to which the result is loaded.
      89             : /// \param filename The file from which to load the PBES.
      90             : /// \param format The format in which the PBES is stored in the file.
      91             : ///
      92             : /// The format of the file in infilename is guessed if format is not given or if it is equal to
      93             : /// utilities::file_format().
      94             : void load_pbes(pbes& pbes,
      95             :                const std::string& filename,
      96             :                utilities::file_format format = utilities::file_format());
      97             : 
      98             : } // namespace pbes_system
      99             : 
     100             : } // namespace mcrl2
     101             : 
     102             : #endif // MCRL2_PBES_IO_H

Generated by: LCOV version 1.13