From f9eef7f9ebdedd9eb1914a50ea413db9cc31f3e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Tr=C3=A1vn=C3=AD=C4=8Dek?= <jan.travnicek@fit.cvut.cz> Date: Thu, 13 Jan 2022 18:55:28 +0100 Subject: [PATCH] data: introduce more visitor acceptors into formal regexp and rte --- .../regexp/formal/FormalRegExpAlternation.h | 9 +- .../regexp/formal/FormalRegExpConcatenation.h | 9 +- .../src/regexp/formal/FormalRegExpElement.h | 102 +++++++++++++++++- .../src/regexp/formal/FormalRegExpEmpty.h | 9 +- .../src/regexp/formal/FormalRegExpEpsilon.h | 9 +- .../src/regexp/formal/FormalRegExpIteration.h | 9 +- .../src/regexp/formal/FormalRegExpSymbol.h | 9 +- .../src/rte/formal/FormalRTEAlternation.h | 15 ++- alib2data/src/rte/formal/FormalRTEElement.h | 102 +++++++++++++++++- alib2data/src/rte/formal/FormalRTEEmpty.h | 15 ++- alib2data/src/rte/formal/FormalRTEIteration.h | 15 ++- .../src/rte/formal/FormalRTESubstitution.h | 15 ++- .../src/rte/formal/FormalRTESymbolAlphabet.h | 15 ++- .../src/rte/formal/FormalRTESymbolSubst.h | 15 ++- 14 files changed, 312 insertions(+), 36 deletions(-) diff --git a/alib2data/src/regexp/formal/FormalRegExpAlternation.h b/alib2data/src/regexp/formal/FormalRegExpAlternation.h index 301887a86c..18456ca67f 100644 --- a/alib2data/src/regexp/formal/FormalRegExpAlternation.h +++ b/alib2data/src/regexp/formal/FormalRegExpAlternation.h @@ -40,10 +40,17 @@ class FormalRegExpAlternation : public ext::BinaryNode < FormalRegExpElement < S /** * @copydoc regexp::FormalRegExpElement < SymbolType >::accept ( ) const */ - void accept ( typename FormalRegExpElement < SymbolType >::Visitor & visitor ) const override { + void accept ( typename FormalRegExpElement < SymbolType >::Visitor & visitor ) const & override { visitor.visit ( * this ); } + /** + * @copydoc regexp::FormalRegExpElement < SymbolType >::accept ( ) const + */ + void accept ( typename FormalRegExpElement < SymbolType >::RvalueVisitor & visitor ) && override { + visitor.visit ( std::move ( * this ) ); + } + public: /** * \brief Creates a new instance of the alternation node with explicit alternated elements diff --git a/alib2data/src/regexp/formal/FormalRegExpConcatenation.h b/alib2data/src/regexp/formal/FormalRegExpConcatenation.h index 0fb9dd13cf..4f537fa79c 100644 --- a/alib2data/src/regexp/formal/FormalRegExpConcatenation.h +++ b/alib2data/src/regexp/formal/FormalRegExpConcatenation.h @@ -40,10 +40,17 @@ class FormalRegExpConcatenation : public ext::BinaryNode < FormalRegExpElement < /** * @copydoc regexp::FormalRegExpElement < SymbolType >::accept ( ) const */ - void accept ( typename FormalRegExpElement < SymbolType >::Visitor & visitor ) const override { + void accept ( typename FormalRegExpElement < SymbolType >::Visitor & visitor ) const & override { visitor.visit ( * this ); } + /** + * @copydoc regexp::FormalRegExpElement < SymbolType >::accept ( ) const + */ + void accept ( typename FormalRegExpElement < SymbolType >::RvalueVisitor & visitor ) && override { + visitor.visit ( std::move ( * this ) ); + } + public: /** * \brief Creates a new instance of the concatenation node with explicit concatenated elements diff --git a/alib2data/src/regexp/formal/FormalRegExpElement.h b/alib2data/src/regexp/formal/FormalRegExpElement.h index 548249abba..8cabef5ed9 100644 --- a/alib2data/src/regexp/formal/FormalRegExpElement.h +++ b/alib2data/src/regexp/formal/FormalRegExpElement.h @@ -70,6 +70,20 @@ protected: virtual void visit ( const FormalRegExpEpsilon < SymbolType > & ) = 0; }; + /** + * Visitor interface of the element. + */ + class RvalueVisitor { + public: + virtual ~RvalueVisitor ( ) noexcept = default; + virtual void visit ( FormalRegExpAlternation < SymbolType > && ) = 0; + virtual void visit ( FormalRegExpConcatenation < SymbolType > && ) = 0; + virtual void visit ( FormalRegExpIteration < SymbolType > && ) = 0; + virtual void visit ( FormalRegExpSymbol < SymbolType > && ) = 0; + virtual void visit ( FormalRegExpEmpty < SymbolType > && ) = 0; + virtual void visit ( FormalRegExpEpsilon < SymbolType > && ) = 0; + }; + /** * Helper class interconnecting the visitor interface and visitor core logic. * @@ -128,12 +142,77 @@ protected: } }; + /** + * Helper class interconnecting the visitor interface and visitor core logic. + * + * \tparam ReturnType the return type of the result of the visit + * \tparam Visitorr the type of the actuall visitor + * \tparam Params ... types of data passed with the visitor call + */ + template < class ReturnType, class Visitorr, class ... Params > + class RvalueVisitorContext : public core::VisitorContextAux < ReturnType, Visitorr, Params ... >, public FormalRegExpElement::RvalueVisitor { + public: + /** + * Inherited constructor. + */ + using core::VisitorContextAux < ReturnType, Visitorr, Params ... >::VisitorContextAux; + + /** + * Method passing the visit call to the visitor core logic. + */ + void visit ( FormalRegExpAlternation < SymbolType > && inherit ) override { + this->call ( std::move ( inherit ), std::make_index_sequence < sizeof ... ( Params ) > { } ); + } + + /** + * Method passing the visit call to the visitor core logic. + */ + void visit ( FormalRegExpConcatenation < SymbolType > && inherit ) override { + this->call ( std::move ( inherit ), std::make_index_sequence < sizeof ... ( Params ) > { } ); + } + + /** + * Method passing the visit call to the visitor core logic. + */ + void visit ( FormalRegExpIteration < SymbolType > && inherit ) override { + this->call ( std::move ( inherit ), std::make_index_sequence < sizeof ... ( Params ) > { } ); + } + + /** + * Method passing the visit call to the visitor core logic. + */ + void visit ( FormalRegExpSymbol < SymbolType > && inherit ) override { + this->call ( std::move ( inherit ), std::make_index_sequence < sizeof ... ( Params ) > { } ); + } + + /** + * Method passing the visit call to the visitor core logic. + */ + void visit ( FormalRegExpEmpty < SymbolType > && inherit ) override { + this->call ( std::move ( inherit ), std::make_index_sequence < sizeof ... ( Params ) > { } ); + } + + /** + * Method passing the visit call to the visitor core logic. + */ + void visit ( FormalRegExpEpsilon < SymbolType > && inherit ) override { + this->call ( std::move ( inherit ), std::make_index_sequence < sizeof ... ( Params ) > { } ); + } + }; + /** * \brief Accept method of the visitor pattern. This is where the actual type of this object is evaluated. * * \param visitor the accepted visitor. */ - virtual void accept ( FormalRegExpElement::Visitor & visitor ) const = 0; + virtual void accept ( FormalRegExpElement::Visitor & visitor ) const & = 0; + + /** + * \brief Accept method of the visitor pattern. This is where the actual type of this object is evaluated. + * + * \param visitor the accepted visitor. + */ + virtual void accept ( FormalRegExpElement::RvalueVisitor & visitor ) && = 0; public: virtual FormalRegExpElement < SymbolType > * clone ( ) const & = 0; @@ -152,12 +231,31 @@ public: * \return result of the visit */ template < class ReturnType, class Visitor, class ... Params > - ReturnType accept ( Params && ... params ) const { + ReturnType accept ( Params && ... params ) const & { VisitorContext < ReturnType, Visitor, Params ... > context ( std::forward < Params > ( params ) ... ); accept ( context ); return context.getResult ( ); } + /** + * Visitor interface method. + * + * \tparam ReturnType the return type of the result of the visit + * \tparam Visitorr the type of the actuall visitor + * \tparam Params ... types of data passed with the visitor call + * + * \params params ... Additional params passed to visited nodes + * + * \return result of the visit + */ + template < class ReturnType, class Visitorr, class ... Params > + ReturnType accept ( Params && ... params ) && { + RvalueVisitorContext < ReturnType, Visitorr, Params ... > context ( std::forward < Params > ( params ) ... ); + std::move ( * this ).accept ( context ); + return context.getResult ( ); + } + + /** * Creates copy of the element. * diff --git a/alib2data/src/regexp/formal/FormalRegExpEmpty.h b/alib2data/src/regexp/formal/FormalRegExpEmpty.h index ab6911a2e2..55102bc31f 100644 --- a/alib2data/src/regexp/formal/FormalRegExpEmpty.h +++ b/alib2data/src/regexp/formal/FormalRegExpEmpty.h @@ -37,10 +37,17 @@ class FormalRegExpEmpty : public ext::NullaryNode < FormalRegExpElement < Symbol /** * @copydoc regexp::FormalRegExpElement < SymbolType >::accept ( ) const */ - void accept ( typename FormalRegExpElement < SymbolType >::Visitor & visitor ) const override { + void accept ( typename FormalRegExpElement < SymbolType >::Visitor & visitor ) const & override { visitor.visit ( * this ); } + /** + * @copydoc regexp::FormalRegExpElement < SymbolType >::accept ( ) const + */ + void accept ( typename FormalRegExpElement < SymbolType >::RvalueVisitor & visitor ) && override { + visitor.visit ( std::move ( * this ) ); + } + public: /** * \brief Creates a new instance of the empty node. diff --git a/alib2data/src/regexp/formal/FormalRegExpEpsilon.h b/alib2data/src/regexp/formal/FormalRegExpEpsilon.h index a32b7c9615..100146afff 100644 --- a/alib2data/src/regexp/formal/FormalRegExpEpsilon.h +++ b/alib2data/src/regexp/formal/FormalRegExpEpsilon.h @@ -37,10 +37,17 @@ class FormalRegExpEpsilon : public ext::NullaryNode < FormalRegExpElement < Symb /** * @copydoc regexp::FormalRegExpElement < SymbolType >::accept ( ) const */ - void accept ( typename FormalRegExpElement < SymbolType >::Visitor & visitor ) const override { + void accept ( typename FormalRegExpElement < SymbolType >::Visitor & visitor ) const & override { visitor.visit ( * this ); } + /** + * @copydoc regexp::FormalRegExpElement < SymbolType >::accept ( ) const + */ + void accept ( typename FormalRegExpElement < SymbolType >::RvalueVisitor & visitor ) && override { + visitor.visit ( std::move ( * this ) ); + } + public: /** * \brief Creates a new instance of the epsilon node. diff --git a/alib2data/src/regexp/formal/FormalRegExpIteration.h b/alib2data/src/regexp/formal/FormalRegExpIteration.h index a18a216e1c..62f8fdd819 100644 --- a/alib2data/src/regexp/formal/FormalRegExpIteration.h +++ b/alib2data/src/regexp/formal/FormalRegExpIteration.h @@ -40,10 +40,17 @@ class FormalRegExpIteration : public ext::UnaryNode < FormalRegExpElement < Symb /** * @copydoc regexp::FormalRegExpElement < SymbolType >::accept ( ) const */ - void accept ( typename FormalRegExpElement < SymbolType >::Visitor & visitor ) const override { + void accept ( typename FormalRegExpElement < SymbolType >::Visitor & visitor ) const & override { visitor.visit ( * this ); } + /** + * @copydoc regexp::FormalRegExpElement < SymbolType >::accept ( ) const + */ + void accept ( typename FormalRegExpElement < SymbolType >::RvalueVisitor & visitor ) && override { + visitor.visit ( std::move ( * this ) ); + } + public: /** * \brief Creates a new instance of the iteration node with explicit iterated element diff --git a/alib2data/src/regexp/formal/FormalRegExpSymbol.h b/alib2data/src/regexp/formal/FormalRegExpSymbol.h index c2039bcf53..6e1d4bd53e 100644 --- a/alib2data/src/regexp/formal/FormalRegExpSymbol.h +++ b/alib2data/src/regexp/formal/FormalRegExpSymbol.h @@ -43,10 +43,17 @@ class FormalRegExpSymbol : public ext::NullaryNode < FormalRegExpElement < Symbo /** * @copydoc regexp::FormalRegExpElement < SymbolType >::accept ( ) const */ - void accept ( typename FormalRegExpElement < SymbolType >::Visitor & visitor ) const override { + void accept ( typename FormalRegExpElement < SymbolType >::Visitor & visitor ) const & override { visitor.visit ( * this ); } + /** + * @copydoc regexp::FormalRegExpElement < SymbolType >::accept ( ) const + */ + void accept ( typename FormalRegExpElement < SymbolType >::RvalueVisitor & visitor ) && override { + visitor.visit ( std::move ( * this ) ); + } + public: /** * \brief Creates a new instance of the symbol node using the actual symbol to represent. diff --git a/alib2data/src/rte/formal/FormalRTEAlternation.h b/alib2data/src/rte/formal/FormalRTEAlternation.h index 4c789b4ce2..57138ed5a2 100644 --- a/alib2data/src/rte/formal/FormalRTEAlternation.h +++ b/alib2data/src/rte/formal/FormalRTEAlternation.h @@ -38,19 +38,26 @@ namespace rte { template < class SymbolType > class FormalRTEAlternation : public ext::BinaryNode < FormalRTEElement < SymbolType > > { /** - * @copydoc rte::FormalRTEElement < SymbolType >::accept ( ) const + * @copydoc rte::FormalRTEElement < SymbolType >::accept ( ) const & */ - void accept ( typename FormalRTEElement < SymbolType >::ConstVisitor & visitor ) const override { + void accept ( typename FormalRTEElement < SymbolType >::ConstVisitor & visitor ) const & override { visitor.visit ( * this ); } /** - * @copydoc rte::FormalRTEElement < SymbolType >::accept ( ) const + * @copydoc rte::FormalRTEElement < SymbolType >::accept ( ) & */ - void accept ( typename FormalRTEElement < SymbolType >::Visitor & visitor ) override { + void accept ( typename FormalRTEElement < SymbolType >::Visitor & visitor ) & override { visitor.visit ( * this ); } + /** + * @copydoc rte::FormalRTEElement < SymbolType >::accept ( ) && + */ + void accept ( typename FormalRTEElement < SymbolType >::RValueVisitor & visitor ) && override { + visitor.visit ( std::move ( * this ) ); + } + public: /** * \brief Creates a new instance of the alternation node with explicit alternated elements diff --git a/alib2data/src/rte/formal/FormalRTEElement.h b/alib2data/src/rte/formal/FormalRTEElement.h index b86cca329e..0597349300 100644 --- a/alib2data/src/rte/formal/FormalRTEElement.h +++ b/alib2data/src/rte/formal/FormalRTEElement.h @@ -73,6 +73,17 @@ protected: virtual void visit ( FormalRTEEmpty < SymbolType > & empty ) = 0; }; + class RValueVisitor { + public: + virtual ~RValueVisitor ( ) noexcept = default; + virtual void visit ( FormalRTEAlternation < SymbolType > && alternation ) = 0; + virtual void visit ( FormalRTEIteration < SymbolType > && iteration ) = 0; + virtual void visit ( FormalRTESubstitution < SymbolType > && substitution ) = 0; + virtual void visit ( FormalRTESymbolAlphabet < SymbolType > && symbol ) = 0; + virtual void visit ( FormalRTESymbolSubst < SymbolType > && symbol ) = 0; + virtual void visit ( FormalRTEEmpty < SymbolType > && empty ) = 0; + }; + /** * Helper class interconnecting the visitor interface and visitor core logic. * @@ -190,19 +201,84 @@ protected: } }; + /** + * Helper class interconnecting the visitor interface and visitor core logic. + * + * \tparam ReturnType the return type of the result of the visit + * \tparam Visitorr the type of the actuall visitor + * \tparam Params ... types of data passed with the visitor call + */ + template < class ReturnType, class Visitorr, class ... Params > + class RValueVisitorContext : public core::VisitorContextAux < ReturnType, Visitorr, Params ... >, public FormalRTEElement::RValueVisitor { + public: + /** + * Inherited constructor. + */ + using core::VisitorContextAux < ReturnType, Visitorr, Params ... >::VisitorContextAux; + + /** + * Method passing the visit call to the visitor core logic. + */ + void visit ( FormalRTEAlternation < SymbolType > && inherit ) override { + this->call ( std::move ( inherit ), std::make_index_sequence < sizeof ... ( Params ) > { } ); + } + + /** + * Method passing the visit call to the visitor core logic. + */ + void visit ( FormalRTEIteration < SymbolType > && inherit ) override { + this->call ( std::move ( inherit ), std::make_index_sequence < sizeof ... ( Params ) > { } ); + } + + /** + * Method passing the visit call to the visitor core logic. + */ + void visit ( FormalRTESubstitution < SymbolType > && inherit ) override { + this->call ( std::move ( inherit ), std::make_index_sequence < sizeof ... ( Params ) > { } ); + } + + /** + * Method passing the visit call to the visitor core logic. + */ + void visit ( FormalRTESymbolAlphabet < SymbolType > && inherit ) override { + this->call ( std::move ( inherit ), std::make_index_sequence < sizeof ... ( Params ) > { } ); + } + + /** + * Method passing the visit call to the visitor core logic. + */ + void visit ( FormalRTESymbolSubst < SymbolType > && inherit ) override { + this->call ( std::move ( inherit ), std::make_index_sequence < sizeof ... ( Params ) > { } ); + } + + /** + * Method passing the visit call to the visitor core logic. + */ + void visit ( FormalRTEEmpty < SymbolType > && inherit ) override { + this->call ( std::move ( inherit ), std::make_index_sequence < sizeof ... ( Params ) > { } ); + } + }; + + /** + * \brief Accept method of the visitor pattern. This is where the actual type of this object is evaluated. + * + * \param visitor the accepted visitor. + */ + virtual void accept ( FormalRTEElement::ConstVisitor & visitor ) const & = 0; + /** * \brief Accept method of the visitor pattern. This is where the actual type of this object is evaluated. * * \param visitor the accepted visitor. */ - virtual void accept ( FormalRTEElement::ConstVisitor & visitor ) const = 0; + virtual void accept ( FormalRTEElement::Visitor & visitor ) & = 0; /** * \brief Accept method of the visitor pattern. This is where the actual type of this object is evaluated. * * \param visitor the accepted visitor. */ - virtual void accept ( FormalRTEElement::Visitor & visitor ) = 0; + virtual void accept ( FormalRTEElement::RValueVisitor & visitor ) && = 0; public: virtual FormalRTEElement < SymbolType > * clone ( ) const & = 0; @@ -221,7 +297,7 @@ public: * \return result of the visit */ template < class ReturnType, class Visitorr, class ... Params > - ReturnType accept ( Params && ... params ) const { + ReturnType accept ( Params && ... params ) const & { ConstVisitorContext < ReturnType, Visitorr, Params ... > context ( std::forward < Params > ( params ) ... ); accept ( context ); return context.getResult ( ); @@ -239,12 +315,30 @@ public: * \return result of the visit */ template < class ReturnType, class Visitorr, class ... Params > - ReturnType accept ( Params && ... params ) { + ReturnType accept ( Params && ... params ) & { VisitorContext < ReturnType, Visitorr, Params ... > context ( std::forward < Params > ( params ) ... ); accept ( context ); return context.getResult ( ); } + /** + * Visitor interface method. + * + * \tparam ReturnType the return type of the result of the visit + * \tparam Visitorr the type of the actuall visitor + * \tparam Params ... types of data passed with the visitor call + * + * \params params ... Additional params passed to visited nodes + * + * \return result of the visit + */ + template < class ReturnType, class Visitorr, class ... Params > + ReturnType accept ( Params && ... params ) && { + RValueVisitorContext < ReturnType, Visitorr, Params ... > context ( std::forward < Params > ( params ) ... ); + std::move ( * this ).accept ( context ); + return context.getResult ( ); + } + /** * Traverses the rte tree looking if particular Symbol is used in the rte. * diff --git a/alib2data/src/rte/formal/FormalRTEEmpty.h b/alib2data/src/rte/formal/FormalRTEEmpty.h index 661d23a256..7b3bda3a60 100644 --- a/alib2data/src/rte/formal/FormalRTEEmpty.h +++ b/alib2data/src/rte/formal/FormalRTEEmpty.h @@ -34,19 +34,26 @@ namespace rte { template < class SymbolType > class FormalRTEEmpty : public ext::NullaryNode < FormalRTEElement < SymbolType > > { /** - * @copydoc rte::FormalRTEElement < SymbolType >::accept ( ) const + * @copydoc rte::FormalRTEElement < SymbolType >::accept ( ) const & */ - void accept ( typename FormalRTEElement < SymbolType >::ConstVisitor & visitor ) const override { + void accept ( typename FormalRTEElement < SymbolType >::ConstVisitor & visitor ) const & override { visitor.visit ( * this ); } /** - * @copydoc rte::FormalRTEElement < SymbolType >::accept ( ) const + * @copydoc rte::FormalRTEElement < SymbolType >::accept ( ) & */ - void accept ( typename FormalRTEElement < SymbolType >::Visitor & visitor ) override { + void accept ( typename FormalRTEElement < SymbolType >::Visitor & visitor ) & override { visitor.visit ( * this ); } + /** + * @copydoc rte::FormalRTEElement < SymbolType >::accept ( ) && + */ + void accept ( typename FormalRTEElement < SymbolType >::RValueVisitor & visitor ) && override { + visitor.visit ( std::move ( * this ) ); + } + public: /** * \brief Creates a new instance of the empty node. diff --git a/alib2data/src/rte/formal/FormalRTEIteration.h b/alib2data/src/rte/formal/FormalRTEIteration.h index 15bb54ac36..bebb77b70b 100644 --- a/alib2data/src/rte/formal/FormalRTEIteration.h +++ b/alib2data/src/rte/formal/FormalRTEIteration.h @@ -44,19 +44,26 @@ class FormalRTEIteration : public ext::UnaryNode < FormalRTEElement < SymbolType FormalRTESymbolSubst < SymbolType > m_substitutionSymbol; /** - * @copydoc rte::FormalRTEElement < SymbolType >::accept ( ) const + * @copydoc rte::FormalRTEElement < SymbolType >::accept ( ) const & */ - void accept ( typename FormalRTEElement < SymbolType >::ConstVisitor & visitor ) const override { + void accept ( typename FormalRTEElement < SymbolType >::ConstVisitor & visitor ) const & override { visitor.visit ( * this ); } /** - * @copydoc rte::FormalRTEElement < SymbolType >::accept ( ) const + * @copydoc rte::FormalRTEElement < SymbolType >::accept ( ) & */ - void accept ( typename FormalRTEElement < SymbolType >::Visitor & visitor ) override { + void accept ( typename FormalRTEElement < SymbolType >::Visitor & visitor ) & override { visitor.visit ( * this ); } + /** + * @copydoc rte::FormalRTEElement < SymbolType >::accept ( ) && + */ + void accept ( typename FormalRTEElement < SymbolType >::RValueVisitor & visitor ) && override { + visitor.visit ( std::move ( * this ) ); + } + public: /** * \brief Creates a new instance of the substitution node with explicit tree to iterate and a symbol representing place of substitution diff --git a/alib2data/src/rte/formal/FormalRTESubstitution.h b/alib2data/src/rte/formal/FormalRTESubstitution.h index c4c2ae80df..b00746f4b0 100644 --- a/alib2data/src/rte/formal/FormalRTESubstitution.h +++ b/alib2data/src/rte/formal/FormalRTESubstitution.h @@ -43,19 +43,26 @@ class FormalRTESubstitution : public ext::BinaryNode < FormalRTEElement < Symbol FormalRTESymbolSubst < SymbolType > m_substitutionSymbol; /** - * @copydoc rte::FormalRTEElement < SymbolType >::accept ( ) const + * @copydoc rte::FormalRTEElement < SymbolType >::accept ( ) const & */ - void accept ( typename FormalRTEElement < SymbolType >::ConstVisitor & visitor ) const override { + void accept ( typename FormalRTEElement < SymbolType >::ConstVisitor & visitor ) const & override { visitor.visit ( * this ); } /** - * @copydoc rte::FormalRTEElement < SymbolType >::accept ( ) const + * @copydoc rte::FormalRTEElement < SymbolType >::accept ( ) & */ - void accept ( typename FormalRTEElement < SymbolType >::Visitor & visitor ) override { + void accept ( typename FormalRTEElement < SymbolType >::Visitor & visitor ) & override { visitor.visit ( * this ); } + /** + * @copydoc rte::FormalRTEElement < SymbolType >::accept ( ) && + */ + void accept ( typename FormalRTEElement < SymbolType >::RValueVisitor & visitor ) && override { + visitor.visit ( std::move ( * this ) ); + } + public: /** * \brief Creates a new instance of the substitution node with explicit tree to substitute in, tree to substitue by and a symbol representing place of substitution diff --git a/alib2data/src/rte/formal/FormalRTESymbolAlphabet.h b/alib2data/src/rte/formal/FormalRTESymbolAlphabet.h index 34a43edd1f..71fcf4ecee 100644 --- a/alib2data/src/rte/formal/FormalRTESymbolAlphabet.h +++ b/alib2data/src/rte/formal/FormalRTESymbolAlphabet.h @@ -38,19 +38,26 @@ namespace rte { template < class SymbolType > class FormalRTESymbolAlphabet : public FormalRTESymbol < SymbolType >, public ext::VararyNode < FormalRTEElement < SymbolType > > { /** - * @copydoc rte::FormalRTEElement < SymbolType >::accept ( ) const + * @copydoc rte::FormalRTEElement < SymbolType >::accept ( ) const & */ - void accept ( typename FormalRTEElement < SymbolType >::ConstVisitor & visitor ) const override { + void accept ( typename FormalRTEElement < SymbolType >::ConstVisitor & visitor ) const & override { visitor.visit ( * this ); } /** - * @copydoc rte::FormalRTEElement < SymbolType >::accept ( ) const + * @copydoc rte::FormalRTEElement < SymbolType >::accept ( ) & */ - void accept ( typename FormalRTEElement < SymbolType >::Visitor & visitor ) override { + void accept ( typename FormalRTEElement < SymbolType >::Visitor & visitor ) & override { visitor.visit ( * this ); } + /** + * @copydoc rte::FormalRTEElement < SymbolType >::accept ( ) && + */ + void accept ( typename FormalRTEElement < SymbolType >::RValueVisitor & visitor ) && override { + visitor.visit ( std::move ( * this ) ); + } + public: /** * \brief Creates a new instance of the symbol node using the actual symbol to represent. diff --git a/alib2data/src/rte/formal/FormalRTESymbolSubst.h b/alib2data/src/rte/formal/FormalRTESymbolSubst.h index 627b9c46ee..f3f9229f0d 100644 --- a/alib2data/src/rte/formal/FormalRTESymbolSubst.h +++ b/alib2data/src/rte/formal/FormalRTESymbolSubst.h @@ -37,19 +37,26 @@ namespace rte { template < class SymbolType > class FormalRTESymbolSubst : public FormalRTESymbol < SymbolType >, public ext::NullaryNode < FormalRTEElement < SymbolType > > { /** - * @copydoc rte::FormalRTEElement < SymbolType >::accept ( ) const + * @copydoc rte::FormalRTEElement < SymbolType >::accept ( ) const & */ - void accept ( typename FormalRTEElement < SymbolType >::ConstVisitor & visitor ) const override { + void accept ( typename FormalRTEElement < SymbolType >::ConstVisitor & visitor ) const & override { visitor.visit ( * this ); } /** - * @copydoc rte::FormalRTEElement < SymbolType >::accept ( ) const + * @copydoc rte::FormalRTEElement < SymbolType >::accept ( ) & */ - void accept ( typename FormalRTEElement < SymbolType >::Visitor & visitor ) override { + void accept ( typename FormalRTEElement < SymbolType >::Visitor & visitor ) & override { visitor.visit ( * this ); } + /** + * @copydoc rte::FormalRTEElement < SymbolType >::accept ( ) && + */ + void accept ( typename FormalRTEElement < SymbolType >::RValueVisitor & visitor ) && override { + visitor.visit ( std::move ( * this ) ); + } + public: /** * \brief Creates a new instance of the symbol node using the actual symbol to represent. -- GitLab