diff --git a/alib2data/src/string/LinearString.cpp b/alib2data/src/string/LinearString.cpp index 4a81a320c296b26e7180027622397ad29b4a1a66..864b9ef35fd8ad7e2ead054d0885d91d927c2c40 100644 --- a/alib2data/src/string/LinearString.cpp +++ b/alib2data/src/string/LinearString.cpp @@ -19,6 +19,9 @@ auto linearStringType = registration::TypeRegister < string::String, string::Lin auto linearStringType2 = registration::TypeRegister < alib::Object, string::LinearString < > > ( ); auto LinearStringFromEpsilon = registration::CastRegister < string::LinearString < >, string::Epsilon < > > ( ); + +auto LinearStringFromPostfixRankedTree = registration::CastRegister < string::LinearString < common::ranked_symbol < DefaultSymbolType, DefaultRankType > >, tree::PostfixRankedTree < > > ( ); + auto LinearStringFromPrefixBarTree = registration::CastRegister < string::LinearString < >, tree::PrefixBarTree < > > ( ); auto LinearStringFromPrefixRankedTree = registration::CastRegister < string::LinearString < common::ranked_symbol < DefaultSymbolType, DefaultRankType > >, tree::PrefixRankedTree < > > ( ); diff --git a/alib2data/src/string/LinearString.h b/alib2data/src/string/LinearString.h index 8580f76e018fd539f4c1edb58c833d814e39ad32..20b99827e60b7bb257a7065fe63c1980889668d9 100644 --- a/alib2data/src/string/LinearString.h +++ b/alib2data/src/string/LinearString.h @@ -40,6 +40,7 @@ class LinearString final : public StringBase, public alib::Components < LinearSt public: explicit LinearString ( ); + template < class TreeSymbolType, class TreeRankType > explicit LinearString ( const tree::PrefixRankedTree < TreeSymbolType, TreeRankType > & tree ); template < class TreeSymbolType, class TreeRankType > @@ -52,7 +53,12 @@ public: explicit LinearString ( const tree::PrefixRankedBarPattern < TreeSymbolType, TreeRankType > & tree ); template < class TreeSymbolType, class TreeRankType > explicit LinearString ( const tree::PrefixRankedBarNonlinearPattern < TreeSymbolType, TreeRankType > & tree ); + explicit LinearString ( const tree::PrefixBarTree < SymbolType > & tree ); + + template < class TreeSymbolType, class TreeRankType > + explicit LinearString ( const tree::PostfixRankedTree < TreeSymbolType, TreeRankType > & tree ); + explicit LinearString ( ext::set < SymbolType > alphabet, ext::vector < SymbolType > str ); explicit LinearString ( ext::vector < SymbolType > str ); explicit LinearString ( const std::string & str ); @@ -132,7 +138,11 @@ public: #include "../tree/ranked/PrefixRankedBarTree.h" #include "../tree/ranked/PrefixRankedBarPattern.h" #include "../tree/ranked/PrefixRankedBarNonlinearPattern.h" + #include "../tree/unranked/PrefixBarTree.h" + +#include "../tree/ranked/PostfixRankedTree.h" + #include "../tree/common/TreeAuxiliary.h" namespace string { @@ -196,6 +206,11 @@ template < class SymbolType > LinearString < SymbolType >::LinearString ( const tree::PrefixBarTree < SymbolType > & tree ) : LinearString ( tree.getAlphabet ( ), tree.getContent ( ) ) { } +template < class SymbolType > +template < class TreeSymbolType, class TreeRankType > +LinearString < SymbolType >::LinearString ( const tree::PostfixRankedTree < TreeSymbolType, TreeRankType > & tree ) : LinearString ( tree.getAlphabet ( ), tree.getContent ( ) ) { +} + template < class SymbolType > StringBase * LinearString < SymbolType >::clone ( ) const { return new LinearString ( * this );