From 9e075e7312a4bca272e6945a0613ed85974f3f0a Mon Sep 17 00:00:00 2001 From: Alexandre Duret-Lutz Date: Mon, 25 May 2020 10:51:44 +0200 Subject: [PATCH] twa: get rid of set_num_sets_() * spot/twa/twa.hh (set_num_sets_): Remove, and adjust all uses. This fixes #414. --- spot/twa/twa.hh | 27 +++++++-------------------- 1 file changed, 7 insertions(+), 20 deletions(-) diff --git a/spot/twa/twa.hh b/spot/twa/twa.hh index 5b957b902..7a5fa2897 100644 --- a/spot/twa/twa.hh +++ b/spot/twa/twa.hh @@ -929,16 +929,6 @@ namespace spot private: acc_cond acc_; - void set_num_sets_(unsigned num) - { - if (num < acc_.num_sets()) - { - acc_.~acc_cond(); - new (&acc_) acc_cond; - } - acc_.add_sets(num - acc_.num_sets()); - } - public: /// Number of acceptance sets used by the automaton. unsigned num_sets() const @@ -958,8 +948,7 @@ namespace spot /// \param c the acceptance formula void set_acceptance(unsigned num, const acc_cond::acc_code& c) { - set_num_sets_(num); - acc_.set_acceptance(c); + acc_ = acc_cond(num, c); } /// \brief Set the acceptance condition of the automaton. @@ -997,8 +986,7 @@ namespace spot /// property is automatically turned on. void set_generalized_buchi(unsigned num) { - set_num_sets_(num); - acc_.set_generalized_buchi(); + acc_ = acc_cond(num, acc_cond::acc_code::generalized_buchi(num)); } /// \brief Set generalized co-Büchi acceptance @@ -1015,8 +1003,7 @@ namespace spot /// property is automatically turned on. void set_generalized_co_buchi(unsigned num) { - set_num_sets_(num); - acc_.set_generalized_co_buchi(); + acc_ = acc_cond(num, acc_cond::acc_code::generalized_co_buchi(num)); } /// \brief Set Büchi acceptance. @@ -1036,8 +1023,8 @@ namespace spot /// \see prop_state_acc acc_cond::mark_t set_buchi() { - set_generalized_buchi(1); - return acc_.mark(0); + acc_ = acc_cond(1, acc_cond::acc_code::buchi()); + return {0}; } /// \brief Set co-Büchi acceptance. @@ -1057,8 +1044,8 @@ namespace spot /// \see prop_state_acc acc_cond::mark_t set_co_buchi() { - set_generalized_co_buchi(1); - return acc_.mark(0); + acc_ = acc_cond(1, acc_cond::acc_code::cobuchi()); + return {0}; } private: