diff --git a/alib2algo/src/automaton/determinize/common/RHDPDACommon.cpp b/alib2algo/src/automaton/determinize/common/RHDPDACommon.cpp index d62e952e4fa20b28b7bd8230ee7fafd068f63404..0366207e9af82884aae5786fadc066d54b6d178d 100644 --- a/alib2algo/src/automaton/determinize/common/RHDPDACommon.cpp +++ b/alib2algo/src/automaton/determinize/common/RHDPDACommon.cpp @@ -34,7 +34,7 @@ std::set<std::pair<label::Label, label::Label>> unpackFromStateLabel(const label label::Label packToStackSymbolLabel(std::pair<std::set<std::pair<label::Label, label::Label>>, alphabet::Symbol>&& data) { label::Label res1 = packToStateLabel(std::move(data.first)); - label::Label res2 = label::Label(label::ObjectLabel(alib::Object(std::move(data.second.getData())))); + label::Label res2 = label::Label(std::move(data.second)); return label::Label(label::LabelPairLabel(std::make_pair(std::move(res1), std::move(res2)))); } @@ -54,7 +54,7 @@ label::Label packToStackSymbolLabel(std::pair<std::set<std::pair<label::Label, l label::Label res2 = label::Label(label::ObjectLabel(alib::Object(std::move(data.second.get<string::Epsilon < >>())))); return label::Label(label::LabelPairLabel(std::make_pair(std::move(res1), std::move(res2)))); } else { - label::Label res2 = label::Label(label::ObjectLabel(alib::Object(std::move(data.second.get<alphabet::Symbol>().getData())))); + label::Label res2 = label::Label(std::move(data.second.get<alphabet::Symbol>())); return label::Label(label::LabelPairLabel(std::make_pair(std::move(res1), std::move(res2)))); } } diff --git a/alib2algo/src/grammar/convert/ToAutomaton.cpp b/alib2algo/src/grammar/convert/ToAutomaton.cpp index 628809810e19b82c92d3367c0e9f88e57f017e1e..c0985a08539a37197d586555961c2b4409c9201b 100644 --- a/alib2algo/src/grammar/convert/ToAutomaton.cpp +++ b/alib2algo/src/grammar/convert/ToAutomaton.cpp @@ -8,7 +8,6 @@ #include <common/createUnique.hpp> -#include <label/ObjectLabel.h> #include <label/Label.h> #include <label/InitialStateLabel.h> #include <label/FinalStateLabel.h> @@ -27,7 +26,7 @@ automaton::NFA < > ToAutomaton::convert(const grammar::LeftRG < > & grammar) { // step 2 for(const auto& symbol : grammar.getNonterminalAlphabet()) { - label::Label state( label::ObjectLabel ( alib::Object ( symbol.getData() ) )); + label::Label state( symbol ); states.insert(state); stateMap.insert(std::make_pair(symbol, state)); } @@ -70,7 +69,7 @@ automaton::NFA < > ToAutomaton::convert(const grammar::RightRG < > & grammar) { // step2 for(const auto& symbol : grammar.getNonterminalAlphabet()) { - label::Label state( label::ObjectLabel ( alib::Object ( symbol.getData() ) )); + label::Label state( symbol ); states.insert(state); stateMap.insert(std::make_pair(symbol, state)); } diff --git a/alib2algo/src/regexp/convert/ToAutomatonGlushkov.cpp b/alib2algo/src/regexp/convert/ToAutomatonGlushkov.cpp index 9accdd3034c55c0e58c5e044336722462e5cd214..2ba237670025010e790e5c907c63df62ebc71226 100644 --- a/alib2algo/src/regexp/convert/ToAutomatonGlushkov.cpp +++ b/alib2algo/src/regexp/convert/ToAutomatonGlushkov.cpp @@ -9,10 +9,8 @@ #include "label/Label.h" #include "label/LabelPairLabel.h" -#include "label/ObjectLabel.h" #include <automaton/Automaton.h> -#include "object/Object.h" #include <global/GlobalData.h> #include "../glushkov/GlushkovFirst.h" @@ -48,24 +46,24 @@ automaton::NFA < > ToAutomatonGlushkov::convert ( const regexp::UnboundedRegExp // step 5 for ( auto const & symbol : indexedRegExp.getAlphabet ( ) ) - automaton.addState ( label::Label ( label::ObjectLabel ( alib::Object ( symbol.getData ( ) ) ) ) ); + automaton.addState ( label::Label ( symbol ) ); // step 6 for ( auto const & symbol : first ) - automaton.addTransition ( q0, regexp::GlushkovIndexate::getSymbolFromGlushkovPair ( symbol.getSymbol ( ) ), label::Label ( label::ObjectLabel ( alib::Object ( symbol.getSymbol ( ).getData ( ) ) ) ) ); + automaton.addTransition ( q0, regexp::GlushkovIndexate::getSymbolFromGlushkovPair ( symbol.getSymbol ( ) ), label::Label ( symbol.getSymbol ( ) ) ); for ( const auto & x : indexedRegExp.getAlphabet ( ) ) for ( const auto & f : regexp::GlushkovFollow::follow ( indexedRegExp, UnboundedRegExpSymbol < alphabet::Symbol > ( x ) ) ) { const alphabet::Symbol & p = x; const alphabet::Symbol & q = f.getSymbol ( ); - automaton.addTransition ( label::Label ( label::ObjectLabel ( alib::Object ( p.getData ( ) ) ) ), regexp::GlushkovIndexate::getSymbolFromGlushkovPair ( q ), label::Label ( label::ObjectLabel ( alib::Object ( q.getData ( ) ) ) ) ); + automaton.addTransition ( label::Label ( p ), regexp::GlushkovIndexate::getSymbolFromGlushkovPair ( q ), label::Label ( q ) ); } // step 7 for ( auto const & symbol : last ) - automaton.addFinalState ( label::Label ( label::ObjectLabel ( alib::Object ( symbol.getSymbol ( ).getData ( ) ) ) ) ); + automaton.addFinalState ( label::Label ( symbol.getSymbol ( ) ) ); if ( regexp::properties::RegExpEpsilon::languageContainsEpsilon ( regexp ) ) automaton.addFinalState ( q0 ); diff --git a/alib2algo/src/regexp/convert/ToGrammarRightRGGlushkov.cpp b/alib2algo/src/regexp/convert/ToGrammarRightRGGlushkov.cpp index f9c1d3fbb461eb82efe877f4756b3fbf95bf4a90..5787d758647f73b1fb2486fd419c22b30394058b 100644 --- a/alib2algo/src/regexp/convert/ToGrammarRightRGGlushkov.cpp +++ b/alib2algo/src/regexp/convert/ToGrammarRightRGGlushkov.cpp @@ -12,9 +12,6 @@ #include <alphabet/InitialSymbol.h> #include <label/LabelPairLabel.h> -#include <label/ObjectLabel.h> - -#include <object/Object.h> #include "../glushkov/GlushkovFollow.h" #include "../glushkov/GlushkovIndexate.h" diff --git a/alib2data/src/alphabet/Symbol.cpp b/alib2data/src/alphabet/Symbol.cpp index 9d5828dbb73021b59fe55feac5eed15198c1b21a..5d188ac29f3650ce98097308ed9dfc53bcfb9c2f 100644 --- a/alib2data/src/alphabet/Symbol.cpp +++ b/alib2data/src/alphabet/Symbol.cpp @@ -8,6 +8,7 @@ #include "Symbol.h" #include "LabeledSymbol.h" #include <core/xmlApi.hpp> +#include "label/Label.h" namespace alphabet { @@ -15,7 +16,10 @@ void Symbol::inc ( ) { this->operator ++ ( ); } -Symbol::Symbol ( label::Label label ) : alib::WrapperBase < SymbolBase > ( alphabet::LabeledSymbol { std::move ( label ) } ) { +Symbol::Symbol ( const label::Label & label ) : alib::WrapperBase < SymbolBase > ( alphabet::LabeledSymbol { label } ) { +} + +Symbol::Symbol ( label::Label && label ) : alib::WrapperBase < SymbolBase > ( alphabet::LabeledSymbol { std::move ( label ) } ) { } Symbol::Symbol ( int number ) : Symbol ( label::Label ( number ) ) { diff --git a/alib2data/src/alphabet/Symbol.h b/alib2data/src/alphabet/Symbol.h index 6a2012e6d8447374b1841fac3cd90917bf90d5c9..9ee50e0d2498e7000fcd1050487c70f4f35ead40 100644 --- a/alib2data/src/alphabet/Symbol.h +++ b/alib2data/src/alphabet/Symbol.h @@ -14,7 +14,7 @@ #include <set> #include <string> -#include <label/Label.h> +#include <label/LabelFeatures.h> namespace alphabet { @@ -25,7 +25,8 @@ class Symbol : public alib::WrapperBase < SymbolBase > { using alib::WrapperBase < SymbolBase >::WrapperBase; public: - explicit Symbol ( label::Label label ); + explicit Symbol ( const label::Label & label ); + explicit Symbol ( label::Label && label ); explicit Symbol ( int number ); explicit Symbol ( char character ); explicit Symbol ( std::string string ); diff --git a/alib2data/src/label/Label.cpp b/alib2data/src/label/Label.cpp index fe4eb5af54fdc5de578afeb08b024ff382269a09..752f31a6d1db0a9237ce0770b6624a186e169a54 100644 --- a/alib2data/src/label/Label.cpp +++ b/alib2data/src/label/Label.cpp @@ -10,6 +10,9 @@ #include "LabelPairLabel.h" #include <primitive/Primitive.h> #include <core/xmlApi.hpp> +#include <object/Object.h> +#include "ObjectLabel.h" +#include <alphabet/Symbol.h> namespace label { @@ -17,6 +20,12 @@ void Label::inc ( ) { this->operator ++ (); } +Label::Label ( const alphabet::Symbol & symbol ) : alib::WrapperBase < LabelBase > ( label::ObjectLabel ( alib::Object ( symbol.getData ( ) ) ) ) { +} + +Label::Label ( alphabet::Symbol && symbol ) : alib::WrapperBase < LabelBase > ( label::ObjectLabel ( alib::Object ( std::move ( symbol.getData ( ) ) ) ) ) { +} + Label::Label ( int number ) : alib::WrapperBase < LabelBase > ( label::PrimitiveLabel ( primitive::Primitive ( number ) ) ) { } diff --git a/alib2data/src/label/Label.h b/alib2data/src/label/Label.h index e9f15243270d4e1ad1d6874fbeeddb17458ef387..aa0e2ba4d0b61cadb232cfb7174e7eef3ec0b11f 100644 --- a/alib2data/src/label/Label.h +++ b/alib2data/src/label/Label.h @@ -12,6 +12,7 @@ #include "LabelBase.h" #include <set> +#include <alphabet/SymbolFeatures.h> namespace label { @@ -22,6 +23,8 @@ class Label : public alib::WrapperBase < LabelBase > { using alib::WrapperBase < LabelBase >::WrapperBase; public: + explicit Label ( const alphabet::Symbol & ); + explicit Label ( alphabet::Symbol && ); explicit Label ( label::Label label1, label::Label label2 ); explicit Label ( int number ); explicit Label ( int number1, int number2 );