19#ifndef MCRL2_LTS_LTS_IO_H
20#define MCRL2_LTS_LTS_IO_H
45lts_type guess_format(std::string
const& s,
const bool be_verbose=
true);
57lts_type parse_format(std::string
const& s);
63std::string string_for_type(
const lts_type type);
69std::string extension_for_type(
const lts_type type);
75std::string mime_type_for_type(
const lts_type type);
79const std::set<lts_type>& supported_lts_formats();
89std::string supported_lts_formats_text(lts_type default_format = lts_none,
const std::set<lts_type>& supported = supported_lts_formats());
97std::string supported_lts_formats_text(
const std::set<lts_type>& supported);
105std::string lts_extensions_as_string(
const std::string& sep =
",",
const std::set<lts_type>& supported = supported_lts_formats());
112std::string lts_extensions_as_string(
const std::set<lts_type>& supported);
137 data=procspec.
data();
147 data = procspec.
data();
152template <
class LTS_TYPE_IN,
class LTS_TYPE_OUT>
156 const std::string& extra_data_file_name)
158 std::string data_file;
162 bool extra_data_is_defined=
true;
163 switch (extra_data_file_type)
172 read_lps_context(extra_data_file_name,data,action_labels,process_parameters);
182 extra_data_is_defined =
false;
183 mCRL2log(
log::info) <<
"No data and action label specification is provided. Only the standard data types and no action labels can be used." << std::endl;
break;
186 lts_convert(src, dest, data, action_labels, process_parameters, extra_data_is_defined);
201template <
class LTS_TYPE>
203 const std::string& infilename,
206 const std::string& extra_data_file_name=
"")
213 if (extra_data_file_type !=
none_e)
215 mCRL2log(
log::warning) <<
"The lts file comes with a data specification. Ignoring the extra data and action label specification provided." << std::endl;
217 result.load(infilename);
228 convert_to_lts_lts(l, result,extra_data_file_type,extra_data_file_name);
236 convert_to_lts_lts(l, result,extra_data_file_type,extra_data_file_name);
The interface for a class that reads aterm from a stream. The default constructed term aterm() indica...
The interface for a class that writes aterm to a stream. Every written term is retrieved by the corre...
const data::variable_list & process_parameters() const
Returns the sequence of process parameters.
\brief A timed multi-action
const process::action_label_list & action_labels() const
Returns a sequence of action labels. This sequence contains all action labels occurring in the specif...
const LinearProcess & process() const
Returns the linear process of the specification.
const data::data_specification & data() const
Returns the data specification.
Linear process specification.
A simple labelled transition format with only strings as action labels.
void load(const std::string &filename)
Load the labelled transition system from a file.
The class lts_fsm_t contains labelled transition systems in .fsm format.
void load(const std::string &filename)
Save the labelled transition system to file.
This class contains labelled transition systems in .lts format.
void load(const std::string &filename)
Load the labelled transition system from file.
A simple labelled transition format with only strings as action labels.
void load(const std::string &filename)
Load the labelled transition system from a file.
The class lts_fsm_t contains labelled transition systems in .fsm format.
void load(const std::string &filename)
Save the labelled transition system to file.
probabilistic_state< std::size_t, lps::probabilistic_data_expression > probabilistic_state_t
The type of probabilistic labels.
Process specification consisting of a data specification, action labels, a sequence of process equati...
const data::data_specification & data() const
Returns the data specification.
const process::action_label_list & action_labels() const
Returns the action label specification.
Standard exception class for reporting runtime errors.
#define mCRL2log(LEVEL)
mCRL2log(LEVEL) provides the stream used to log.
IO routines for linear process specifications.
This file contains lts_convert routines that translate different lts formats into each other.
atermpp::aterm_istream & operator>>(atermpp::aterm_istream &stream, data_specification &spec)
Reads a data specification from a stream.
std::ostream & operator<<(std::ostream &out, const abstraction &x)
void load_lps(Specification &spec, std::istream &stream, const std::string &source="")
Load LPS from file.
void read_mcrl2_context(const std::string &data_file, data::data_specification &data, process::action_label_list &action_labels)
void read_lps_context(const std::string &data_file, data::data_specification &data, process::action_label_list &action_labels, data::variable_list &process_parameters)
void read_data_context(const std::string &data_file, data::data_specification &data, process::action_label_list &action_labels)
void lts_convert(const lts< STATE_LABEL1, ACTION_LABEL1, LTS_BASE1 > <s_in, lts< STATE_LABEL2, ACTION_LABEL2, LTS_BASE2 > <s_out)
lts_type guess_format(std::string const &s, const bool be_verbose=true)
Determines the LTS format from a filename by its extension.
void convert_to_lts_lts(LTS_TYPE_IN &src, LTS_TYPE_OUT &dest, const data_file_type_t extra_data_file_type, const std::string &extra_data_file_name)
void load_lts(LTS_TYPE &result, const std::string &infilename, lts_type type, const data_file_type_t extra_data_file_type=none_e, const std::string &extra_data_file_name="")
Loads an lts of the indicated type, transforms it to an lts of the form lts_lts_t using the additiona...
lts_type
The enumerated type lts_type contains an index for every type type of labelled transition system that...
void load_lts_as_fsm_file(const std::string &path, lts_fsm_t &l)
Read a labelled transition system and return it in fsm format.
std::size_t to(const outgoing_pair_t &p)
Target state of a label state pair.
void write_lts_header(atermpp::aterm_ostream &stream, const data::data_specification &data, const data::variable_list ¶meters, const process::action_label_list &action_labels)
Writes the start of an LTS stream.
void write_initial_state(atermpp::aterm_ostream &stream, std::size_t index)
Write the initial state to the LTS stream.
void write_state_label(atermpp::aterm_ostream &stream, const state_label_lts &label)
Write a state label to the LTS stream.
data_file_type_t
Type for data files that contain extra information for an lts in .aut or .fsm format....
std::size_t label(const outgoing_pair_t &p)
Label of a pair of a label and target state.
std::size_t from(const outgoing_transitions_per_state_action_t::const_iterator &i)
From state of an iterator exploring transitions per outgoing state and action.
void write_transition(atermpp::aterm_ostream &stream, std::size_t from, const lps::multi_action &label, std::size_t to)
Write a transition to the LTS stream.
process_specification parse_process_specification(std::istream &in)
Parses a process specification from an input stream.
std::string read_text(const std::string &filename, bool warn=false)
Read text from a file.