Storm 1.14.0.1
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
HOAConsumerDAHeader.h
Go to the documentation of this file.
1#pragma once
2
3#include "cpphoafparser/consumer/hoa_consumer.hh"
4#include "cpphoafparser/util/implicit_edge_helper.hh"
13
14#include <boost/optional.hpp>
15#include <exception>
16
17namespace storm {
18namespace automata {
19
20class HOAConsumerDAHeader : public cpphoafparser::HOAConsumer {
21 protected:
23
24 public:
25 typedef std::shared_ptr<HOAConsumerDAHeader> ptr;
26
27 struct header_parsing_done : public std::exception {};
28
30 return header;
31 }
32
33 virtual bool parserResolvesAliases() {
34 return true;
35 }
36
38 virtual void notifyHeaderStart(const std::string& /*version*/) {
39 // TODO: Check version
40 }
41
43 virtual void setNumberOfStates(unsigned int numberOfStates) {
44 header.numberOfStates = numberOfStates;
45 }
46
51 virtual void addStartStates(const int_list& stateConjunction) {
52 STORM_LOG_THROW(!header.startState, storm::exceptions::NotSupportedException,
53 "Parsing deterministic HOA automaton: Nondeterministic choice of start states not supported.");
54 STORM_LOG_THROW(stateConjunction.size() == 1, storm::exceptions::NotSupportedException,
55 "Parsing deterministic HOA automaton: Conjunctive choice of start states not supported.");
56 header.startState = stateConjunction.at(0);
57 }
58
63 virtual void setAPs(const std::vector<std::string>& aps) {
64 for (const std::string& ap : aps) {
65 header.apSet.add(ap);
66 }
67 }
68
74 virtual void setAcceptanceCondition(unsigned int numberOfSets, acceptance_expr::ptr accExpr) {
75 header.numberOfAcceptanceSets = numberOfSets;
76 header.acceptance_expression = accExpr;
77 }
78
84 virtual void provideAcceptanceName(const std::string& name, const std::vector<cpphoafparser::IntOrString>& extraInfo) {
85 header.accName = name;
86 header.accNameExtraInfo = extraInfo;
87 }
88
96 virtual void addAlias(const std::string& name, label_expr::ptr labelExpr) {
97 // IGNORE
98 (void)name;
99 (void)labelExpr;
100 }
101
105 virtual void setName(const std::string& /*name*/) {
106 // IGNORE
107 }
108
114 virtual void setTool(const std::string& /*name*/, std::shared_ptr<std::string> /*version*/) {
115 // IGNORE
116 }
117
122 virtual void addProperties(const std::vector<std::string>& /*properties*/) {
123 // TODO: check supported
124 }
125
131 virtual void addMiscHeader(const std::string& /*name*/, const std::vector<cpphoafparser::IntOrString>& /*content*/) {
132 // TODO: Check semantic headers
133 }
134
138 virtual void notifyBodyStart() {
139 throw header_parsing_done();
140 }
141
149 virtual void addState(unsigned int /*id*/, std::shared_ptr<std::string> /*info*/, label_expr::ptr /*labelExpr*/,
150 std::shared_ptr<int_list> /*accSignature*/) {
151 // IGNORE
152 }
153
166 virtual void addEdgeImplicit(unsigned int /*stateId*/, const int_list& /*conjSuccessors*/, std::shared_ptr<int_list> /*accSignature*/) {
167 // IGNORE
168 }
169
179 virtual void addEdgeWithLabel(unsigned int /*stateId*/, label_expr::ptr /*labelExpr*/, const int_list& /*conjSuccessors*/,
180 std::shared_ptr<int_list> /*accSignature*/) {
181 // IGNORE
182 }
183
188 virtual void notifyEndOfState(unsigned int /*stateId*/) {
189 // IGNORE
190 }
191
195 virtual void notifyEnd() {}
196
201 virtual void notifyAbort() {
202 STORM_LOG_THROW(false, storm::exceptions::WrongFormatException, "Parsing deterministic automaton: Automaton is incomplete (abort).");
203 }
204
209 virtual void notifyWarning(const std::string& warning) {
210 // IGNORE
211 (void)warning;
212 }
213};
214
215} // namespace automata
216} // namespace storm
virtual void notifyEndOfState(unsigned int)
Called by the parser to notify the consumer that the definition for state stateId has ended [multiple...
virtual void addEdgeImplicit(unsigned int, const int_list &, std::shared_ptr< int_list >)
Called by the parser for each implicit edge definition [multiple], i.e., where the edge label is dedu...
virtual void addStartStates(const int_list &stateConjunction)
Called by the parser for each "Start: state-conj" item [optional, multiple].
virtual void notifyBodyStart()
Called by the parser to notify that the BODY of the automaton has started [mandatory,...
virtual void addState(unsigned int, std::shared_ptr< std::string >, label_expr::ptr, std::shared_ptr< int_list >)
Called by the parser for each "State: ..." item [multiple].
virtual void setAPs(const std::vector< std::string > &aps)
Called by the parser for the "AP: ap-def" item [optional, once].
virtual void addProperties(const std::vector< std::string > &)
Called by the parser for the "properties: ..." item [optional, multiple].
virtual void notifyHeaderStart(const std::string &)
Called by the parser for the "HOA: version" item [mandatory, once].
virtual void setName(const std::string &)
Called by the parser for the "name: ..." item [optional, once].
virtual void addAlias(const std::string &name, label_expr::ptr labelExpr)
Called by the parser for each "Alias: alias-def" item [optional, multiple].
virtual void addEdgeWithLabel(unsigned int, label_expr::ptr, const int_list &, std::shared_ptr< int_list >)
Called by the parser for each explicit edge definition [optional, multiple], i.e.,...
virtual void addMiscHeader(const std::string &, const std::vector< cpphoafparser::IntOrString > &)
Called by the parser for each unknown header item [optional, multiple].
virtual void setAcceptanceCondition(unsigned int numberOfSets, acceptance_expr::ptr accExpr)
Called by the parser for the "Acceptance: acceptance-def" item [mandatory, once].
virtual void notifyAbort()
Called by the parser to notify the consumer that an "ABORT" message has been encountered (at any time...
std::shared_ptr< HOAConsumerDAHeader > ptr
virtual void notifyEnd()
Called by the parser to notify the consumer that the automata definition has ended [mandatory,...
virtual void setTool(const std::string &, std::shared_ptr< std::string >)
Called by the parser for the "tool: ..." item [optional, once].
virtual void provideAcceptanceName(const std::string &name, const std::vector< cpphoafparser::IntOrString > &extraInfo)
Called by the parser for each "acc-name: ..." item [optional, multiple].
virtual void setNumberOfStates(unsigned int numberOfStates)
Called by the parser for the "States: int(numberOfStates)" item [optional, once].
virtual void notifyWarning(const std::string &warning)
Is called whenever a condition is encountered that merits a (non-fatal) warning.
#define STORM_LOG_THROW(cond, exception, message)
Definition macros.h:28