diff --git a/aaccess2/src/aaccess.cpp b/aaccess2/src/aaccess.cpp index 7e9f30f1220d1aa880b65141e2e96464ee835a99..afa79af345d7174a2dfa5383aa3cec42ef37093c 100644 --- a/aaccess2/src/aaccess.cpp +++ b/aaccess2/src/aaccess.cpp @@ -180,7 +180,7 @@ int main ( int argc, char * argv[] ) { } if ( operation.getValue ( ) == "add" || operation.getValue ( ) == "remove" ) - cliString += " $argument"; + cliString += " $argument >"; if ( operation.getValue ( ) == "get" ) { cliString += " >$output"; diff --git a/alib2algo/src/regexp/convert/ToAutomaton.cpp b/alib2algo/src/regexp/convert/ToAutomaton.cpp index ba158c333f40dd6d7450b310ed547d4719d94218..a19886af74698670f0ca609da7d6d3a4f38055f5 100644 --- a/alib2algo/src/regexp/convert/ToAutomaton.cpp +++ b/alib2algo/src/regexp/convert/ToAutomaton.cpp @@ -12,8 +12,17 @@ namespace regexp { namespace convert { -auto ToAutomatonFormalRegExp = registration::AbstractRegister < ToAutomaton, automaton::NFA < DefaultSymbolType, ext::pair < DefaultSymbolType, unsigned > >, const regexp::FormalRegExp < > & > ( ToAutomaton::convert ); -auto ToAutomatonUnboundedRegExp = registration::AbstractRegister < ToAutomaton, automaton::NFA < DefaultSymbolType, ext::pair < DefaultSymbolType, unsigned > >, const regexp::UnboundedRegExp < > & > ( ToAutomaton::convert ); +auto ToAutomatonFormalRegExp = registration::AbstractRegister < ToAutomaton, automaton::NFA < DefaultSymbolType, ext::pair < DefaultSymbolType, unsigned > >, const regexp::FormalRegExp < > & > ( ToAutomaton::convert, "regexp" ).setDocumentation ( +"Converts the regular expression into an automaton (@sa regexp::convert::ToGlushkovAutomaton::convert).\n\ +\n\ +@param regexp the regular expression\n\ +@return finite automaotn equivalent to original regular expression" ); + +auto ToAutomatonUnboundedRegExp = registration::AbstractRegister < ToAutomaton, automaton::NFA < DefaultSymbolType, ext::pair < DefaultSymbolType, unsigned > >, const regexp::UnboundedRegExp < > & > ( ToAutomaton::convert, "regexp" ).setDocumentation ( +"Converts the regular expression into an automaton (@sa regexp::convert::ToGlushkovAutomaton::convert).\n\ +\n\ +@param regexp the regular expression\n\ +@return finite automaotn equivalent to original regular expression" ); } /* namespace convert */ diff --git a/alib2algo/src/regexp/convert/ToAutomaton.h b/alib2algo/src/regexp/convert/ToAutomaton.h index 516d01a302025404581204ff44193154c6c0e855..8de21c97231864dc8629cad35ad6ee80323825af 100644 --- a/alib2algo/src/regexp/convert/ToAutomaton.h +++ b/alib2algo/src/regexp/convert/ToAutomaton.h @@ -19,14 +19,34 @@ namespace regexp { namespace convert { +/** + * Conversion of regular expression to finite automata. + * This class serves as a "default wrapper" over the conversion of RE to FA. It delegates to the glushkov conversion algorithm. + * @sa regexp::convert::ToGlushkovAutomaton + */ class ToAutomaton { public: /** - * Performs conversion. - * @return FSM equivalent to original regular expression. + * Converts the regular expression into an automaton (@sa regexp::convert::ToGlushkovAutomaton::convert). + * + * \tparam SymbolType the type of regular expression + * + * \param regexp the regular expression + * + * \return finite automaotn equivalent to original regular expression. */ template < class SymbolType > static automaton::NFA < SymbolType, ext::pair < SymbolType, unsigned > > convert ( const regexp::FormalRegExp < SymbolType > & regexp ); + + /** + * Converts the regular expression into an automaton (@sa regexp::convert::ToGlushkovAutomaton::convert). + * + * \tparam SymbolType the type of regular expression + * + * \param regexp the regular expression + * + * \return finite automaotn equivalent to original regular expression. + */ template < class SymbolType > static automaton::NFA < SymbolType, ext::pair < SymbolType, unsigned > > convert ( const regexp::UnboundedRegExp < SymbolType > & regexp ); diff --git a/alib2common/src/core/components/setComponents.hpp b/alib2common/src/core/components/setComponents.hpp index 1b836b24671fc9eec2e58df115747da1cfe2b086..d2a55da17a663c6630ebc97f0cd2c54bfa9e77fc 100644 --- a/alib2common/src/core/components/setComponents.hpp +++ b/alib2common/src/core/components/setComponents.hpp @@ -137,9 +137,10 @@ public: * @param elements to add to the set * @throw CommonException if one of the elements is not available in context of datatype where the set is used */ - void add ( SetComponentType data ) { + Derived & add ( SetComponentType data ) { for ( ComponentType element : ext::make_mover ( data ) ) add ( std::move ( element ) ); + return static_cast < Derived & > ( * this ); } /** @@ -148,10 +149,11 @@ public: * @throw CommonException if one of the removed elements is used in context of datatype where the set is used * CommonException if one of the added elements is not available in context of datatype where the set is used */ - void set ( SetComponentType data ) { + Derived & set ( SetComponentType data ) { ext::set_symmetric_difference ( m_data.begin ( ), m_data.end ( ), data.begin ( ), data.end ( ), ext::make_callback_iterator < const ComponentType & > ( std::bind ( & SetComponent::checkRemove, this, std::placeholders::_1 ) ), ext::make_callback_iterator < const ComponentType & > ( std::bind ( & SetComponent::checkAdd, this, std::placeholders::_1 ) ) ); m_data = std::move ( data ); + return static_cast < Derived & > ( * this ); } /** @@ -183,9 +185,10 @@ public: * Removes a set of elements from alphabet if not used. * @throw CommonException if element is used in context of datatype where the set is used */ - void remove ( const SetComponentType & data ) { + Derived & remove ( const SetComponentType & data ) { for ( const ComponentType & element : data ) remove ( element ); + return static_cast < Derived & > ( * this ); } /** @@ -247,19 +250,19 @@ public: const ComponentType & ( Derived::* constGetMethod ) ( ) const = & SetComponent < Derived, ComponentType, typename ComponentType::value_type, ComponentName >::get; abstraction::AlgorithmRegistry::registerMethod < ComponentName > ( constGetMethod, "get", emptyNames ); - void ( Derived::* setMethod ) ( ComponentType ) = & SetComponent < Derived, ComponentType, typename ComponentType::value_type, ComponentName >::set; + Derived & ( Derived::* setMethod ) ( ComponentType ) = & SetComponent < Derived, ComponentType, typename ComponentType::value_type, ComponentName >::set; abstraction::AlgorithmRegistry::registerMethod < ComponentName > ( setMethod, "set", dataNames ); bool ( Derived::* addElement ) ( typename ComponentType::value_type ) = & SetComponent < Derived, ComponentType, typename ComponentType::value_type, ComponentName >::add; abstraction::AlgorithmRegistry::registerMethod < ComponentName > ( addElement, "add", elementNames ); - void ( Derived::* addSet ) ( ComponentType ) = & SetComponent < Derived, ComponentType, typename ComponentType::value_type, ComponentName >::add; + Derived & ( Derived::* addSet ) ( ComponentType ) = & SetComponent < Derived, ComponentType, typename ComponentType::value_type, ComponentName >::add; abstraction::AlgorithmRegistry::registerMethod < ComponentName > ( addSet, "add", dataNames ); bool ( Derived::* removeElement ) ( const typename ComponentType::value_type & ) = & SetComponent < Derived, ComponentType, typename ComponentType::value_type, ComponentName >::remove; abstraction::AlgorithmRegistry::registerMethod < ComponentName > ( removeElement, "remove", elementNames ); - void ( Derived::* removeSet ) ( const ComponentType & ) = & SetComponent < Derived, ComponentType, typename ComponentType::value_type, ComponentName >::remove; + Derived & ( Derived::* removeSet ) ( const ComponentType & ) = & SetComponent < Derived, ComponentType, typename ComponentType::value_type, ComponentName >::remove; abstraction::AlgorithmRegistry::registerMethod < ComponentName > ( removeSet, "remove", dataNames ); bool ( Derived::* emptyMethod ) ( ) const = & SetComponent < Derived, ComponentType, typename ComponentType::value_type, ComponentName >::empty;