get rid of some unnecessary code
* spot/priv/enumflags.hh: Delete. * spot/priv/Makefile.am, debian/copyright: Adjust. * spot/twaalgos/remfin.cc: Replace the complex enum definition by a plain enum that is almost not used.
This commit is contained in:
parent
15cc7301cc
commit
cd6f1c2c3e
4 changed files with 12 additions and 148 deletions
16
debian/copyright
vendored
16
debian/copyright
vendored
|
|
@ -183,19 +183,3 @@ License: MIT style
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||||
IN THE SOFTWARE.
|
IN THE SOFTWARE.
|
||||||
|
|
||||||
Files: spot/priv/enumflags.hh
|
|
||||||
Copyright: 2006, 2014 Petr Ročkai <me@mornfall.net>
|
|
||||||
2013-2015 Vladimír Štill <xstill@fi.muni.cz>
|
|
||||||
License: ICS License
|
|
||||||
Permission to use, copy, modify, and distribute this software for any
|
|
||||||
purpose with or without fee is hereby granted, provided that the above
|
|
||||||
copyright notice and this permission notice appear in all copies.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
||||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
||||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
||||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
||||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
||||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
||||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
## -*- coding: utf-8 -*-
|
## -*- coding: utf-8 -*-
|
||||||
## Copyright (C) 2013, 2014, 2015, 2016 Laboratoire de Recherche et
|
## Copyright (C) 2013, 2014, 2015, 2016, 2017 Laboratoire de Recherche
|
||||||
## Développement de l'Epita (LRDE).
|
## et Développement de l'Epita (LRDE).
|
||||||
##
|
##
|
||||||
## This file is part of Spot, a model checking library.
|
## This file is part of Spot, a model checking library.
|
||||||
##
|
##
|
||||||
|
|
@ -25,7 +25,6 @@ libpriv_la_SOURCES = \
|
||||||
accmap.hh \
|
accmap.hh \
|
||||||
bddalloc.cc \
|
bddalloc.cc \
|
||||||
bddalloc.hh \
|
bddalloc.hh \
|
||||||
enumflags.hh \
|
|
||||||
freelist.cc \
|
freelist.cc \
|
||||||
freelist.hh \
|
freelist.hh \
|
||||||
satcommon.hh\
|
satcommon.hh\
|
||||||
|
|
|
||||||
|
|
@ -1,117 +0,0 @@
|
||||||
// -*- coding: utf-8 -*-
|
|
||||||
// Copyright (C) 2006, 2014 Petr Ročkai <me@mornfall.net>
|
|
||||||
// Copyright (C) 2013-2015 Vladimír Štill <xstill@fi.muni.cz>
|
|
||||||
// Copyright (C) 2017 Henrich Lauko <xlauko@mail.muni.cz>
|
|
||||||
//
|
|
||||||
// This file is a modification of brick-types file from brick library.
|
|
||||||
//
|
|
||||||
// Permission to use, copy, modify, and distribute this software for any
|
|
||||||
// purpose with or without fee is hereby granted, provided that the above
|
|
||||||
// copyright notice and this permission notice appear in all copies.
|
|
||||||
//
|
|
||||||
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
||||||
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
||||||
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
||||||
// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
||||||
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
||||||
// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
||||||
// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <type_traits>
|
|
||||||
|
|
||||||
namespace spot
|
|
||||||
{
|
|
||||||
template<typename E>
|
|
||||||
using is_enum_class = std::integral_constant<bool,
|
|
||||||
std::is_enum<E>::value && !std::is_convertible<E, int>::value>;
|
|
||||||
|
|
||||||
template<typename self>
|
|
||||||
struct strong_enum_flags {
|
|
||||||
static_assert(is_enum_class<self>::value, "Not an enum class.");
|
|
||||||
using type = strong_enum_flags<self>;
|
|
||||||
using underlying_type = typename std::underlying_type<self>::type;
|
|
||||||
|
|
||||||
constexpr strong_enum_flags() noexcept : store(0) {}
|
|
||||||
constexpr strong_enum_flags(self flag) noexcept :
|
|
||||||
store(static_cast<underlying_type>(flag))
|
|
||||||
{}
|
|
||||||
|
|
||||||
explicit constexpr strong_enum_flags(underlying_type st) noexcept
|
|
||||||
: store(st) {}
|
|
||||||
|
|
||||||
constexpr explicit operator underlying_type() const noexcept
|
|
||||||
{
|
|
||||||
return store;
|
|
||||||
}
|
|
||||||
|
|
||||||
type &operator|=(type o) noexcept
|
|
||||||
{
|
|
||||||
store |= o.store;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
type &operator&=(type o) noexcept
|
|
||||||
{
|
|
||||||
store &= o.store;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
type &operator^=(type o) noexcept
|
|
||||||
{
|
|
||||||
store ^= o.store;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
friend constexpr type operator~(type a)
|
|
||||||
{
|
|
||||||
return type(~a.store);
|
|
||||||
}
|
|
||||||
|
|
||||||
friend constexpr type operator|(type a, type b) noexcept
|
|
||||||
{
|
|
||||||
return type(a.store | b.store);
|
|
||||||
}
|
|
||||||
|
|
||||||
friend constexpr type operator&(type a, type b) noexcept
|
|
||||||
{
|
|
||||||
return type(a.store & b.store);
|
|
||||||
}
|
|
||||||
|
|
||||||
friend constexpr type operator^(type a, type b) noexcept
|
|
||||||
{
|
|
||||||
return type(a.store ^ b.store);
|
|
||||||
}
|
|
||||||
|
|
||||||
friend constexpr bool operator==(type a, type b) noexcept
|
|
||||||
{
|
|
||||||
return a.store == b.store;
|
|
||||||
}
|
|
||||||
|
|
||||||
friend constexpr bool operator!=(type a, type b) noexcept
|
|
||||||
{
|
|
||||||
return a.store != b.store;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
constexpr bool has(self x) const noexcept
|
|
||||||
{
|
|
||||||
return ((*this) &x);
|
|
||||||
}
|
|
||||||
|
|
||||||
type clear(self x) noexcept
|
|
||||||
{
|
|
||||||
store &= ~underlying_type(x);
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
explicit constexpr operator bool() const noexcept
|
|
||||||
{
|
|
||||||
return store;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
underlying_type store;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
@ -25,7 +25,6 @@
|
||||||
#include <spot/twaalgos/isdet.hh>
|
#include <spot/twaalgos/isdet.hh>
|
||||||
#include <spot/twaalgos/mask.hh>
|
#include <spot/twaalgos/mask.hh>
|
||||||
#include <spot/twaalgos/alternation.hh>
|
#include <spot/twaalgos/alternation.hh>
|
||||||
#include "spot/priv/enumflags.hh"
|
|
||||||
|
|
||||||
// #define TRACE
|
// #define TRACE
|
||||||
#ifdef TRACE
|
#ifdef TRACE
|
||||||
|
|
@ -38,21 +37,20 @@ namespace spot
|
||||||
{
|
{
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
enum class strategy_t : unsigned
|
enum strategy_t
|
||||||
{
|
{
|
||||||
trivial = 1,
|
trivial = 1U,
|
||||||
weak = 2,
|
weak = 2U,
|
||||||
alternation = 4,
|
alternation = 4U,
|
||||||
rabin = 8,
|
rabin = 8U,
|
||||||
streett = 16,
|
streett = 16U,
|
||||||
};
|
};
|
||||||
|
|
||||||
using strategy_flags = strong_enum_flags<strategy_t>;
|
|
||||||
using strategy =
|
using strategy =
|
||||||
std::function<twa_graph_ptr(const const_twa_graph_ptr& aut)>;
|
std::function<twa_graph_ptr(const const_twa_graph_ptr& aut)>;
|
||||||
|
|
||||||
twa_graph_ptr
|
twa_graph_ptr
|
||||||
remove_fin_impl(const const_twa_graph_ptr&, const strategy_flags);
|
remove_fin_impl(const const_twa_graph_ptr&, const strategy_t);
|
||||||
|
|
||||||
using EdgeMask = std::vector<bool>;
|
using EdgeMask = std::vector<bool>;
|
||||||
|
|
||||||
|
|
@ -759,11 +757,11 @@ namespace spot
|
||||||
}
|
}
|
||||||
|
|
||||||
twa_graph_ptr remove_fin_impl(const const_twa_graph_ptr& aut,
|
twa_graph_ptr remove_fin_impl(const const_twa_graph_ptr& aut,
|
||||||
const strategy_flags skip = {})
|
const strategy_t skip = {})
|
||||||
{
|
{
|
||||||
auto handle = [&](strategy stra, strategy_t type)
|
auto handle = [&](strategy stra, strategy_t type) -> twa_graph_ptr
|
||||||
{
|
{
|
||||||
return (type & ~skip) ? stra(aut) : nullptr;
|
return (type & skip) ? nullptr : stra(aut);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (auto maybe = handle(trivial_strategy, strategy_t::trivial))
|
if (auto maybe = handle(trivial_strategy, strategy_t::trivial))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue