diff --git a/alib2data/src/alphabet/BarSymbol.h b/alib2data/src/alphabet/BarSymbol.h index 7a7ff739e31990fe5dcff2caf0faed22c05bc484..31b68af10dd222d41b93e3b40a92d08e05f33eac 100644 --- a/alib2data/src/alphabet/BarSymbol.h +++ b/alib2data/src/alphabet/BarSymbol.h @@ -15,7 +15,7 @@ namespace alphabet { /** * Represents bar symbol for tree linearization. */ -class BarSymbol : public std::acceptor<BarSymbol, VisitableSymbolBase, std::acceptor<BarSymbol, alib::VisitableObjectBase, SymbolBase> > { +class BarSymbol : public SymbolBase { public: /** * Creates a bar symbol. diff --git a/alib2data/src/alphabet/BlankSymbol.h b/alib2data/src/alphabet/BlankSymbol.h index e9ce3d43b5aa32066cd4e6d035448b825b1e6f7e..55b9d2e0a3bfe6d9f8b0583e8eb312e1502ea443 100644 --- a/alib2data/src/alphabet/BlankSymbol.h +++ b/alib2data/src/alphabet/BlankSymbol.h @@ -15,7 +15,7 @@ namespace alphabet { /** * Represents blank symbol in an alphabet. */ -class BlankSymbol : public std::acceptor<BlankSymbol, VisitableSymbolBase, std::acceptor<BlankSymbol, alib::VisitableObjectBase, SymbolBase> > { +class BlankSymbol : public SymbolBase { public: /** * Creates a blank symbol. diff --git a/alib2data/src/alphabet/BottomOfTheStackSymbol.h b/alib2data/src/alphabet/BottomOfTheStackSymbol.h index 811ff4f22467fcbc0d9e5b6a62ef06772a529484..62f147759152c8b4944da1ffe8ca933f6add71f4 100644 --- a/alib2data/src/alphabet/BottomOfTheStackSymbol.h +++ b/alib2data/src/alphabet/BottomOfTheStackSymbol.h @@ -15,7 +15,7 @@ namespace alphabet { /** * Represents blank symbol in an alphabet. */ -class BottomOfTheStackSymbol : public std::acceptor<BottomOfTheStackSymbol, VisitableSymbolBase, std::acceptor<BottomOfTheStackSymbol, alib::VisitableObjectBase, SymbolBase> > { +class BottomOfTheStackSymbol : public SymbolBase { public: /** * Creates a blank symbol. diff --git a/alib2data/src/alphabet/EndSymbol.h b/alib2data/src/alphabet/EndSymbol.h index 4a65cbddde91bf38e8046515dd65f973edc723f1..066ae7b66738bfe8e6da961ee58318c6a34b7240 100644 --- a/alib2data/src/alphabet/EndSymbol.h +++ b/alib2data/src/alphabet/EndSymbol.h @@ -15,7 +15,7 @@ namespace alphabet { /** * Represents blank symbol in an alphabet. */ -class EndSymbol : public std::acceptor<EndSymbol, VisitableSymbolBase, std::acceptor<EndSymbol, alib::VisitableObjectBase, SymbolBase> > { +class EndSymbol : public SymbolBase { public: /** * Creates a blank symbol. diff --git a/alib2data/src/alphabet/LabeledSymbol.h b/alib2data/src/alphabet/LabeledSymbol.h index 1a296f7685cb2240dbc61b5981b5b209f3f44682..77dcf0e38bbdfc7eb6b8a8843934229ded691b51 100644 --- a/alib2data/src/alphabet/LabeledSymbol.h +++ b/alib2data/src/alphabet/LabeledSymbol.h @@ -16,7 +16,7 @@ namespace alphabet { /** * Represents symbol in an alphabet. */ -class LabeledSymbol : public std::acceptor<LabeledSymbol, VisitableSymbolBase, std::acceptor<LabeledSymbol, alib::VisitableObjectBase, SymbolBase> > { +class LabeledSymbol : public SymbolBase { protected: label::Label label; diff --git a/alib2data/src/alphabet/RankedSymbol.h b/alib2data/src/alphabet/RankedSymbol.h index de5f0f9b2a457423849061ab5c18c84153257086..46f1c43ffaf811d9e0ec0ef456f9246198ec93a0 100644 --- a/alib2data/src/alphabet/RankedSymbol.h +++ b/alib2data/src/alphabet/RankedSymbol.h @@ -16,7 +16,7 @@ namespace alphabet { /** * Represents symbol in an alphabet. */ -class RankedSymbol : public std::acceptor<RankedSymbol, VisitableSymbolBase, std::acceptor<RankedSymbol, alib::VisitableObjectBase, SymbolBase> > { +class RankedSymbol : public SymbolBase { protected: alphabet::Symbol symbol; primitive::Unsigned rank; diff --git a/alib2data/src/alphabet/StartSymbol.h b/alib2data/src/alphabet/StartSymbol.h index 6e5e65325f9762cfa2644ccf20c7e7ae87c7eae9..cf1b08bbe3592bde13898fcbb9a35d442d1fae76 100644 --- a/alib2data/src/alphabet/StartSymbol.h +++ b/alib2data/src/alphabet/StartSymbol.h @@ -15,7 +15,7 @@ namespace alphabet { /** * Represents blank symbol in an alphabet. */ -class StartSymbol : public std::acceptor<StartSymbol, VisitableSymbolBase, std::acceptor<StartSymbol, alib::VisitableObjectBase, SymbolBase> > { +class StartSymbol : public SymbolBase { public: /** * Creates a blank symbol. diff --git a/alib2data/src/alphabet/SubtreeWildcardSymbol.h b/alib2data/src/alphabet/SubtreeWildcardSymbol.h index befd0823099a3fab386dd143bf67ea295e3039e2..472a9aade6b1dd8bd9866c4960b8737a3218bd6a 100644 --- a/alib2data/src/alphabet/SubtreeWildcardSymbol.h +++ b/alib2data/src/alphabet/SubtreeWildcardSymbol.h @@ -15,7 +15,7 @@ namespace alphabet { /** * Represents subtreeWildcard symbol for tree linearization. */ -class SubtreeWildcardSymbol : public std::acceptor<SubtreeWildcardSymbol, VisitableSymbolBase, std::acceptor<SubtreeWildcardSymbol, alib::VisitableObjectBase, SymbolBase> > { +class SubtreeWildcardSymbol : public SymbolBase { public: /** * Creates a subtreeWildcard symbol. diff --git a/alib2data/src/alphabet/SymbolBase.h b/alib2data/src/alphabet/SymbolBase.h index 6678117536c00729cebfc26d4a1393f6a1426954..217395b7a25696fa8d3bb13b99c93aaf8d3771a7 100644 --- a/alib2data/src/alphabet/SymbolBase.h +++ b/alib2data/src/alphabet/SymbolBase.h @@ -12,33 +12,11 @@ namespace alphabet { -class SymbolBase; - -// ---------------------------------------------------------------------------------------------------------------------- - -template<typename T> -class acceptor_base_helper { -}; - -template<typename ... Ts> -class acceptor_base_helper< std::tuple< Ts ... > > : - public std::acceptor_base< - SymbolBase, Ts ... - > { -}; - -typedef acceptor_base_helper< alib::SymbolTypes > VisitableSymbolBase; - -// ---------------------------------------------------------------------------------------------------------------------- - /** * Represents symbol in an alphabet. */ -class SymbolBase : public alib::ObjectBase, public VisitableSymbolBase { +class SymbolBase : public alib::ObjectBase { public: - using VisitableSymbolBase::Accept; - using alib::VisitableObjectBase::Accept; - virtual SymbolBase* clone() const = 0; virtual SymbolBase* plunder() && = 0; diff --git a/alib2data/src/alphabet/SymbolPairSymbol.h b/alib2data/src/alphabet/SymbolPairSymbol.h index ccf45cad9de30a71b0edea0e40add46ded1703dd..82b6c1fd3aa72cd8684a3ed5c1fa0efa68cb70b4 100644 --- a/alib2data/src/alphabet/SymbolPairSymbol.h +++ b/alib2data/src/alphabet/SymbolPairSymbol.h @@ -16,7 +16,7 @@ namespace alphabet { /** * Represents symbol in an alphabet. */ -class SymbolPairSymbol : public std::acceptor<SymbolPairSymbol, VisitableSymbolBase, std::acceptor<SymbolPairSymbol, alib::VisitableObjectBase, SymbolBase> > { +class SymbolPairSymbol : public SymbolBase { protected: std::pair<Symbol, Symbol> symbol; diff --git a/alib2data/src/alphabet/SymbolSetSymbol.h b/alib2data/src/alphabet/SymbolSetSymbol.h index 91a66f50d6cc38cda3b91ec990a5c1e6f11e741c..bb8ebad9104928b6dccfcc8188a4f1b6c6798ce5 100644 --- a/alib2data/src/alphabet/SymbolSetSymbol.h +++ b/alib2data/src/alphabet/SymbolSetSymbol.h @@ -16,7 +16,7 @@ namespace alphabet { /** * Represents symbol in an alphabet. */ -class SymbolSetSymbol : public std::acceptor<SymbolSetSymbol, VisitableSymbolBase, std::acceptor<SymbolSetSymbol, alib::VisitableObjectBase, SymbolBase> > { +class SymbolSetSymbol : public SymbolBase { protected: std::set<Symbol> symbol; diff --git a/alib2data/src/alphabet/UniqueSymbol.h b/alib2data/src/alphabet/UniqueSymbol.h index c4038a69be727900ad28243dee9fa546be658a96..28354a3bfe0655498f92ff7015cf8669d0cfbab7 100644 --- a/alib2data/src/alphabet/UniqueSymbol.h +++ b/alib2data/src/alphabet/UniqueSymbol.h @@ -16,7 +16,7 @@ namespace alphabet { /** * Represents symbol in an alphabet. */ -class UniqueSymbol : public std::acceptor<UniqueSymbol, VisitableSymbolBase, std::acceptor<UniqueSymbol, alib::VisitableObjectBase, SymbolBase> > { +class UniqueSymbol : public SymbolBase { protected: Symbol symbol; primitive::Integer id; diff --git a/alib2data/src/alphabet/VariablesBarSymbol.h b/alib2data/src/alphabet/VariablesBarSymbol.h index 1378cc297a952eb471751ebc18066c4940f64e0a..8407df33aa41673ad52b83e102afe2ebdbc0a577 100644 --- a/alib2data/src/alphabet/VariablesBarSymbol.h +++ b/alib2data/src/alphabet/VariablesBarSymbol.h @@ -15,7 +15,7 @@ namespace alphabet { /** * Represents bar symbol for tree linearization. */ -class VariablesBarSymbol : public std::acceptor<VariablesBarSymbol, VisitableSymbolBase, std::acceptor<VariablesBarSymbol, alib::VisitableObjectBase, SymbolBase> > { +class VariablesBarSymbol : public SymbolBase { public: /** * Creates a bar symbol. diff --git a/alib2data/src/automaton/AutomatonBase.h b/alib2data/src/automaton/AutomatonBase.h index 26cd383e85b96785a8a98e647c0392d4fda64f0b..ea29128a016abac6e79fea553198ca521d20e249 100644 --- a/alib2data/src/automaton/AutomatonBase.h +++ b/alib2data/src/automaton/AutomatonBase.h @@ -13,222 +13,15 @@ namespace automaton { -class AutomatonBase; - -// ---------------------------------------------------------------------------------------------------------------------- - -template<typename T> -class acceptor_base_helper { -}; - -template<typename ... Ts> -class acceptor_base_helper< std::tuple< Ts ... > > : - public std::acceptor_base< - AutomatonBase, Ts ... - > { -}; - -typedef acceptor_base_helper< alib::AutomatonTypes > VisitableAutomatonBase; - -// ---------------------------------------------------------------------------------------------------------------------- - /** * Represents symbol in an alphabet. */ -class AutomatonBase : public alib::ObjectBase, public VisitableAutomatonBase { +class AutomatonBase : public alib::ObjectBase { public: - using VisitableAutomatonBase::Accept; - using alib::VisitableObjectBase::Accept; - virtual AutomatonBase* clone() const = 0; virtual AutomatonBase* plunder() && = 0; }; -class VisitableConstFSMBase : public VisitableAutomatonBase::const_visitor_type { -public: - using VisitableAutomatonBase::const_visitor_type::Visit; - - void Visit(void*, const NFTA&) const { - throw exception::AlibException("Unsupported automaton type NFTA"); - } - - void Visit(void*, const DFTA&) const { - throw exception::AlibException("Unsupported automaton type DFTA"); - } - - void Visit(void*, const DPDA&) const { - throw exception::AlibException("Unsupported automaton type DPDA"); - } - - void Visit(void*, const SinglePopDPDA&) const { - throw exception::AlibException("Unsupported automaton type SinglePopDPDA"); - } - - void Visit(void*, const InputDrivenDPDA&) const { - throw exception::AlibException("Unsupported automaton type InputDrivenDPDA"); - } - - void Visit(void*, const InputDrivenNPDA&) const { - throw exception::AlibException("Unsupported automaton type InputDrivenNPDA"); - } - - void Visit(void*, const VisiblyPushdownDPDA&) const { - throw exception::AlibException("Unsupported automaton type VisiblyPushdownDPDA"); - } - - void Visit(void*, const VisiblyPushdownNPDA&) const { - throw exception::AlibException("Unsupported automaton type VisiblyPushdownNPDA"); - } - - void Visit(void*, const RealTimeHeightDeterministicDPDA&) const { - throw exception::AlibException("Unsupported automaton type RealTimeHeightDeterministicDPDA"); - } - - void Visit(void*, const RealTimeHeightDeterministicNPDA&) const { - throw exception::AlibException("Unsupported automaton type RealTimeHeightDeterministicNPDA"); - } - - void Visit(void*, const NPDA&) const { - throw exception::AlibException("Unsupported automaton type NPDA"); - } - - void Visit(void*, const SinglePopNPDA&) const { - throw exception::AlibException("Unsupported automaton type SinglePopNPDA"); - } - - void Visit(void*, const OneTapeDTM&) const { - throw exception::AlibException("Unsupported automaton type OneTapeDTM"); - } -}; - -class VisitableConstPDABase : public VisitableAutomatonBase::const_visitor_type { -public: - using VisitableAutomatonBase::const_visitor_type::Visit; - - void Visit(void*, const NFTA&) const { - throw exception::AlibException("Unsupported automaton type NFTA"); - } - - void Visit(void*, const DFTA&) const { - throw exception::AlibException("Unsupported automaton type DFTA"); - } - - void Visit(void*, const EpsilonNFA&) const { - throw exception::AlibException("Unsupported automaton type EpsilonNFA"); - } - - void Visit(void*, const MultiInitialStateNFA&) const { - throw exception::AlibException("Unsupported automaton type MultiInitialStateNFA"); - } - - void Visit(void*, const NFA&) const { - throw exception::AlibException("Unsupported automaton type NFA"); - } - - void Visit(void*, const DFA&) const { - throw exception::AlibException("Unsupported automaton type DFA"); - } - - void Visit(void*, const ExtendedNFA&) const { - throw exception::AlibException("Unsupported automaton type ExtendedDFA"); - } - - void Visit(void*, const CompactNFA&) const { - throw exception::AlibException("Unsupported automaton type CompactNFA"); - } - - void Visit(void*, const OneTapeDTM&) const { - throw exception::AlibException("Unsupported automaton type OneTapeDTM"); - } - -}; - -class VisitableConstNondeterministicAutomatonBase : public VisitableAutomatonBase::const_visitor_type { -public: - using VisitableAutomatonBase::const_visitor_type::Visit; - - void Visit(void*, const DFTA&) const { - throw exception::AlibException("Unsupported automaton type DFTA"); - } - - void Visit(void*, const DFA&) const { - throw exception::AlibException("Unsupported automaton type DFA"); - } - - void Visit(void*, const DPDA&) const { - throw exception::AlibException("Unsupported automaton type DPDA"); - } - - void Visit(void*, const SinglePopDPDA&) const { - throw exception::AlibException("Unsupported automaton type SinglePopDPDA"); - } - - void Visit(void*, const InputDrivenDPDA&) const { - throw exception::AlibException("Unsupported automaton type InputDrivenDPDA"); - } - - void Visit(void*, const VisiblyPushdownDPDA&) const { - throw exception::AlibException("Unsupported automaton type VisiblyPushdownDPDA"); - } - - void Visit(void*, const RealTimeHeightDeterministicDPDA&) const { - throw exception::AlibException("Unsupported automaton type RealTimeHeightDeterministicDPDA"); - } - - void Visit(void*, const OneTapeDTM&) const { - throw exception::AlibException("Unsupported automaton type OneTapeDTM"); - } -}; - -class VisitableConstDeterministicAutomatonBase : public VisitableAutomatonBase::const_visitor_type { -public: - using VisitableAutomatonBase::const_visitor_type::Visit; - - void Visit(void*, const NFTA&) const { - throw exception::AlibException("Unsupported automaton type NFTA"); - } - - void Visit(void*, const EpsilonNFA&) const { - throw exception::AlibException("Unsupported automaton type EpsilonNFA"); - } - - void Visit(void*, const MultiInitialStateNFA&) const { - throw exception::AlibException("Unsupported automaton type MultiInitialStateNFA"); - } - - void Visit(void*, const NFA&) const { - throw exception::AlibException("Unsupported automaton type NFA"); - } - - void Visit(void*, const ExtendedNFA&) const { - throw exception::AlibException("Unsupported automaton type ExtendedDFA"); - } - - void Visit(void*, const CompactNFA&) const { - throw exception::AlibException("Unsupported automaton type CompactNFA"); - } - - void Visit(void*, const InputDrivenNPDA&) const { - throw exception::AlibException("Unsupported automaton type InputDrivenNPDA"); - } - - void Visit(void*, const VisiblyPushdownNPDA&) const { - throw exception::AlibException("Unsupported automaton type VisiblyPushdownNPDA"); - } - - void Visit(void*, const RealTimeHeightDeterministicNPDA&) const { - throw exception::AlibException("Unsupported automaton type RealTimeHeightDeterministicNPDA"); - } - - void Visit(void*, const NPDA&) const { - throw exception::AlibException("Unsupported automaton type NPDA"); - } - - void Visit(void*, const SinglePopNPDA&) const { - throw exception::AlibException("Unsupported automaton type SinglePopNPDA"); - } -}; - } /* namespace automaton */ namespace std { diff --git a/alib2data/src/automaton/FSM/CompactNFA.h b/alib2data/src/automaton/FSM/CompactNFA.h index a3cb9b232b3ba89837dbbb2ff5e7c75c0f4e8efd..926b005b0c9dd277bd4159135be03fd1c2793fc8 100644 --- a/alib2data/src/automaton/FSM/CompactNFA.h +++ b/alib2data/src/automaton/FSM/CompactNFA.h @@ -24,7 +24,7 @@ namespace automaton { * Represents Finite Automaton. * Can store nondeterministic finite automaton without epsilon transitions. */ -class CompactNFA : public std::acceptor<CompactNFA, VisitableAutomatonBase, std::acceptor<CompactNFA, alib::VisitableObjectBase, AutomatonBase> >, public SingleInitialState, public InputAlphabet { +class CompactNFA : public AutomatonBase, public SingleInitialState, public InputAlphabet { protected: std::map<std::pair<State, string::LinearString>, std::set<State> > transitions; public: diff --git a/alib2data/src/automaton/FSM/DFA.h b/alib2data/src/automaton/FSM/DFA.h index 9e44df348e15300400cf705b9a82e8de73975783..2945d99ffda14e38a81b9c49bad3eb1796269366 100644 --- a/alib2data/src/automaton/FSM/DFA.h +++ b/alib2data/src/automaton/FSM/DFA.h @@ -20,7 +20,7 @@ namespace automaton { * Represents Finite Automaton. * Can store nondeterministic finite automaton without epsilon transitions. */ -class DFA : public std::acceptor<DFA, VisitableAutomatonBase, std::acceptor<DFA, alib::VisitableObjectBase, AutomatonBase> >, public SingleInitialState, public InputAlphabet { +class DFA : public AutomatonBase, public SingleInitialState, public InputAlphabet { protected: std::map<std::pair<State, alphabet::Symbol>, State> transitions; public: diff --git a/alib2data/src/automaton/FSM/EpsilonNFA.h b/alib2data/src/automaton/FSM/EpsilonNFA.h index ce0ba138590303dbc455c0ab95ed5478853d1dff..f029a69a3cf19922898eb7bc7fb4b1938470ddf9 100644 --- a/alib2data/src/automaton/FSM/EpsilonNFA.h +++ b/alib2data/src/automaton/FSM/EpsilonNFA.h @@ -25,7 +25,7 @@ namespace automaton { * Represents Finite Automaton. * Can store nondeterministic finite automaton with epsilon transitions. */ -class EpsilonNFA : public std::acceptor<EpsilonNFA, VisitableAutomatonBase, std::acceptor<EpsilonNFA, alib::VisitableObjectBase, AutomatonBase> >, public SingleInitialState, public InputAlphabet { +class EpsilonNFA : public AutomatonBase, public SingleInitialState, public InputAlphabet { protected: std::map<std::pair<State, std::variant<string::Epsilon, alphabet::Symbol> >, std::set<State> > transitions; public: diff --git a/alib2data/src/automaton/FSM/ExtendedNFA.h b/alib2data/src/automaton/FSM/ExtendedNFA.h index e71d84e05e872c1f656b3d48b2b7cefa8460eb05..42a7f65bdda1d1571c1619c1dd17fff429733878 100644 --- a/alib2data/src/automaton/FSM/ExtendedNFA.h +++ b/alib2data/src/automaton/FSM/ExtendedNFA.h @@ -25,7 +25,7 @@ namespace automaton { * Represents Finite Automaton. * Can store nondeterministic finite automaton without epsilon transitions. */ -class ExtendedNFA : public std::acceptor<ExtendedNFA, VisitableAutomatonBase, std::acceptor<ExtendedNFA, alib::VisitableObjectBase, AutomatonBase> >, public SingleInitialState, public InputAlphabet { +class ExtendedNFA : public AutomatonBase, public SingleInitialState, public InputAlphabet { protected: std::map<std::pair<State, regexp::RegExp>, std::set<State> > transitions; public: diff --git a/alib2data/src/automaton/FSM/MultiInitialStateNFA.h b/alib2data/src/automaton/FSM/MultiInitialStateNFA.h index fb3c3f4b6ffb81009f68735291dc62d4dbaea46a..f4cb5568c555834f164e0874c5f16ce0cacaf577 100644 --- a/alib2data/src/automaton/FSM/MultiInitialStateNFA.h +++ b/alib2data/src/automaton/FSM/MultiInitialStateNFA.h @@ -22,7 +22,7 @@ namespace automaton { * Represents Finite Automaton. * Can store nondeterministic finite automaton without epsilon transitions. */ -class MultiInitialStateNFA : public std::acceptor<MultiInitialStateNFA, VisitableAutomatonBase, std::acceptor<MultiInitialStateNFA, alib::VisitableObjectBase, AutomatonBase> >, public MultiInitialStates, public InputAlphabet { +class MultiInitialStateNFA : public AutomatonBase, public MultiInitialStates, public InputAlphabet { protected: std::map<std::pair<State, alphabet::Symbol>, std::set<State> > transitions; public: diff --git a/alib2data/src/automaton/FSM/NFA.h b/alib2data/src/automaton/FSM/NFA.h index 2af963925f2916e25aac13124507bb011525bb9d..8b6db5f9ae921ed3ecd55ac8c14fc3758ac18d21 100644 --- a/alib2data/src/automaton/FSM/NFA.h +++ b/alib2data/src/automaton/FSM/NFA.h @@ -22,7 +22,7 @@ namespace automaton { * Represents Finite Automaton. * Can store nondeterministic finite automaton without epsilon transitions. */ -class NFA : public std::acceptor<NFA, VisitableAutomatonBase, std::acceptor<NFA, alib::VisitableObjectBase, AutomatonBase> >, public SingleInitialState, public InputAlphabet { +class NFA : public AutomatonBase, public SingleInitialState, public InputAlphabet { protected: std::map<std::pair<State, alphabet::Symbol>, std::set<State> > transitions; public: diff --git a/alib2data/src/automaton/PDA/DPDA.h b/alib2data/src/automaton/PDA/DPDA.h index b752f42bc88f7942983845628a54782432690bc1..ebd2b29c15806c6d556441003277699990722e01 100644 --- a/alib2data/src/automaton/PDA/DPDA.h +++ b/alib2data/src/automaton/PDA/DPDA.h @@ -28,7 +28,7 @@ namespace automaton { * if $\delta (q, a, \alpha) \neq \emptyset$, $\delta (q, a, \beta) \neq \emptyset$ and $\alpha \neq \beta$, then $\alpha$ is not suffix of $\beta$ and $\beta$ is not suffix of $\alpha$ (formally $\gamma \alpha \neq \beta and \alpha \neq \gamma \beta$). * if $\delta(q, a, \alpha) \neq \emptyset$, $\delta (q, \varepsilon, \beta) \neq \emptyset$, then $\alpha$ is not suffix of $\beta$ and $\beta$ is not suffix of $\alpha$ (fornally $\gamma \alpha \neq \beta and \alpha \neq \gamma \beta$). */ -class DPDA : public std::acceptor<DPDA, VisitableAutomatonBase, std::acceptor<DPDA, alib::VisitableObjectBase, AutomatonBase> >, public SingleInitialSymbolPushdownStoreAlphabet, public SingleInitialState, public InputAlphabet { +class DPDA : public AutomatonBase, public SingleInitialSymbolPushdownStoreAlphabet, public SingleInitialState, public InputAlphabet { protected: std::map<std::tuple<State, std::variant<string::Epsilon, alphabet::Symbol>, std::vector<alphabet::Symbol> >, std::pair<State, std::vector<alphabet::Symbol> > > transitions; public: diff --git a/alib2data/src/automaton/PDA/InputDrivenDPDA.h b/alib2data/src/automaton/PDA/InputDrivenDPDA.h index df271582a4c4b006b7387a54a7ae55bded6abc27..6ee217375dbc044fc0c0880591e88a3d38137a62 100644 --- a/alib2data/src/automaton/PDA/InputDrivenDPDA.h +++ b/alib2data/src/automaton/PDA/InputDrivenDPDA.h @@ -22,7 +22,7 @@ namespace automaton { * Represents Finite Automaton. * Can store nondeterministic finite automaton without epsilon transitions. */ -class InputDrivenDPDA : public std::acceptor<InputDrivenDPDA, VisitableAutomatonBase, std::acceptor<InputDrivenDPDA, alib::VisitableObjectBase, AutomatonBase> >, public SingleInitialSymbolPushdownStoreAlphabet, public SingleInitialState, public InputAlphabet { +class InputDrivenDPDA : public AutomatonBase, public SingleInitialSymbolPushdownStoreAlphabet, public SingleInitialState, public InputAlphabet { protected: std::map<std::pair<State, alphabet::Symbol>, State> transitions; std::map<alphabet::Symbol, std::pair<std::vector<alphabet::Symbol>, std::vector<alphabet::Symbol>>> inputSymbolToPushdownStoreOperation; diff --git a/alib2data/src/automaton/PDA/InputDrivenNPDA.h b/alib2data/src/automaton/PDA/InputDrivenNPDA.h index 8c43c4e3940897f130f8f1eaae6be367cdbd02bb..535eaf125a1451767cb45bd0bf11f04fc3b8ee61 100644 --- a/alib2data/src/automaton/PDA/InputDrivenNPDA.h +++ b/alib2data/src/automaton/PDA/InputDrivenNPDA.h @@ -22,7 +22,7 @@ namespace automaton { * Represents Finite Automaton. * Can store nondeterministic finite automaton without epsilon transitions. */ -class InputDrivenNPDA : public std::acceptor<InputDrivenNPDA, VisitableAutomatonBase, std::acceptor<InputDrivenNPDA, alib::VisitableObjectBase, AutomatonBase> >, public SingleInitialSymbolPushdownStoreAlphabet, public SingleInitialState, public InputAlphabet { +class InputDrivenNPDA : public AutomatonBase, public SingleInitialSymbolPushdownStoreAlphabet, public SingleInitialState, public InputAlphabet { protected: std::map<std::pair<State, alphabet::Symbol>, std::set<State> > transitions; std::map<alphabet::Symbol, std::pair<std::vector<alphabet::Symbol>, std::vector<alphabet::Symbol>>> inputSymbolToPushdownStoreOperation; diff --git a/alib2data/src/automaton/PDA/NPDA.h b/alib2data/src/automaton/PDA/NPDA.h index 7244662dcd57c5dd498bec9d9771a8affdd63981..d9f0b7be56a1b121d8b4de93c34f7b988d6e76e8 100644 --- a/alib2data/src/automaton/PDA/NPDA.h +++ b/alib2data/src/automaton/PDA/NPDA.h @@ -24,7 +24,7 @@ namespace automaton { /** * Push Down Automaton */ -class NPDA : public std::acceptor<NPDA, VisitableAutomatonBase, std::acceptor<NPDA, alib::VisitableObjectBase, AutomatonBase> >, public SingleInitialSymbolPushdownStoreAlphabet, public SingleInitialState, public InputAlphabet { +class NPDA : public AutomatonBase, public SingleInitialSymbolPushdownStoreAlphabet, public SingleInitialState, public InputAlphabet { protected: std::map<std::tuple<State, std::variant<string::Epsilon, alphabet::Symbol>, std::vector<alphabet::Symbol> >, std::set<std::pair<State, std::vector<alphabet::Symbol> > > > transitions; public: diff --git a/alib2data/src/automaton/PDA/RealTimeHeightDeterministicDPDA.h b/alib2data/src/automaton/PDA/RealTimeHeightDeterministicDPDA.h index 49b2e433cc8fb501c0d0ca1c50b6890900bbd441..b5b9da828c726421d9fda0e1c5c13bc2acd5c5f2 100644 --- a/alib2data/src/automaton/PDA/RealTimeHeightDeterministicDPDA.h +++ b/alib2data/src/automaton/PDA/RealTimeHeightDeterministicDPDA.h @@ -24,7 +24,7 @@ namespace automaton { * Represents Finite Automaton. * Can store nondeterministic finite automaton without epsilon transitions. */ -class RealTimeHeightDeterministicDPDA : public std::acceptor<RealTimeHeightDeterministicDPDA, VisitableAutomatonBase, std::acceptor<RealTimeHeightDeterministicDPDA, alib::VisitableObjectBase, AutomatonBase> >, public InputAlphabet, public SingleInitialState, public BottomOfTheStackSymbolPushdownStoreAlphabet { +class RealTimeHeightDeterministicDPDA : public AutomatonBase, public InputAlphabet, public SingleInitialState, public BottomOfTheStackSymbolPushdownStoreAlphabet { protected: std::map<std::pair<State, std::variant<string::Epsilon, alphabet::Symbol>>, std::pair<State, alphabet::Symbol> > callTransitions; std::map<std::tuple<State, std::variant<string::Epsilon, alphabet::Symbol>, alphabet::Symbol>, State> returnTransitions; diff --git a/alib2data/src/automaton/PDA/RealTimeHeightDeterministicNPDA.h b/alib2data/src/automaton/PDA/RealTimeHeightDeterministicNPDA.h index d15453710c5ae6894fd9e324b09d9a45e3e2cde6..cb24b8f09bf6d2c1a285902e4369c20e6bb78fdd 100644 --- a/alib2data/src/automaton/PDA/RealTimeHeightDeterministicNPDA.h +++ b/alib2data/src/automaton/PDA/RealTimeHeightDeterministicNPDA.h @@ -24,7 +24,7 @@ namespace automaton { * Represents Finite Automaton. * Can store nondeterministic finite automaton without epsilon transitions. */ -class RealTimeHeightDeterministicNPDA : public std::acceptor<RealTimeHeightDeterministicNPDA, VisitableAutomatonBase, std::acceptor<RealTimeHeightDeterministicNPDA, alib::VisitableObjectBase, AutomatonBase> >, public BottomOfTheStackSymbolPushdownStoreAlphabet, public MultiInitialStates, public InputAlphabet { +class RealTimeHeightDeterministicNPDA : public AutomatonBase, public BottomOfTheStackSymbolPushdownStoreAlphabet, public MultiInitialStates, public InputAlphabet { protected: std::map<std::pair<State, std::variant<string::Epsilon, alphabet::Symbol>>, std::set<std::pair<State, alphabet::Symbol> > > callTransitions; std::map<std::tuple<State, std::variant<string::Epsilon, alphabet::Symbol>, alphabet::Symbol>, std::set<State> > returnTransitions; diff --git a/alib2data/src/automaton/PDA/SinglePopDPDA.h b/alib2data/src/automaton/PDA/SinglePopDPDA.h index 5358873005b74b96a23b3379088fd3017c025f76..ee81912b4148050e747513e78d15a4c24e9500e7 100644 --- a/alib2data/src/automaton/PDA/SinglePopDPDA.h +++ b/alib2data/src/automaton/PDA/SinglePopDPDA.h @@ -28,7 +28,7 @@ namespace automaton { * if $\delta (q, a, r) \neq \emptyset$, $\delta (q, a, s) \neq \emptyset$ then $r \neq s$. * if $\delta(q, a, r) \neq \emptyset$, $\delta (q, \varepsilon, s) \neq \emptyset$, then $r \neq s$. */ -class SinglePopDPDA: public std::acceptor<SinglePopDPDA, VisitableAutomatonBase, std::acceptor<SinglePopDPDA, alib::VisitableObjectBase, AutomatonBase> >, public SingleInitialSymbolPushdownStoreAlphabet, public SingleInitialState, public InputAlphabet { +class SinglePopDPDA: public AutomatonBase, public SingleInitialSymbolPushdownStoreAlphabet, public SingleInitialState, public InputAlphabet { protected: std::map<std::tuple<State, std::variant<string::Epsilon, alphabet::Symbol>, alphabet::Symbol>, std::pair<State, std::vector<alphabet::Symbol> > > transitions; public: diff --git a/alib2data/src/automaton/PDA/SinglePopNPDA.h b/alib2data/src/automaton/PDA/SinglePopNPDA.h index 9fd14422df7eedeb664fa8b48e039f8a4750a4a6..9be2fce8e49338c5d82dbb2ea543c1714faf99e3 100644 --- a/alib2data/src/automaton/PDA/SinglePopNPDA.h +++ b/alib2data/src/automaton/PDA/SinglePopNPDA.h @@ -24,7 +24,7 @@ namespace automaton { /** * Push Down Automaton */ -class SinglePopNPDA: public std::acceptor<SinglePopNPDA, VisitableAutomatonBase, std::acceptor<SinglePopNPDA, alib::VisitableObjectBase, AutomatonBase> >, public SingleInitialSymbolPushdownStoreAlphabet, public SingleInitialState, public InputAlphabet { +class SinglePopNPDA: public AutomatonBase, public SingleInitialSymbolPushdownStoreAlphabet, public SingleInitialState, public InputAlphabet { protected: std::map<std::tuple<State, std::variant<string::Epsilon, alphabet::Symbol>, alphabet::Symbol>, std::set<std::pair<State, std::vector<alphabet::Symbol> > > > transitions; public: diff --git a/alib2data/src/automaton/PDA/VisiblyPushdownDPDA.h b/alib2data/src/automaton/PDA/VisiblyPushdownDPDA.h index 808cd906fc1c244379ce56c24a2cd7df4b15ec6c..0c5c76289f843c8409eb014bddc8dd8354d964dc 100644 --- a/alib2data/src/automaton/PDA/VisiblyPushdownDPDA.h +++ b/alib2data/src/automaton/PDA/VisiblyPushdownDPDA.h @@ -22,7 +22,7 @@ namespace automaton { * Represents Finite Automaton. * Can store nondeterministic finite automaton without epsilon transitions. */ -class VisiblyPushdownDPDA : public std::acceptor<VisiblyPushdownDPDA, VisitableAutomatonBase, std::acceptor<VisiblyPushdownDPDA, alib::VisitableObjectBase, AutomatonBase> >, public CallReturnLocalInputAlphabet, public SingleInitialState, public BottomOfTheStackSymbolPushdownStoreAlphabet { +class VisiblyPushdownDPDA : public AutomatonBase, public CallReturnLocalInputAlphabet, public SingleInitialState, public BottomOfTheStackSymbolPushdownStoreAlphabet { protected: std::map<std::pair<State, alphabet::Symbol>, std::pair<State, alphabet::Symbol> > callTransitions; std::map<std::tuple<State, alphabet::Symbol, alphabet::Symbol>, State > returnTransitions; diff --git a/alib2data/src/automaton/PDA/VisiblyPushdownNPDA.h b/alib2data/src/automaton/PDA/VisiblyPushdownNPDA.h index 6f3d61ff6db5985148092633bbab84419f7e7c7d..8e9f2e3c186c884e41c823306f4981a4152ff711 100644 --- a/alib2data/src/automaton/PDA/VisiblyPushdownNPDA.h +++ b/alib2data/src/automaton/PDA/VisiblyPushdownNPDA.h @@ -22,7 +22,7 @@ namespace automaton { * Represents Finite Automaton. * Can store nondeterministic finite automaton without epsilon transitions. */ -class VisiblyPushdownNPDA : public std::acceptor<VisiblyPushdownNPDA, VisitableAutomatonBase, std::acceptor<VisiblyPushdownNPDA, alib::VisitableObjectBase, AutomatonBase> >, public BottomOfTheStackSymbolPushdownStoreAlphabet, public MultiInitialStates, public CallReturnLocalInputAlphabet { +class VisiblyPushdownNPDA : public AutomatonBase, public BottomOfTheStackSymbolPushdownStoreAlphabet, public MultiInitialStates, public CallReturnLocalInputAlphabet { protected: std::map<std::pair<State, alphabet::Symbol>, std::set<std::pair<State, alphabet::Symbol> > > callTransitions; std::map<std::tuple<State, alphabet::Symbol, alphabet::Symbol>, std::set<State> > returnTransitions; diff --git a/alib2data/src/automaton/TA/DFTA.h b/alib2data/src/automaton/TA/DFTA.h index 5edae22dc6d7842f87010b53bb442c7caa4055bf..1e798a9ad8d8e19eb2772b13f93263c3468d1bd3 100644 --- a/alib2data/src/automaton/TA/DFTA.h +++ b/alib2data/src/automaton/TA/DFTA.h @@ -21,7 +21,7 @@ namespace automaton { * Represents Finite Tree Automaton. * Can store nondeterministic finite automaton without epsilon transitions. */ -class DFTA : public std::acceptor<DFTA, VisitableAutomatonBase, std::acceptor<DFTA, alib::VisitableObjectBase, AutomatonBase> >, public States { +class DFTA : public AutomatonBase, public States { protected: std::set<alphabet::RankedSymbol> inputAlphabet; std::map<std::pair<alphabet::RankedSymbol, std::vector<State> >, State > transitions; diff --git a/alib2data/src/automaton/TA/NFTA.h b/alib2data/src/automaton/TA/NFTA.h index ff7f41dea2d75a9d7e4261d45d327a0e880f7984..8dc164993190fc6dd8b241ee4e5a118ac69b39d0 100644 --- a/alib2data/src/automaton/TA/NFTA.h +++ b/alib2data/src/automaton/TA/NFTA.h @@ -23,7 +23,7 @@ namespace automaton { * Represents Finite Tree Automaton. * Can store nondeterministic finite tree automaton without epsilon transitions. */ -class NFTA : public std::acceptor<NFTA, VisitableAutomatonBase, std::acceptor<NFTA, alib::VisitableObjectBase, AutomatonBase> >, public States { +class NFTA : public AutomatonBase, public States { protected: std::set<alphabet::RankedSymbol> inputAlphabet; std::map<std::pair<alphabet::RankedSymbol, std::vector<State> >, std::set<State> > transitions; diff --git a/alib2data/src/automaton/TM/OneTapeDTM.h b/alib2data/src/automaton/TM/OneTapeDTM.h index 66d508b3c1d87c8ef33193dac42bd0f84c828a7f..a48e2bedb590dbdd50851200a61a9c0779809c80 100644 --- a/alib2data/src/automaton/TM/OneTapeDTM.h +++ b/alib2data/src/automaton/TM/OneTapeDTM.h @@ -22,7 +22,7 @@ namespace automaton { /** * One tape turing machine */ -class OneTapeDTM : public std::acceptor<OneTapeDTM, VisitableAutomatonBase, std::acceptor<OneTapeDTM, alib::VisitableObjectBase, AutomatonBase> >, public SingleInitialState, public BlankSymbolInputTapeAlphabet { +class OneTapeDTM : public AutomatonBase, public SingleInitialState, public BlankSymbolInputTapeAlphabet { protected: std::map<std::pair<State, alphabet::Symbol>, std::tuple<State, alphabet::Symbol, Shift> > transitions; diff --git a/alib2data/src/automaton/common/AutomatonFromXMLParser.h b/alib2data/src/automaton/common/AutomatonFromXMLParser.h index 59e8d63af61f7577480201060bf52ea971568de1..d7aa71f74a9b0df27122b6fb527ed39738263aa8 100644 --- a/alib2data/src/automaton/common/AutomatonFromXMLParser.h +++ b/alib2data/src/automaton/common/AutomatonFromXMLParser.h @@ -17,6 +17,7 @@ #include "../../regexp/RegExpFeatures.h" #include "../../alphabet/SymbolFeatures.h" #include "../../string/StringFeatures.h" +#include "Shift.h" namespace automaton { diff --git a/alib2data/src/container/ContainerBase.h b/alib2data/src/container/ContainerBase.h index 1da3921ddc767b08edd86952d1202beeeea2e31a..cbfa54bd744864e37625a2fa04e9837a24898a4d 100644 --- a/alib2data/src/container/ContainerBase.h +++ b/alib2data/src/container/ContainerBase.h @@ -12,33 +12,11 @@ namespace container { -class ContainerBase; - -// ---------------------------------------------------------------------------------------------------------------------- - -template<typename T> -class acceptor_base_helper { -}; - -template<typename ... Ts> -class acceptor_base_helper< std::tuple< Ts ... > > : - public std::acceptor_base< - ContainerBase, Ts ... - > { -}; - -typedef acceptor_base_helper< alib::ContainerTypes > VisitableContainerBase; - -// ---------------------------------------------------------------------------------------------------------------------- - /** * Represents symbol in an alphabet. */ -class ContainerBase : public alib::ObjectBase, public VisitableContainerBase { +class ContainerBase : public alib::ObjectBase { public: - using VisitableContainerBase::Accept; - using alib::VisitableObjectBase::Accept; - virtual ContainerBase* clone() const = 0; virtual ContainerBase* plunder() && = 0; diff --git a/alib2data/src/container/ObjectsMap.h b/alib2data/src/container/ObjectsMap.h index e7ba63b26e563dfd7d2035690b5e1a55587c88d1..85dbb16e3a82fafd20518b069605039292e40fd8 100644 --- a/alib2data/src/container/ObjectsMap.h +++ b/alib2data/src/container/ObjectsMap.h @@ -23,7 +23,7 @@ namespace container { * Basic container from which are derived all other containers. * Contains reason why the container occured. */ -class ObjectsMap : public std::map<alib::Object, alib::Object>, public std::acceptor<ObjectsMap, VisitableContainerBase, std::acceptor<ObjectsMap, alib::VisitableObjectBase, ContainerBase> > { +class ObjectsMap : public std::map<alib::Object, alib::Object>, public ContainerBase { public: explicit ObjectsMap(std::map<alib::Object, alib::Object>); explicit ObjectsMap(); diff --git a/alib2data/src/container/ObjectsPair.h b/alib2data/src/container/ObjectsPair.h index 2c4365be8900416c9413279365d2ce7d8a2bea51..d6eef9a0c2741b0d198bee5d8a93c714f13e686e 100644 --- a/alib2data/src/container/ObjectsPair.h +++ b/alib2data/src/container/ObjectsPair.h @@ -22,7 +22,7 @@ namespace container { * Basic container from which are derived all other containers. * Contains reason why the container occured. */ -class ObjectsPair : public std::pair<alib::Object, alib::Object>, public std::acceptor<ObjectsPair, VisitableContainerBase, std::acceptor<ObjectsPair, alib::VisitableObjectBase, ContainerBase> > { +class ObjectsPair : public std::pair<alib::Object, alib::Object>, public ContainerBase { public: explicit ObjectsPair(alib::Object first, alib::Object second); explicit ObjectsPair(std::pair<alib::Object, alib::Object>); diff --git a/alib2data/src/container/ObjectsSet.h b/alib2data/src/container/ObjectsSet.h index b84cca2ddcc6c31fd49fc80b988d2582bf9a9dfc..b9f813742a80cb9d24727886068e11d66ee23ffe 100644 --- a/alib2data/src/container/ObjectsSet.h +++ b/alib2data/src/container/ObjectsSet.h @@ -22,7 +22,7 @@ namespace container { * Basic container from which are derived all other containers. * Contains reason why the container occured. */ -class ObjectsSet : public std::set<alib::Object>, public std::acceptor<ObjectsSet, VisitableContainerBase, std::acceptor<ObjectsSet, alib::VisitableObjectBase, ContainerBase> > { +class ObjectsSet : public std::set<alib::Object>, public ContainerBase { public: explicit ObjectsSet(std::set<alib::Object>); explicit ObjectsSet(); diff --git a/alib2data/src/container/ObjectsVector.h b/alib2data/src/container/ObjectsVector.h index 33c091c127fc567fbe934d54640b5031ad989811..3420a046443bdead5db140ce1a042b9cdc83761b 100644 --- a/alib2data/src/container/ObjectsVector.h +++ b/alib2data/src/container/ObjectsVector.h @@ -22,7 +22,7 @@ namespace container { * Basic container from which are derived all other containers. * Contains reason why the container occured. */ -class ObjectsVector : public std::vector<alib::Object>, public std::acceptor<ObjectsVector, VisitableContainerBase, std::acceptor<ObjectsVector, alib::VisitableObjectBase, ContainerBase> > { +class ObjectsVector : public std::vector<alib::Object>, public ContainerBase { public: explicit ObjectsVector(std::vector<alib::Object>); explicit ObjectsVector(); diff --git a/alib2data/src/exception/AlibException.h b/alib2data/src/exception/AlibException.h index c7c4f248ada93c6705bbe859f4e66e161fd67f7f..3f17e2413561f0fd809a903f8ca8c13e22d6cc91 100644 --- a/alib2data/src/exception/AlibException.h +++ b/alib2data/src/exception/AlibException.h @@ -21,7 +21,7 @@ namespace exception { * Basic exception from which are derived all other exceptions. * Contains reason why the exception occured. */ -class AlibException : public std::exception, public std::acceptor<AlibException, alib::VisitableObjectBase, alib::ObjectBase> { +class AlibException : public std::exception, public alib::ObjectBase { protected: std::string cause; std::string backtrace; diff --git a/alib2data/src/grammar/ContextFree/CFG.h b/alib2data/src/grammar/ContextFree/CFG.h index 52e74bcf8a69074743463ada77a0b1071f980895..a638b22444c43ff03905503bbe69ca79d359c937 100644 --- a/alib2data/src/grammar/ContextFree/CFG.h +++ b/alib2data/src/grammar/ContextFree/CFG.h @@ -18,7 +18,7 @@ namespace grammar { /** * Context free grammar. Type 2 in Chomsky hierarchy. Produces context free language. */ -class CFG : public std::acceptor<CFG, VisitableGrammarBase, std::acceptor<CFG, alib::VisitableObjectBase, GrammarBase> >, public TerminalNonterminalAlphabetInitialSymbol { +class CFG : public GrammarBase, public TerminalNonterminalAlphabetInitialSymbol { std::map<alphabet::Symbol, std::set<std::vector<alphabet::Symbol>>> rules; public: diff --git a/alib2data/src/grammar/ContextFree/CNF.h b/alib2data/src/grammar/ContextFree/CNF.h index 9b1db2a4b0bf9bc3d267559cee49a7b2b1307874..e2344bd08122b7bb5171169da9cb887c2eafbf27 100644 --- a/alib2data/src/grammar/ContextFree/CNF.h +++ b/alib2data/src/grammar/ContextFree/CNF.h @@ -19,7 +19,7 @@ namespace grammar { /** * Context free grammar in chomsky normal form. Type 2 in Chomsky hierarchy. Produces context free languages. */ -class CNF : public std::acceptor<CNF, VisitableGrammarBase, std::acceptor<CNF, alib::VisitableObjectBase, GrammarBase> >, public TerminalNonterminalAlphabetInitialSymbol { +class CNF : public GrammarBase, public TerminalNonterminalAlphabetInitialSymbol { std::map<alphabet::Symbol, std::set<std::variant<alphabet::Symbol, std::pair<alphabet::Symbol, alphabet::Symbol>>>> rules; bool generatesEpsilon; diff --git a/alib2data/src/grammar/ContextFree/EpsilonFreeCFG.h b/alib2data/src/grammar/ContextFree/EpsilonFreeCFG.h index b7c206664850fe484dc1f69f49bf4bfdbebe798d..b868a0dd876753bb9cc9b13d968545aa47ed34dd 100644 --- a/alib2data/src/grammar/ContextFree/EpsilonFreeCFG.h +++ b/alib2data/src/grammar/ContextFree/EpsilonFreeCFG.h @@ -18,7 +18,7 @@ namespace grammar { /** * Epsilon free context free grammar. Type 2 in Chomsky hierarchy. Produces context free languages. */ -class EpsilonFreeCFG : public std::acceptor<EpsilonFreeCFG, VisitableGrammarBase, std::acceptor<EpsilonFreeCFG, alib::VisitableObjectBase, GrammarBase> >, public TerminalNonterminalAlphabetInitialSymbol { +class EpsilonFreeCFG : public GrammarBase, public TerminalNonterminalAlphabetInitialSymbol { std::map<alphabet::Symbol, std::set<std::vector<alphabet::Symbol>>> rules; bool generatesEpsilon; diff --git a/alib2data/src/grammar/ContextFree/GNF.h b/alib2data/src/grammar/ContextFree/GNF.h index d35ef82672da6324038c57ce28aee9bbf41d6dba..ca190d077e94d4b78d531b1931dfeac0cfbef2fe 100644 --- a/alib2data/src/grammar/ContextFree/GNF.h +++ b/alib2data/src/grammar/ContextFree/GNF.h @@ -18,7 +18,7 @@ namespace grammar { /** * Context free grammar in greibach normal form. Type 2 in Chomsky hierarchy. Produces context free languages. */ -class GNF : public std::acceptor<GNF, VisitableGrammarBase, std::acceptor<GNF, alib::VisitableObjectBase, GrammarBase> >, public TerminalNonterminalAlphabetInitialSymbol { +class GNF : public GrammarBase, public TerminalNonterminalAlphabetInitialSymbol { std::map<alphabet::Symbol, std::set<std::pair<alphabet::Symbol, std::vector<alphabet::Symbol> >> > rules; bool generatesEpsilon; public: diff --git a/alib2data/src/grammar/ContextFree/LG.h b/alib2data/src/grammar/ContextFree/LG.h index 502a23ab9515247d4e82fc59f75f8c8a71412979..395c94026cb8e047b6265952d3072b70d5973ca6 100644 --- a/alib2data/src/grammar/ContextFree/LG.h +++ b/alib2data/src/grammar/ContextFree/LG.h @@ -20,7 +20,7 @@ namespace grammar { /** * Linear grammar in chomsky normal form. Type 3 in Chomsky hierarchy. Produces regular languages. */ -class LG : public std::acceptor<LG, VisitableGrammarBase, std::acceptor<LG, alib::VisitableObjectBase, GrammarBase> >, public TerminalNonterminalAlphabetInitialSymbol { +class LG : public GrammarBase, public TerminalNonterminalAlphabetInitialSymbol { std::map<alphabet::Symbol, std::set<std::variant<std::vector<alphabet::Symbol>, std::tuple<std::vector<alphabet::Symbol>, alphabet::Symbol, std::vector<alphabet::Symbol>> >> > rules; public: explicit LG(alphabet::Symbol initialSymbol); diff --git a/alib2data/src/grammar/ContextSensitive/CSG.h b/alib2data/src/grammar/ContextSensitive/CSG.h index 7a56b8a81baad7af473bfabda0b3745d2d2df262..b0c85e09e031bc543fa3768f3de7b92ed6340e88 100644 --- a/alib2data/src/grammar/ContextSensitive/CSG.h +++ b/alib2data/src/grammar/ContextSensitive/CSG.h @@ -18,7 +18,7 @@ namespace grammar { /** * Epsilon free context free grammar. Type 2 in Chomsky hierarchy. Produces context free languages. */ -class CSG : public std::acceptor<CSG, VisitableGrammarBase, std::acceptor<CSG, alib::VisitableObjectBase, GrammarBase> >, public TerminalNonterminalAlphabetInitialSymbol { +class CSG : public GrammarBase, public TerminalNonterminalAlphabetInitialSymbol { std::map<std::tuple<std::vector<alphabet::Symbol>, alphabet::Symbol, std::vector<alphabet::Symbol>>, std::set<std::vector<alphabet::Symbol>>> rules; bool generatesEpsilon; diff --git a/alib2data/src/grammar/ContextSensitive/NonContractingGrammar.h b/alib2data/src/grammar/ContextSensitive/NonContractingGrammar.h index b9b029e2403b4cd5e55b8a2decf3d2057bf9a27d..c8689855533bfa09fb4b847f98fa734052c8faed 100644 --- a/alib2data/src/grammar/ContextSensitive/NonContractingGrammar.h +++ b/alib2data/src/grammar/ContextSensitive/NonContractingGrammar.h @@ -18,7 +18,7 @@ namespace grammar { /** * Non contracting grammar. Type 1 in Chomsky hierarchy. Produces context sensitive language. */ -class NonContractingGrammar : public std::acceptor<NonContractingGrammar, VisitableGrammarBase, std::acceptor<NonContractingGrammar, alib::VisitableObjectBase, GrammarBase> >, public TerminalNonterminalAlphabetInitialSymbol { +class NonContractingGrammar : public GrammarBase, public TerminalNonterminalAlphabetInitialSymbol { std::map<std::vector<alphabet::Symbol>, std::set<std::vector<alphabet::Symbol>>> rules; bool generatesEpsilon; diff --git a/alib2data/src/grammar/GrammarBase.h b/alib2data/src/grammar/GrammarBase.h index ff18bb2760d085faa521b6895700dfabf99b655d..7e9bd58504478d961cf92c21be504ee58fec1a14 100644 --- a/alib2data/src/grammar/GrammarBase.h +++ b/alib2data/src/grammar/GrammarBase.h @@ -13,88 +13,15 @@ namespace grammar { -class GrammarBase; - -// ---------------------------------------------------------------------------------------------------------------------- - -template<typename T> -class acceptor_base_helper { -}; - -template<typename ... Ts> -class acceptor_base_helper< std::tuple< Ts ... > > : - public std::acceptor_base< - GrammarBase, Ts ... - > { -}; - -typedef acceptor_base_helper< alib::GrammarTypes > VisitableGrammarBase; - -// ---------------------------------------------------------------------------------------------------------------------- - /** * Represents symbol in an alphabet. */ -class GrammarBase : public alib::ObjectBase, public VisitableGrammarBase { +class GrammarBase : public alib::ObjectBase { public: - using VisitableGrammarBase::Accept; - using alib::VisitableObjectBase::Accept; - virtual GrammarBase* clone() const = 0; virtual GrammarBase* plunder() && = 0; }; -class VisitableConstRGBase : public VisitableGrammarBase::const_visitor_type { -public: - using VisitableGrammarBase::const_visitor_type::Visit; - - void Visit(void*, const grammar::ContextPreservingUnrestrictedGrammar&) const - { - throw exception::AlibException("Unsupported grammar type ContextPreservingUnrestrictedGrammar"); - } - - void Visit(void*, const grammar::UnrestrictedGrammar&) const - { - throw exception::AlibException("Unsupported grammar type UnrestrictedGrammar"); - } - - void Visit(void*, const grammar::CSG&) const - { - throw exception::AlibException("Unsupported grammar type CSG"); - } - - void Visit(void*, const grammar::NonContractingGrammar&) const - { - throw exception::AlibException("Unsupported grammar type NonContractingGrammar"); - } - - void Visit(void*, const grammar::CNF&) const - { - throw exception::AlibException("Unsupported grammar type CNF"); - } - - void Visit(void*, const grammar::CFG&) const - { - throw exception::AlibException("Unsupported grammar type CFG"); - } - - void Visit(void*, const grammar::EpsilonFreeCFG&) const - { - throw exception::AlibException("Unsupported grammar type EpsilonFreeCFG"); - } - - void Visit(void*, const grammar::GNF&) const - { - throw exception::AlibException("Unsupported grammar type GNF"); - } - - void Visit(void*, const grammar::LG&) const - { - throw exception::AlibException("Unsupported grammar type LG"); - } - -}; - } /* namespace grammar */ namespace std { diff --git a/alib2data/src/grammar/Regular/LeftLG.h b/alib2data/src/grammar/Regular/LeftLG.h index 8173b08dc900c00d72b3603e928376bfe0a58883..f88b385f6e896d9e5f393ecbcf179daa946ffe15 100644 --- a/alib2data/src/grammar/Regular/LeftLG.h +++ b/alib2data/src/grammar/Regular/LeftLG.h @@ -19,7 +19,7 @@ namespace grammar { /** * Left linear grammar in chomsky normal form. Type 3 in Chomsky hierarchy. Produces regular languages. */ -class LeftLG : public std::acceptor<LeftLG, VisitableGrammarBase, std::acceptor<LeftLG, alib::VisitableObjectBase, GrammarBase> >, public TerminalNonterminalAlphabetInitialSymbol { +class LeftLG : public GrammarBase, public TerminalNonterminalAlphabetInitialSymbol { std::map<alphabet::Symbol, std::set<std::variant<std::vector<alphabet::Symbol>, std::pair<alphabet::Symbol, std::vector<alphabet::Symbol>> >> > rules; public: diff --git a/alib2data/src/grammar/Regular/LeftRG.h b/alib2data/src/grammar/Regular/LeftRG.h index c7e50cdd3c2c18f7900a496eedf6af20ce7f1a97..4980e6797a1111bd69843add17a31b2ae24d0a5a 100644 --- a/alib2data/src/grammar/Regular/LeftRG.h +++ b/alib2data/src/grammar/Regular/LeftRG.h @@ -28,7 +28,7 @@ namespace grammar { * * This definition has simplier handling of empty string generation and it is compatible with common definitions where the transformation from this definition to the common definition and backwards is trivial */ -class LeftRG : public std::acceptor<LeftRG, VisitableGrammarBase, std::acceptor<LeftRG, alib::VisitableObjectBase, GrammarBase> >, public TerminalNonterminalAlphabetInitialSymbol { +class LeftRG : public GrammarBase, public TerminalNonterminalAlphabetInitialSymbol { /** * Transition function as mapping from nonterminal symbol on the left hand side to set of either terminal symbols or doublets of terminal symbol and nonterminal symbol */ diff --git a/alib2data/src/grammar/Regular/RightLG.h b/alib2data/src/grammar/Regular/RightLG.h index 7b38851e6870467d4dcc9163d03e875b90a61155..4db7497946977a1d7b78dbbf5ad95078d524516b 100644 --- a/alib2data/src/grammar/Regular/RightLG.h +++ b/alib2data/src/grammar/Regular/RightLG.h @@ -19,7 +19,7 @@ namespace grammar { /** * Right linear grammar in chomsky normal form. Type 3 in Chomsky hierarchy. Produces regular languages. */ -class RightLG : public std::acceptor<RightLG, VisitableGrammarBase, std::acceptor<RightLG, alib::VisitableObjectBase, GrammarBase> >, public TerminalNonterminalAlphabetInitialSymbol { +class RightLG : public GrammarBase, public TerminalNonterminalAlphabetInitialSymbol { std::map<alphabet::Symbol, std::set<std::variant<std::vector<alphabet::Symbol>, std::pair<std::vector<alphabet::Symbol>, alphabet::Symbol> >> > rules; public: diff --git a/alib2data/src/grammar/Regular/RightRG.h b/alib2data/src/grammar/Regular/RightRG.h index 4aa8f00a01e567776eb3bb93aced981d47191161..332fbf1fc657dd6e6cb34e7656bc0a3e616366ab 100644 --- a/alib2data/src/grammar/Regular/RightRG.h +++ b/alib2data/src/grammar/Regular/RightRG.h @@ -28,7 +28,7 @@ namespace grammar { * * This definition has simplier handling of empty string generation and it is compatible with common definitions where the transformation from this definition to the common definition and backwards is trivial */ -class RightRG : public std::acceptor<RightRG, VisitableGrammarBase, std::acceptor<RightRG, alib::VisitableObjectBase, GrammarBase> >, public TerminalNonterminalAlphabetInitialSymbol { +class RightRG : public GrammarBase, public TerminalNonterminalAlphabetInitialSymbol { /** * Transition function as mapping from nonterminal symbol on the left hand side to set of either terminal symbols or doublets of terminal symbol and nonterminal symbol */ diff --git a/alib2data/src/grammar/Unrestricted/ContextPreservingUnrestrictedGrammar.h b/alib2data/src/grammar/Unrestricted/ContextPreservingUnrestrictedGrammar.h index b1c172a786d1378b07e51bebb5332250738ce01a..6eb85a1b20bfcabf1af1ff784dffec89912e5da5 100644 --- a/alib2data/src/grammar/Unrestricted/ContextPreservingUnrestrictedGrammar.h +++ b/alib2data/src/grammar/Unrestricted/ContextPreservingUnrestrictedGrammar.h @@ -18,7 +18,7 @@ namespace grammar { /** * Epsilon free context free grammar. Type 2 in Chomsky hierarchy. Produces context free languages. */ -class ContextPreservingUnrestrictedGrammar : public std::acceptor<ContextPreservingUnrestrictedGrammar, VisitableGrammarBase, std::acceptor<ContextPreservingUnrestrictedGrammar, alib::VisitableObjectBase, GrammarBase> >, public TerminalNonterminalAlphabetInitialSymbol { +class ContextPreservingUnrestrictedGrammar : public GrammarBase, public TerminalNonterminalAlphabetInitialSymbol { std::map<std::tuple<std::vector<alphabet::Symbol>, alphabet::Symbol, std::vector<alphabet::Symbol>>, std::set<std::vector<alphabet::Symbol>>> rules; public: diff --git a/alib2data/src/grammar/Unrestricted/UnrestrictedGrammar.h b/alib2data/src/grammar/Unrestricted/UnrestrictedGrammar.h index f89958197a5c2ce9670926352ad77e4ca541f0c7..9655bb14418e3fca81519dff3d4001b94c7c88f9 100644 --- a/alib2data/src/grammar/Unrestricted/UnrestrictedGrammar.h +++ b/alib2data/src/grammar/Unrestricted/UnrestrictedGrammar.h @@ -18,7 +18,7 @@ namespace grammar { /** * Unrestricted grammar. Type 0 in Chomsky hierarchy. Produces recursively enumerable language. */ -class UnrestrictedGrammar : public std::acceptor<UnrestrictedGrammar, VisitableGrammarBase, std::acceptor<UnrestrictedGrammar, alib::VisitableObjectBase, GrammarBase> >, public TerminalNonterminalAlphabetInitialSymbol { +class UnrestrictedGrammar : public GrammarBase, public TerminalNonterminalAlphabetInitialSymbol { std::map<std::vector<alphabet::Symbol>, std::set<std::vector<alphabet::Symbol>>> rules; public: diff --git a/alib2data/src/graph/GraphBase.h b/alib2data/src/graph/GraphBase.h index c14e716ffa6ca1ee550c72d3ec766c9248a3471b..595ffd9f984e4fb3f270d03d6b80925611fb3893 100644 --- a/alib2data/src/graph/GraphBase.h +++ b/alib2data/src/graph/GraphBase.h @@ -13,33 +13,11 @@ namespace graph { -class GraphBase; - -// ---------------------------------------------------------------------------------------------------------------------- - -template<typename T> -class acceptor_base_helper { -}; - -template<typename ... Ts> -class acceptor_base_helper< std::tuple< Ts ... > > : - public std::acceptor_base< - GraphBase, Ts ... - > { -}; - -typedef acceptor_base_helper< alib::GraphTypes > VisitableGraphBase; - -// ---------------------------------------------------------------------------------------------------------------------- - /** * Represents symbol in an alphabet. */ -class GraphBase : public alib::ObjectBase, public VisitableGraphBase { +class GraphBase : public alib::ObjectBase { public: - using VisitableGraphBase::Accept; - using alib::VisitableObjectBase::Accept; - virtual GraphBase* clone() const = 0; virtual GraphBase* plunder() && = 0; }; diff --git a/alib2data/src/graph/directed/DirectedGraph.h b/alib2data/src/graph/directed/DirectedGraph.h index 6acc1ae04d608910bea70428ca746912a52fb7cb..ed7428d24106fb1df2286e16564d607aec5cb839 100644 --- a/alib2data/src/graph/directed/DirectedGraph.h +++ b/alib2data/src/graph/directed/DirectedGraph.h @@ -21,8 +21,7 @@ namespace graph { class IDirectedGraph; -class DirectedGraph : public std::acceptor<DirectedGraph, VisitableGraphBase, std::acceptor<DirectedGraph, alib::VisitableObjectBase, GraphBase>> -{ +class DirectedGraph : public GraphBase { public: explicit DirectedGraph(REPRESENTATION representation = REPRESENTATION::ADJACENCY_LIST); ~DirectedGraph() noexcept; diff --git a/alib2data/src/graph/undirected/UndirectedGraph.h b/alib2data/src/graph/undirected/UndirectedGraph.h index 8f2cf2e789d1a433eae04a0c57fbf38c3fa7f302..c7a803a1862ad845fdfa2ddf0b02915dac540312 100644 --- a/alib2data/src/graph/undirected/UndirectedGraph.h +++ b/alib2data/src/graph/undirected/UndirectedGraph.h @@ -21,8 +21,7 @@ namespace graph { class IUndirectedGraph; -class UndirectedGraph : public std::acceptor<UndirectedGraph, VisitableGraphBase, std::acceptor<UndirectedGraph, alib::VisitableObjectBase, GraphBase>> -{ +class UndirectedGraph : public GraphBase { public: explicit UndirectedGraph(REPRESENTATION representation = REPRESENTATION::ADJACENCY_LIST); ~UndirectedGraph() noexcept; diff --git a/alib2data/src/label/HexavigesimalLabel.h b/alib2data/src/label/HexavigesimalLabel.h index cb47a20ff5be09cd7db820247dd8794855b69708..4f84514721d9e8272d93a45470abe8e6f0f63cf3 100644 --- a/alib2data/src/label/HexavigesimalLabel.h +++ b/alib2data/src/label/HexavigesimalLabel.h @@ -17,7 +17,7 @@ namespace label { /** * Represents symbol in an alphabet. */ -class HexavigesimalLabel : public std::acceptor<HexavigesimalLabel, VisitableLabelBase, std::acceptor<HexavigesimalLabel, alib::VisitableObjectBase, LabelBase> > { +class HexavigesimalLabel : public LabelBase { protected: int hexavigesimal; diff --git a/alib2data/src/label/LabelBase.h b/alib2data/src/label/LabelBase.h index 0f06d2cec10a0fe34eacb84a61c4615f77ef6a08..88e4b9d9f662d922e6f44b2e7b7b81d83b726ed5 100644 --- a/alib2data/src/label/LabelBase.h +++ b/alib2data/src/label/LabelBase.h @@ -12,33 +12,11 @@ namespace label { -class LabelBase; - -// ---------------------------------------------------------------------------------------------------------------------- - -template<typename T> -class acceptor_base_helper { -}; - -template<typename ... Ts> -class acceptor_base_helper< std::tuple< Ts ... > > : - public std::acceptor_base< - LabelBase, Ts ... - > { -}; - -typedef acceptor_base_helper< alib::LabelTypes > VisitableLabelBase; - -// ---------------------------------------------------------------------------------------------------------------------- - /** * Represents symbol in an alphabet. */ -class LabelBase : public alib::ObjectBase, public VisitableLabelBase { +class LabelBase : public alib::ObjectBase { public: - using VisitableLabelBase::Accept; - using alib::VisitableObjectBase::Accept; - virtual LabelBase* clone() const = 0; virtual LabelBase* plunder() && = 0; diff --git a/alib2data/src/label/LabelPairLabel.h b/alib2data/src/label/LabelPairLabel.h index ce96645b61521dfe51554b247436897e32f40dc6..cbace15664741eebdfd33fd1d2855c54ff1672c3 100644 --- a/alib2data/src/label/LabelPairLabel.h +++ b/alib2data/src/label/LabelPairLabel.h @@ -16,7 +16,7 @@ namespace label { /** * Represents symbol in an alphabet. */ -class LabelPairLabel : public std::acceptor<LabelPairLabel, VisitableLabelBase, std::acceptor<LabelPairLabel, alib::VisitableObjectBase, LabelBase> > { +class LabelPairLabel : public LabelBase { protected: std::pair<Label, Label> label; diff --git a/alib2data/src/label/LabelSetLabel.h b/alib2data/src/label/LabelSetLabel.h index 663bc9796581dcac90afb38b83279a14e4ab7893..9f1ebed6eeda32b64e45bf5e9e0cd2f5d8e3fea2 100644 --- a/alib2data/src/label/LabelSetLabel.h +++ b/alib2data/src/label/LabelSetLabel.h @@ -16,7 +16,7 @@ namespace label { /** * Represents symbol in an alphabet. */ -class LabelSetLabel : public std::acceptor<LabelSetLabel, VisitableLabelBase, std::acceptor<LabelSetLabel, alib::VisitableObjectBase, LabelBase> > { +class LabelSetLabel : public LabelBase { protected: std::set<Label> label; diff --git a/alib2data/src/label/ObjectLabel.h b/alib2data/src/label/ObjectLabel.h index 93395837652cb12b66b49adad2330f2171d4b26c..daccedf3b35664429dc16f4b1dce6ae781f033f9 100644 --- a/alib2data/src/label/ObjectLabel.h +++ b/alib2data/src/label/ObjectLabel.h @@ -17,7 +17,7 @@ namespace label { /** * Represents symbol in an alphabet. */ -class ObjectLabel : public std::acceptor<ObjectLabel, VisitableLabelBase, std::acceptor<ObjectLabel, alib::VisitableObjectBase, LabelBase> > { +class ObjectLabel : public LabelBase { protected: alib::Object label; diff --git a/alib2data/src/label/PrimitiveLabel.h b/alib2data/src/label/PrimitiveLabel.h index 9e4e52410e762c9ce441f13abe8921be7e2caab7..63ab2adf92793b1eafe42136495c2cbce32a3b77 100644 --- a/alib2data/src/label/PrimitiveLabel.h +++ b/alib2data/src/label/PrimitiveLabel.h @@ -17,7 +17,7 @@ namespace label { /** * Represents symbol in an alphabet. */ -class PrimitiveLabel : public std::acceptor<PrimitiveLabel, VisitableLabelBase, std::acceptor<PrimitiveLabel, alib::VisitableObjectBase, LabelBase> > { +class PrimitiveLabel : public LabelBase { protected: primitive::Primitive primitive; diff --git a/alib2data/src/label/UniqueLabel.h b/alib2data/src/label/UniqueLabel.h index d7af480152edab3892ec3ebea37ccba5d0eebaeb..c1382e5df4387edfac27840e185940fbe78a8e51 100644 --- a/alib2data/src/label/UniqueLabel.h +++ b/alib2data/src/label/UniqueLabel.h @@ -16,7 +16,7 @@ namespace label { /** * Represents symbol in an alphabet. */ -class UniqueLabel : public std::acceptor<UniqueLabel, VisitableLabelBase, std::acceptor<UniqueLabel, alib::VisitableObjectBase, LabelBase> > { +class UniqueLabel : public LabelBase { protected: Label label; primitive::Integer id; diff --git a/alib2data/src/object/ObjectBase.h b/alib2data/src/object/ObjectBase.h index 5a8f68ec7582ec69a3a3782c092fe669f0909b49..84bd572006c8190441a8abdfdff07e7a9f1a622e 100644 --- a/alib2data/src/object/ObjectBase.h +++ b/alib2data/src/object/ObjectBase.h @@ -8,101 +8,15 @@ #ifndef OBJECT_BASE_H_ #define OBJECT_BASE_H_ -#include "../common/visitor.hpp" #include <compare> #include <memory> #include <deque> #include "../common/base.hpp" #include "../sax/Token.h" - -#include "ObjectFeatures.h" -#include "../exception/ExceptionFeatures.h" -#include "../automaton/AutomatonFeatures.h" -#include "../grammar/GrammarFeatures.h" -#include "../graph/GraphFeatures.h" -#include "../label/LabelFeatures.h" -#include "../regexp/RegExpFeatures.h" -#include "../string/StringFeatures.h" -#include "../alphabet/SymbolFeatures.h" -#include "../container/ContainerFeatures.h" -#include "../primitive/PrimitiveFeatures.h" -#include "../tree/TreeFeatures.h" - namespace alib { -// ---------------------------------------------------------------------------------------------------------------------- - -typedef std::tuple< tree::RankedTree, tree::RankedPattern, tree::PrefixRankedTree, tree::PrefixRankedBarTree, tree::PrefixRankedPattern, tree::PrefixRankedBarPattern, tree::UnrankedTree, tree::UnrankedPattern - > TreeTypes; - -typedef std::tuple< primitive::String, primitive::Integer, primitive::Character, primitive::Unsigned, primitive::Bool - > PrimitiveTypes; - -typedef std::tuple< container::ObjectsSet, container::ObjectsVector, container::ObjectsPair, container::ObjectsMap - > ContainerTypes; - -typedef std::tuple< alphabet::EndSymbol, alphabet::LabeledSymbol, alphabet::BlankSymbol, alphabet::BottomOfTheStackSymbol, alphabet::RankedSymbol, alphabet::BarSymbol, alphabet::VariablesBarSymbol, alphabet::SubtreeWildcardSymbol, alphabet::SymbolPairSymbol, alphabet::SymbolSetSymbol, alphabet::UniqueSymbol, alphabet::StartSymbol - > SymbolTypes; - -typedef std::tuple< string::Epsilon, string::LinearString, string::CyclicString - > StringTypes; - -typedef std::tuple< regexp::UnboundedRegExp, regexp::FormalRegExp - > RegExpTypes; - -typedef std::tuple< label::PrimitiveLabel, label::HexavigesimalLabel, label::ObjectLabel, label::LabelSetLabel, label::LabelPairLabel, label::UniqueLabel - > LabelTypes; - -typedef std::tuple< graph::DirectedGraph, graph::UndirectedGraph - > GraphTypes; - -typedef std::tuple< grammar::LeftLG, grammar::LeftRG, grammar::RightLG, grammar::RightRG, grammar::LG, grammar::CFG, grammar::EpsilonFreeCFG, grammar::CNF, grammar::GNF, grammar::CSG, grammar::NonContractingGrammar, grammar::ContextPreservingUnrestrictedGrammar, grammar::UnrestrictedGrammar - > GrammarTypes; - -typedef std::tuple< automaton::DFA, automaton::NFA, automaton::MultiInitialStateNFA, automaton::EpsilonNFA, automaton::CompactNFA, automaton::ExtendedNFA, automaton::DFTA, automaton::NFTA, automaton::DPDA, automaton::SinglePopDPDA, automaton::InputDrivenDPDA, automaton::VisiblyPushdownDPDA, automaton::RealTimeHeightDeterministicDPDA, automaton::NPDA, automaton::SinglePopNPDA, automaton::InputDrivenNPDA, automaton::VisiblyPushdownNPDA, automaton::RealTimeHeightDeterministicNPDA, automaton::OneTapeDTM - > AutomatonTypes; - -typedef std::tuple< Void, exception::AlibException - > OtherTypes; - -// -------------------------------------------------------------------------------------------------------------------- - -template<typename ... Ts> -class types_merger { -}; - -template<typename ... TreeTypes, typename ... PrimitiveTypes, typename ... ContainerTypes, typename ... SymbolTypes, typename ... StringTypes, typename ... RegExpTypes, typename ... LabelTypes, typename ... GraphTypes, typename ... GrammarTypes, typename ... AutomatonTypes, typename ... OtherTypes> -class types_merger<std::tuple<TreeTypes...>, std::tuple<PrimitiveTypes...>, std::tuple<ContainerTypes...>, std::tuple<SymbolTypes...>, std::tuple<StringTypes...>, std::tuple<RegExpTypes...>, std::tuple<LabelTypes...>, std::tuple<GraphTypes...>, std::tuple<GrammarTypes...>, std::tuple<AutomatonTypes...>, std::tuple<OtherTypes...>> { -public: - typedef std::tuple< - OtherTypes..., AutomatonTypes..., GrammarTypes..., GraphTypes..., LabelTypes..., RegExpTypes..., StringTypes..., SymbolTypes..., ContainerTypes..., PrimitiveTypes..., TreeTypes... - > MergedTypes; - -}; - -typedef types_merger<TreeTypes, PrimitiveTypes, ContainerTypes, SymbolTypes, StringTypes, RegExpTypes, LabelTypes, GraphTypes, GrammarTypes, AutomatonTypes, OtherTypes>::MergedTypes Types; - -// ---------------------------------------------------------------------------------------------------------------------- - -class ObjectBase; - -template<typename T> -class acceptor_base_helper { -}; - -template<typename ... Ts> -class acceptor_base_helper< std::tuple< Ts ... > > : - public std::acceptor_base< - ObjectBase, Ts ... - > { -}; - -typedef acceptor_base_helper< Types > VisitableObjectBase; - -// ---------------------------------------------------------------------------------------------------------------------- - -class ObjectBase : public alib::base<ObjectBase>, public VisitableObjectBase, public std::cow_shared_ptr_base { +class ObjectBase : public alib::base<ObjectBase>, public std::cow_shared_ptr_base { public: virtual void compose(std::deque<sax::Token>& out) const = 0; }; diff --git a/alib2data/src/object/Void.h b/alib2data/src/object/Void.h index 6b0356fa0fe35378eec8a41b669e075992ec7855..4979d3f0cfbe7ebb91d6597dd4a327cb7846c77b 100644 --- a/alib2data/src/object/Void.h +++ b/alib2data/src/object/Void.h @@ -17,7 +17,7 @@ namespace alib { /** * Represents void. */ -class Void : public std::acceptor<Void, VisitableObjectBase, ObjectBase> { +class Void : public ObjectBase { public: /** * Creates a blank symbol. diff --git a/alib2data/src/primitive/Bool.h b/alib2data/src/primitive/Bool.h index f6327aeaa69cf6cb0d932c9e78644aaf33f641c4..966a021152440ac6a1ddf8c9acf4d6bab1a18662 100644 --- a/alib2data/src/primitive/Bool.h +++ b/alib2data/src/primitive/Bool.h @@ -16,7 +16,7 @@ namespace primitive { /** * Represents symbol in an alphabet. */ -class Bool : public std::acceptor<Bool, VisitablePrimitiveBase, std::acceptor<Bool, alib::VisitableObjectBase, PrimitiveBase> > { +class Bool : public PrimitiveBase { protected: bool data; diff --git a/alib2data/src/primitive/Character.h b/alib2data/src/primitive/Character.h index 86793544ab6e54705b756a4a7c43d35e16e35462..2966b10d8577c38f57aeb0316d9aa75856ec5127 100644 --- a/alib2data/src/primitive/Character.h +++ b/alib2data/src/primitive/Character.h @@ -16,7 +16,7 @@ namespace primitive { /** * Represents symbol in an alphabet. */ -class Character : public std::acceptor<Character, VisitablePrimitiveBase, std::acceptor<Character, alib::VisitableObjectBase, PrimitiveBase> > { +class Character : public PrimitiveBase { protected: char data; diff --git a/alib2data/src/primitive/Integer.h b/alib2data/src/primitive/Integer.h index d3e96631fc9b4a9cfea5630e772cc741868488c3..8f9ce18bf7258bad7d0e07928a8bae73705b05b1 100644 --- a/alib2data/src/primitive/Integer.h +++ b/alib2data/src/primitive/Integer.h @@ -16,7 +16,7 @@ namespace primitive { /** * Represents symbol in an alphabet. */ -class Integer : public std::acceptor<Integer, VisitablePrimitiveBase, std::acceptor<Integer, alib::VisitableObjectBase, PrimitiveBase> > { +class Integer : public PrimitiveBase { protected: int data; diff --git a/alib2data/src/primitive/PrimitiveBase.h b/alib2data/src/primitive/PrimitiveBase.h index aa0c3df9f29bdf93a7a520c57dfe9fd741cfe0b6..f2529e99b08fdbc881bac0fe2a95b37e4f96f928 100644 --- a/alib2data/src/primitive/PrimitiveBase.h +++ b/alib2data/src/primitive/PrimitiveBase.h @@ -14,33 +14,11 @@ namespace primitive { -class PrimitiveBase; - -// ---------------------------------------------------------------------------------------------------------------------- - -template<typename T> -class acceptor_base_helper { -}; - -template<typename ... Ts> -class acceptor_base_helper< std::tuple< Ts ... > > : - public std::acceptor_base< - PrimitiveBase, Ts ... - > { -}; - -typedef acceptor_base_helper< alib::PrimitiveTypes > VisitablePrimitiveBase; - -// ---------------------------------------------------------------------------------------------------------------------- - /** * Represents symbol in an alphabet. */ -class PrimitiveBase : public alib::ObjectBase, public VisitablePrimitiveBase { +class PrimitiveBase : public alib::ObjectBase { public: - using VisitablePrimitiveBase::Accept; - using alib::VisitableObjectBase::Accept; - virtual PrimitiveBase* clone() const = 0; virtual PrimitiveBase* plunder() && = 0; diff --git a/alib2data/src/primitive/String.h b/alib2data/src/primitive/String.h index 668103f1802365f7b45528026566120e9c57f869..d9b02f7e4462e935cf0d05042dfd03258f38e323 100644 --- a/alib2data/src/primitive/String.h +++ b/alib2data/src/primitive/String.h @@ -17,7 +17,7 @@ namespace primitive { /** * Represents symbol in an alphabet. */ -class String : public std::acceptor<String, VisitablePrimitiveBase, std::acceptor<String, alib::VisitableObjectBase, PrimitiveBase> > { +class String : public PrimitiveBase { protected: std::string data; diff --git a/alib2data/src/primitive/Unsigned.h b/alib2data/src/primitive/Unsigned.h index 5b280ed7ae6ad1d98fb2b33e19874c0c6e5d8c17..27d4ffd6c67a8847b55c9befaed13eaa7a71dea9 100644 --- a/alib2data/src/primitive/Unsigned.h +++ b/alib2data/src/primitive/Unsigned.h @@ -16,7 +16,7 @@ namespace primitive { /** * Represents symbol in an alphabet. */ -class Unsigned : public std::acceptor<Unsigned, VisitablePrimitiveBase, std::acceptor<Unsigned, alib::VisitableObjectBase, PrimitiveBase> > { +class Unsigned : public PrimitiveBase { protected: unsigned data; diff --git a/alib2data/src/regexp/RegExpBase.h b/alib2data/src/regexp/RegExpBase.h index d9c4eff8da4e540a9fba281af8a35d40e35ec198..412b7ca4c9cd2a4ce1fd0799efa43de6a190b59b 100644 --- a/alib2data/src/regexp/RegExpBase.h +++ b/alib2data/src/regexp/RegExpBase.h @@ -10,36 +10,15 @@ #include "../object/ObjectBase.h" #include <set> +#include "../alphabet/Symbol.h" namespace regexp { -class RegExpBase; - -// ---------------------------------------------------------------------------------------------------------------------- - -template<typename T> -class acceptor_base_helper { -}; - -template<typename ... Ts> -class acceptor_base_helper< std::tuple< Ts ... > > : - public std::acceptor_base< - RegExpBase, Ts ... - > { -}; - -typedef acceptor_base_helper< alib::RegExpTypes > VisitableRegExpBase; - -// ---------------------------------------------------------------------------------------------------------------------- - /** * Represents symbol in an alphabet. */ -class RegExpBase : public alib::ObjectBase, public VisitableRegExpBase { +class RegExpBase : public alib::ObjectBase { public: - using VisitableRegExpBase::Accept; - using alib::VisitableObjectBase::Accept; - virtual RegExpBase* clone() const = 0; virtual RegExpBase* plunder() && = 0; diff --git a/alib2data/src/regexp/formal/FormalRegExp.h b/alib2data/src/regexp/formal/FormalRegExp.h index fcc1e706cf783ad66f2296d594f74fc882428d84..617e12cd707394b47d15fdd311fe62e194f90ab6 100644 --- a/alib2data/src/regexp/formal/FormalRegExp.h +++ b/alib2data/src/regexp/formal/FormalRegExp.h @@ -19,12 +19,13 @@ namespace regexp { class FormalRegExpElement; +class UnboundedRegExp; /** * Represents regular expression parsed from the XML. Regular expression is stored * as a tree of RegExpElement. */ -class FormalRegExp : public std::acceptor<FormalRegExp, VisitableRegExpBase, std::acceptor<FormalRegExp, alib::VisitableObjectBase, RegExpBase> >, public RegExpAlphabet { +class FormalRegExp : public RegExpBase, public RegExpAlphabet { protected: FormalRegExpElement* regExp; diff --git a/alib2data/src/regexp/unbounded/UnboundedRegExp.h b/alib2data/src/regexp/unbounded/UnboundedRegExp.h index c8406cf7e15bc7964759195fa4049bbd58b9e4e8..4b005b4fceced50dd0aeb38a353c086e1fca8ca6 100644 --- a/alib2data/src/regexp/unbounded/UnboundedRegExp.h +++ b/alib2data/src/regexp/unbounded/UnboundedRegExp.h @@ -19,12 +19,13 @@ namespace regexp { class UnboundedRegExpElement; +class FormalRegExp; /** * Represents regular expression parsed from the XML. Regular expression is stored * as a tree of RegExpElement. */ -class UnboundedRegExp : public std::acceptor<UnboundedRegExp, VisitableRegExpBase, std::acceptor<UnboundedRegExp, alib::VisitableObjectBase, RegExpBase> >, public RegExpAlphabet { +class UnboundedRegExp : public RegExpBase, public RegExpAlphabet { protected: UnboundedRegExpElement* regExp; diff --git a/alib2data/src/string/CyclicString.h b/alib2data/src/string/CyclicString.h index 87b5183eaa0fa45333f7beb6cf431547bf8a046c..a491125a3c82aabbcd3060685133c7e749e7c9dc 100644 --- a/alib2data/src/string/CyclicString.h +++ b/alib2data/src/string/CyclicString.h @@ -23,7 +23,7 @@ namespace string { * Represents regular expression parsed from the XML. Regular expression is stored * as a tree of CyclicStringElement. */ -class CyclicString : public std::acceptor<CyclicString, VisitableStringBase, std::acceptor<CyclicString, alib::VisitableObjectBase, StringBase> >, public StringAlphabet { +class CyclicString : public StringBase, public StringAlphabet { std::vector<alphabet::Symbol> m_Data; public: explicit CyclicString(); diff --git a/alib2data/src/string/Epsilon.h b/alib2data/src/string/Epsilon.h index 5d39ffa901f87c9c94b053807f9c26c44a153683..9ed52e012df1462a9b91f79dea9bdc997b05f390 100644 --- a/alib2data/src/string/Epsilon.h +++ b/alib2data/src/string/Epsilon.h @@ -22,7 +22,7 @@ namespace string { * Represents epsilon. Regular expression is stored * as a tree of EpsilonElement. */ -class Epsilon : public std::acceptor<Epsilon, VisitableStringBase, std::acceptor<Epsilon, alib::VisitableObjectBase, StringBase> >, public StringAlphabet { +class Epsilon : public StringBase, public StringAlphabet { public: Epsilon(); diff --git a/alib2data/src/string/LinearString.h b/alib2data/src/string/LinearString.h index 8d68d418ffaa66b36b1d8e37312ed7053d4ddd2e..2c1e6a4da7da5e9d5eddc2fe89f039a414a1fbae 100644 --- a/alib2data/src/string/LinearString.h +++ b/alib2data/src/string/LinearString.h @@ -25,7 +25,7 @@ namespace string { * Represents regular expression parsed from the XML. Regular expression is stored * as a tree of LinearStringElement. */ -class LinearString : public std::acceptor<LinearString, VisitableStringBase, std::acceptor<LinearString, alib::VisitableObjectBase, StringBase> >, public StringAlphabet { +class LinearString : public StringBase, public StringAlphabet { std::vector<alphabet::Symbol> m_Data; public: diff --git a/alib2data/src/string/StringBase.h b/alib2data/src/string/StringBase.h index 4f13ec411981cacde86bab205d32ebd93c6340c1..861f2f82d11059b6d623b3f936262c4489815d07 100644 --- a/alib2data/src/string/StringBase.h +++ b/alib2data/src/string/StringBase.h @@ -14,33 +14,11 @@ namespace string { -class StringBase; - -// ---------------------------------------------------------------------------------------------------------------------- - -template<typename T> -class acceptor_base_helper { -}; - -template<typename ... Ts> -class acceptor_base_helper< std::tuple< Ts ... > > : - public std::acceptor_base< - StringBase, Ts ... - > { -}; - -typedef acceptor_base_helper< alib::StringTypes > VisitableStringBase; - -// ---------------------------------------------------------------------------------------------------------------------- - /** * Represents symbol in an alphabet. */ -class StringBase : public alib::ObjectBase, public VisitableStringBase { +class StringBase : public alib::ObjectBase { public: - using VisitableStringBase::Accept; - using alib::VisitableObjectBase::Accept; - virtual StringBase* clone() const = 0; virtual StringBase* plunder() && = 0; diff --git a/alib2data/src/tree/TreeBase.h b/alib2data/src/tree/TreeBase.h index 0dc1cd522239b6203e25b422ca1adea1c670d576..110507cf4bca6a84798e0e00e7c6eaef2c6fe7cb 100644 --- a/alib2data/src/tree/TreeBase.h +++ b/alib2data/src/tree/TreeBase.h @@ -12,33 +12,11 @@ namespace tree { -class TreeBase; - -// ---------------------------------------------------------------------------------------------------------------------- - -template<typename T> -class acceptor_base_helper { -}; - -template<typename ... Ts> -class acceptor_base_helper< std::tuple< Ts ... > > : - public std::acceptor_base< - TreeBase, Ts ... - > { -}; - -typedef acceptor_base_helper< alib::TreeTypes > VisitableTreeBase; - -// ---------------------------------------------------------------------------------------------------------------------- - /** * Represents symbol in an alphabet. */ -class TreeBase : public alib::ObjectBase, public VisitableTreeBase { +class TreeBase : public alib::ObjectBase { public: - using VisitableTreeBase::Accept; - using alib::VisitableObjectBase::Accept; - virtual TreeBase* clone() const = 0; virtual TreeBase* plunder() && = 0; }; diff --git a/alib2data/src/tree/ranked/PrefixRankedBarPattern.h b/alib2data/src/tree/ranked/PrefixRankedBarPattern.h index 920b6cd6410dbeb31d3463396e4f6c2c33cb274b..65edc24798508d3e174c19097e42a6f5c7ebabd5 100644 --- a/alib2data/src/tree/ranked/PrefixRankedBarPattern.h +++ b/alib2data/src/tree/ranked/PrefixRankedBarPattern.h @@ -18,11 +18,13 @@ namespace tree { +class RankedPattern; + /** * Represents regular expression parsed from the XML. Regular expression is stored * as a tree of LinearStringElement. */ -class PrefixRankedBarPattern : public std::acceptor<PrefixRankedBarPattern, VisitableTreeBase, std::acceptor<PrefixRankedBarPattern, alib::VisitableObjectBase, TreeBase> >, public RankedPatternAlphabet { +class PrefixRankedBarPattern : public TreeBase, public RankedPatternAlphabet { std::vector<alphabet::RankedSymbol> m_Data; alphabet::Symbol bar; diff --git a/alib2data/src/tree/ranked/PrefixRankedBarTree.h b/alib2data/src/tree/ranked/PrefixRankedBarTree.h index b3b1e4d9ec98e8110fcc30a584b1b6f0cf2b3222..c8b5891a642c29bc28b04ccc626cbbee83c2e92a 100644 --- a/alib2data/src/tree/ranked/PrefixRankedBarTree.h +++ b/alib2data/src/tree/ranked/PrefixRankedBarTree.h @@ -18,11 +18,13 @@ namespace tree { +class RankedTree; + /** * Represents regular expression parsed from the XML. Regular expression is stored * as a tree of LinearStringElement. */ -class PrefixRankedBarTree : public std::acceptor<PrefixRankedBarTree, VisitableTreeBase, std::acceptor<PrefixRankedBarTree, alib::VisitableObjectBase, TreeBase> >, public RankedAlphabet { +class PrefixRankedBarTree : public TreeBase, public RankedAlphabet { std::vector<alphabet::RankedSymbol> m_Data; alphabet::Symbol bar; diff --git a/alib2data/src/tree/ranked/PrefixRankedPattern.h b/alib2data/src/tree/ranked/PrefixRankedPattern.h index 7cb25ff45a619c5692a21125966bdb0c03f45f60..969bb9edd10c486beec8b7e1c02f4eb81226ef63 100644 --- a/alib2data/src/tree/ranked/PrefixRankedPattern.h +++ b/alib2data/src/tree/ranked/PrefixRankedPattern.h @@ -17,11 +17,13 @@ namespace tree { +class RankedPattern; + /** * Represents regular expression parsed from the XML. Regular expression is stored * as a tree of LinearStringElement. */ -class PrefixRankedPattern : public std::acceptor<PrefixRankedPattern, VisitableTreeBase, std::acceptor<PrefixRankedPattern, alib::VisitableObjectBase, TreeBase> >, public RankedPatternAlphabet { +class PrefixRankedPattern : public TreeBase, public RankedPatternAlphabet { std::vector<alphabet::RankedSymbol> m_Data; public: diff --git a/alib2data/src/tree/ranked/PrefixRankedTree.h b/alib2data/src/tree/ranked/PrefixRankedTree.h index bc6c8aa986037a0ce9ed23520946a4c1398d3ccd..461bca8fe02e23c9b99356b0686ca8e713749cf9 100644 --- a/alib2data/src/tree/ranked/PrefixRankedTree.h +++ b/alib2data/src/tree/ranked/PrefixRankedTree.h @@ -17,11 +17,13 @@ namespace tree { +class RankedTree; + /** * Represents regular expression parsed from the XML. Regular expression is stored * as a tree of LinearStringElement. */ -class PrefixRankedTree : public std::acceptor<PrefixRankedTree, VisitableTreeBase, std::acceptor<PrefixRankedTree, alib::VisitableObjectBase, TreeBase> >, public RankedAlphabet { +class PrefixRankedTree : public TreeBase, public RankedAlphabet { std::vector<alphabet::RankedSymbol> m_Data; public: diff --git a/alib2data/src/tree/ranked/RankedPattern.h b/alib2data/src/tree/ranked/RankedPattern.h index 34168327d59cad7d2c830cd669dc9f94ef435f94..d19277b8557db5d023696d65b6ee32212ba199e6 100644 --- a/alib2data/src/tree/ranked/RankedPattern.h +++ b/alib2data/src/tree/ranked/RankedPattern.h @@ -19,12 +19,13 @@ namespace tree { class RankedNode; +class UnrankedPattern; /** * Represents regular expression parsed from the XML. Regular expression is stored * as a pattern of RegExpElement. */ -class RankedPattern : public std::acceptor<RankedPattern, VisitableTreeBase, std::acceptor<RankedPattern, alib::VisitableObjectBase, TreeBase> >, public RankedPatternAlphabet { +class RankedPattern : public TreeBase, public RankedPatternAlphabet { protected: RankedNode* pattern; diff --git a/alib2data/src/tree/ranked/RankedTree.h b/alib2data/src/tree/ranked/RankedTree.h index 61425707651722e14861a44e1dc97ac9285304e3..9c9eeedece1220436c8a7ccbd88f5f2fb04aa5f1 100644 --- a/alib2data/src/tree/ranked/RankedTree.h +++ b/alib2data/src/tree/ranked/RankedTree.h @@ -19,12 +19,13 @@ namespace tree { class RankedNode; +class UnrankedTree; /** * Represents regular expression parsed from the XML. Regular expression is stored * as a tree of RegExpElement. */ -class RankedTree : public std::acceptor<RankedTree, VisitableTreeBase, std::acceptor<RankedTree, alib::VisitableObjectBase, TreeBase> >, public RankedAlphabet { +class RankedTree : public TreeBase, public RankedAlphabet { protected: RankedNode* tree; diff --git a/alib2data/src/tree/unranked/UnrankedPattern.h b/alib2data/src/tree/unranked/UnrankedPattern.h index 9f43ddcc43d3f2dfb99b0da56b84d53bf8154983..bcfea83bf565ef4639d056023abc8bb0e10bc69d 100644 --- a/alib2data/src/tree/unranked/UnrankedPattern.h +++ b/alib2data/src/tree/unranked/UnrankedPattern.h @@ -19,12 +19,13 @@ namespace tree { class UnrankedNode; +class RankedPattern; /** * Represents regular expression parsed from the XML. Regular expression is stored * as a pattern of RegExpElement. */ -class UnrankedPattern : public std::acceptor<UnrankedPattern, VisitableTreeBase, std::acceptor<UnrankedPattern, alib::VisitableObjectBase, TreeBase> >, public UnrankedPatternAlphabet { +class UnrankedPattern : public TreeBase, public UnrankedPatternAlphabet { protected: UnrankedNode* pattern; diff --git a/alib2data/src/tree/unranked/UnrankedTree.h b/alib2data/src/tree/unranked/UnrankedTree.h index 2c14c8da75cc2b58cc9363c28ad72d3a924bdb04..732abc1dda946fe0a78f083b9654626e97648144 100644 --- a/alib2data/src/tree/unranked/UnrankedTree.h +++ b/alib2data/src/tree/unranked/UnrankedTree.h @@ -19,12 +19,13 @@ namespace tree { class UnrankedNode; +class RankedTree; /** * Represents regular expression parsed from the XML. Regular expression is stored * as a tree of RegExpElement. */ -class UnrankedTree : public std::acceptor<UnrankedTree, VisitableTreeBase, std::acceptor<UnrankedTree, alib::VisitableObjectBase, TreeBase> >, public UnrankedAlphabet { +class UnrankedTree : public TreeBase, public UnrankedAlphabet { protected: UnrankedNode* tree;