diff --git a/alib2abstraction/src/abstraction/AlgorithmAbstraction.hpp b/alib2abstraction/src/abstraction/AlgorithmAbstraction.hpp index 61abc413f9704536b5e57c850b4c8fc82801d61b..9c5ec5d41f2bda89c5b1df08cdc53e8d24fc8fad 100644 --- a/alib2abstraction/src/abstraction/AlgorithmAbstraction.hpp +++ b/alib2abstraction/src/abstraction/AlgorithmAbstraction.hpp @@ -25,7 +25,7 @@ public: } bool run ( ) override { - this->template run_helper < ParamTypes ... > ( m_callback, this->m_params ); + this->template run_helper < ParamTypes ... > ( m_callback, this->getParams ( ) ); return true; } diff --git a/alib2abstraction/src/abstraction/AnyaryOperationAbstraction.hpp b/alib2abstraction/src/abstraction/AnyaryOperationAbstraction.hpp index eeb5de007eb8b809c375fdfd1237ff90b151ba7a..1a5a4710b1f44b2d70697d2eef875e6a6f40ad96 100644 --- a/alib2abstraction/src/abstraction/AnyaryOperationAbstraction.hpp +++ b/alib2abstraction/src/abstraction/AnyaryOperationAbstraction.hpp @@ -19,9 +19,13 @@ namespace abstraction { template < class ReturnType, class ParamType > class AnyaryOperationAbstraction : public ValueOperationAbstraction < ReturnType > { -protected: ext::vector < std::pair < std::shared_ptr < OperationAbstraction >, bool > > m_params; +protected: + ext::vector < std::pair < std::shared_ptr < OperationAbstraction >, bool > > & getParams ( ) { + return m_params; + } + private: bool attachInput ( const std::shared_ptr < OperationAbstraction > & input, unsigned index, bool move, bool checkInput ) override { if ( input == nullptr ) diff --git a/alib2abstraction/src/abstraction/CastAbstraction.hpp b/alib2abstraction/src/abstraction/CastAbstraction.hpp index e9031f0787aaffe3f0c764844a6c6126d6b9ee76..63a1675d75fe5ca68d0fddd2957ba55748662164 100644 --- a/alib2abstraction/src/abstraction/CastAbstraction.hpp +++ b/alib2abstraction/src/abstraction/CastAbstraction.hpp @@ -16,7 +16,7 @@ template < class ReturnType, class ParamType > class CastAbstraction : public UnaryOperationAbstraction < ReturnType, const ParamType & > { public: bool run ( ) override { - std::pair < std::shared_ptr < OperationAbstraction >, bool > & param = std::get < 0 > ( this->m_params ); + std::pair < std::shared_ptr < OperationAbstraction >, bool > & param = std::get < 0 > ( this->getParams ( ) ); this->m_data = ReturnType ( retrieveValue < const ParamType & > ( param.first, param.second ) ); return true; diff --git a/alib2abstraction/src/abstraction/MemberAbstraction.hpp b/alib2abstraction/src/abstraction/MemberAbstraction.hpp index 66523daa2193705bdff6af6fca1280d539d10486..ee6fd52ece289ff18307c86666fb25f53ea3b46e 100644 --- a/alib2abstraction/src/abstraction/MemberAbstraction.hpp +++ b/alib2abstraction/src/abstraction/MemberAbstraction.hpp @@ -26,10 +26,10 @@ public: } bool run ( ) override { - ext::array < std::pair < std::shared_ptr < OperationAbstraction >, bool >, sizeof ... ( ParamTypes ) + 1 > params = this->m_params; + ext::array < std::pair < std::shared_ptr < OperationAbstraction >, bool >, sizeof ... ( ParamTypes ) + 1 > params = this->getParams ( ); std::shared_ptr < OperationAbstraction > reference = std::make_shared < ReferenceAbstraction < typename std::remove_reference < ObjectType >::type > > ( ); - if ( ! reference->attachInput ( std::get < 0 > ( this->m_params ).first, 0, std::get < 0 > ( this->m_params ).second, true ) ) + if ( ! reference->attachInput ( std::get < 0 > ( this->getParams ( ) ).first, 0, std::get < 0 > ( this->getParams ( ) ).second, true ) ) throw std::invalid_argument ( "Can't bind the object of call to member." ); if ( ! reference->eval ( ) ) diff --git a/alib2abstraction/src/abstraction/NaryOperationAbstraction.hpp b/alib2abstraction/src/abstraction/NaryOperationAbstraction.hpp index 637c1c554fe35b665f47e68c32f2ae061fbeae7a..9d470508841be0df92c064c786e816e516f97684 100644 --- a/alib2abstraction/src/abstraction/NaryOperationAbstraction.hpp +++ b/alib2abstraction/src/abstraction/NaryOperationAbstraction.hpp @@ -20,9 +20,13 @@ namespace abstraction { template < class ReturnType, class ... ParamTypes > class NaryOperationAbstraction : public ValueOperationAbstraction < ReturnType > { -protected: ext::array < std::pair < std::shared_ptr < OperationAbstraction >, bool >, sizeof ... ( ParamTypes ) > m_params; +protected: + ext::array < std::pair < std::shared_ptr < OperationAbstraction >, bool >, sizeof ... ( ParamTypes ) > & getParams ( ) { + return m_params; + } + private: bool attachInput ( const std::shared_ptr < OperationAbstraction > & input, unsigned index, bool move, bool checkInput ) override { if ( index >= m_params.size ( ) ) diff --git a/alib2abstraction/src/abstraction/NormalizeAbstraction.hpp b/alib2abstraction/src/abstraction/NormalizeAbstraction.hpp index 101526fb00a1e6afecd5dbf6777259ce847c0941..c75bdf2dfa5a9c52a2a5e552d11a078c2ce715c6 100644 --- a/alib2abstraction/src/abstraction/NormalizeAbstraction.hpp +++ b/alib2abstraction/src/abstraction/NormalizeAbstraction.hpp @@ -18,7 +18,7 @@ template < class ReturnType, class ParamType > class NormalizeAbstraction : public UnaryOperationAbstraction < ReturnType, ParamType && > { public: bool run ( ) override { - std::pair < std::shared_ptr < OperationAbstraction >, bool > & rawParam = std::get < 0 > ( this->m_params ); + std::pair < std::shared_ptr < OperationAbstraction >, bool > & rawParam = std::get < 0 > ( this->getParams ( ) ); ParamType && param = retrieveValue < ParamType && > ( rawParam.first, rawParam.second ); ReturnType res = factory::NormalizeFactory::normalize ( std::move ( param ) ); diff --git a/alib2abstraction/src/abstraction/ReferenceAbstraction.hpp b/alib2abstraction/src/abstraction/ReferenceAbstraction.hpp index 68448dfc47f9dd3f40cb32b732fa2f55f6bb0591..a186d25cd6c1987e48c86eb6befc68349b37d650 100644 --- a/alib2abstraction/src/abstraction/ReferenceAbstraction.hpp +++ b/alib2abstraction/src/abstraction/ReferenceAbstraction.hpp @@ -16,7 +16,7 @@ template < class Type > class ReferenceAbstraction : public UnaryOperationAbstraction < Type *, Type & > { public: bool run ( ) override { - std::pair < std::shared_ptr < OperationAbstraction >, bool > & param = std::get < 0 > ( this->m_params ); + std::pair < std::shared_ptr < OperationAbstraction >, bool > & param = std::get < 0 > ( this->getParams ( ) ); this->m_data = & retrieveValue < Type & > ( param.first, param.second ); return true; diff --git a/alib2abstraction/src/abstraction/SetAbstraction.hpp b/alib2abstraction/src/abstraction/SetAbstraction.hpp index d4c182e1ec2a98d2ec4151f3c0fb40a6994c5c50..7ac4b6587599d4655c99999d8974d2cd4b25a806 100644 --- a/alib2abstraction/src/abstraction/SetAbstraction.hpp +++ b/alib2abstraction/src/abstraction/SetAbstraction.hpp @@ -19,7 +19,7 @@ class SetAbstraction : public AnyaryOperationAbstraction < ext::set < ParamType public: bool run ( ) override { ext::set < ParamType > theSet; - for ( const std::pair < std::shared_ptr < OperationAbstraction >, bool > & param : this->m_params ) { + for ( const std::pair < std::shared_ptr < OperationAbstraction >, bool > & param : this->getParams ( ) ) { theSet.insert ( abstraction::retrieveValue < ParamType > ( param.first, param.second ) ); } diff --git a/alib2abstraction/src/abstraction/ValuePrinterAbstraction.hpp b/alib2abstraction/src/abstraction/ValuePrinterAbstraction.hpp index 6dad92f9c03487262c35b1445579481fe0deb215..95ec39ed7a3a9758401c2ec0cd5e920b164b6edb 100644 --- a/alib2abstraction/src/abstraction/ValuePrinterAbstraction.hpp +++ b/alib2abstraction/src/abstraction/ValuePrinterAbstraction.hpp @@ -22,7 +22,7 @@ public: } bool run ( ) override { - std::pair < std::shared_ptr < OperationAbstraction >, bool > & param = std::get < 0 > ( this->m_params ); + std::pair < std::shared_ptr < OperationAbstraction >, bool > & param = std::get < 0 > ( this->getParams ( ) ); m_ostream << retrieveValue < const ParamType & > ( param.first, param.second ) << std::endl; return true; } diff --git a/alib2abstraction/src/abstraction/WrapperAbstraction.hpp b/alib2abstraction/src/abstraction/WrapperAbstraction.hpp index f8bf3ed7322f240e5759976fd8f0e02958741b13..c65fb7c99313c3026e14dcd473b464a798cb2664 100644 --- a/alib2abstraction/src/abstraction/WrapperAbstraction.hpp +++ b/alib2abstraction/src/abstraction/WrapperAbstraction.hpp @@ -121,8 +121,8 @@ public: void attachInputsToAbstraction ( ) { for ( unsigned index = 0; index < sizeof ... ( ParamTypes ); ++ index ) - if ( ! this->m_abstraction->attachInput ( this->m_params [ index ].first, index, this->m_params [ index ].second, true ) ) - throw std::invalid_argument ( "Can't connect param " + this->m_abstraction->getParamType ( index ) + " at " + ext::to_string ( index ) + " of wrapped algorithm with result of type " + this->m_params [ index ].first->getReturnType ( ) + "." ); + if ( ! this->m_abstraction->attachInput ( m_params [ index ].first, index, m_params [ index ].second, true ) ) + throw std::invalid_argument ( "Can't connect param " + this->m_abstraction->getParamType ( index ) + " at " + ext::to_string ( index ) + " of wrapped algorithm with result of type " + m_params [ index ].first->getReturnType ( ) + "." ); } diff --git a/alib2raw/src/abstraction/RawReaderAbstraction.hpp b/alib2raw/src/abstraction/RawReaderAbstraction.hpp index b4f73a36fc4237f54d8e41fc4888e0eae2e0a3c7..7c23b37e3d947d9c6b1856ca0cd880a8fd06fdc3 100644 --- a/alib2raw/src/abstraction/RawReaderAbstraction.hpp +++ b/alib2raw/src/abstraction/RawReaderAbstraction.hpp @@ -17,7 +17,7 @@ template < class ReturnType > class RawReaderAbstraction : public UnaryOperationAbstraction < ReturnType, std::string && > { public: bool run ( ) override { - std::pair < std::shared_ptr < OperationAbstraction >, bool > & param = std::get < 0 > ( this->m_params ); + std::pair < std::shared_ptr < OperationAbstraction >, bool > & param = std::get < 0 > ( this->getParams ( ) ); ReturnType res = factory::RawDataFactory::fromString ( abstraction::retrieveValue < std::string && > ( param.first, param.second ) ); this->m_data = std::move ( res ); return true; diff --git a/alib2raw/src/abstraction/RawWriterAbstraction.hpp b/alib2raw/src/abstraction/RawWriterAbstraction.hpp index 60e25c9ca81c676cdd7fabbfc3f3b6f11c1f1907..50128d233cf4f8aeb07cb7a8c656bca1b156104e 100644 --- a/alib2raw/src/abstraction/RawWriterAbstraction.hpp +++ b/alib2raw/src/abstraction/RawWriterAbstraction.hpp @@ -17,7 +17,7 @@ template < class ParamType > class RawWriterAbstraction : public UnaryOperationAbstraction < std::string, const ParamType & > { public: bool run ( ) override { - std::pair < std::shared_ptr < OperationAbstraction >, bool > & param = std::get < 0 > ( this->m_params ); + std::pair < std::shared_ptr < OperationAbstraction >, bool > & param = std::get < 0 > ( this->getParams ( ) ); this->m_data = factory::RawDataFactory::toString ( abstraction::retrieveValue < const ParamType & > ( param.first, param.second ) ); return true; } diff --git a/alib2str/src/abstraction/StringReaderAbstraction.hpp b/alib2str/src/abstraction/StringReaderAbstraction.hpp index ca3d6c7a0b54861cef070edbc45782651e75a73b..4faed98d069073d2b8f1a23e70abe6155d34d65a 100644 --- a/alib2str/src/abstraction/StringReaderAbstraction.hpp +++ b/alib2str/src/abstraction/StringReaderAbstraction.hpp @@ -17,7 +17,7 @@ template < class ReturnType > class StringReaderAbstraction : public UnaryOperationAbstraction < ReturnType, std::string && > { public: bool run ( ) override { - std::pair < std::shared_ptr < OperationAbstraction >, bool > & param = std::get < 0 > ( this->m_params ); + std::pair < std::shared_ptr < OperationAbstraction >, bool > & param = std::get < 0 > ( this->getParams ( ) ); ReturnType res = factory::StringDataFactory::fromString ( abstraction::retrieveValue < std::string && > ( param.first, param.second ) ); this->m_data = std::move ( res ); return true; diff --git a/alib2str/src/abstraction/StringWriterAbstraction.hpp b/alib2str/src/abstraction/StringWriterAbstraction.hpp index 99f1df7af589e804cf38c1859ffd02d06f1f1314..15cb5872024ad5236daec5396631ab64e87a9723 100644 --- a/alib2str/src/abstraction/StringWriterAbstraction.hpp +++ b/alib2str/src/abstraction/StringWriterAbstraction.hpp @@ -17,7 +17,7 @@ template < class ParamType > class StringWriterAbstraction : public UnaryOperationAbstraction < std::string, const ParamType & > { public: bool run ( ) override { - std::pair < std::shared_ptr < OperationAbstraction >, bool > & param = std::get < 0 > ( this->m_params ); + std::pair < std::shared_ptr < OperationAbstraction >, bool > & param = std::get < 0 > ( this->getParams ( ) ); this->m_data = factory::StringDataFactory::toString ( abstraction::retrieveValue < const ParamType & > ( param.first, param.second ) ); return true; } diff --git a/alib2xml/src/abstraction/XmlComposerAbstraction.hpp b/alib2xml/src/abstraction/XmlComposerAbstraction.hpp index c8298bfd912c85aa87c140bd2da1fa0a14d71146..0a50924bdbcea1228e73f673b9ba5bc6a41b13b5 100644 --- a/alib2xml/src/abstraction/XmlComposerAbstraction.hpp +++ b/alib2xml/src/abstraction/XmlComposerAbstraction.hpp @@ -17,7 +17,7 @@ template < class ParamType > class XmlComposerAbstraction : public UnaryOperationAbstraction < ext::deque < sax::Token >, const ParamType & > { public: bool run ( ) override { - std::pair < std::shared_ptr < OperationAbstraction >, bool > & param = std::get < 0 > ( this->m_params ); + std::pair < std::shared_ptr < OperationAbstraction >, bool > & param = std::get < 0 > ( this->getParams ( ) ); this->m_data = factory::XmlDataFactory::toTokens ( abstraction::retrieveValue < const ParamType & > ( param.first, param.second ) ); return true; } diff --git a/alib2xml/src/abstraction/XmlParserAbstraction.hpp b/alib2xml/src/abstraction/XmlParserAbstraction.hpp index ab214c020bdf7904fa994c4d853ab644f5d92a7f..2e5e1ab3fc53305acc1645f33e0ffff7d1c6a5a6 100644 --- a/alib2xml/src/abstraction/XmlParserAbstraction.hpp +++ b/alib2xml/src/abstraction/XmlParserAbstraction.hpp @@ -19,7 +19,7 @@ class XmlParserAbstraction : public UnaryOperationAbstraction < ReturnType, ext: public: bool run ( ) override { - std::pair < std::shared_ptr < OperationAbstraction >, bool > & param = std::get < 0 > ( this->m_params ); + std::pair < std::shared_ptr < OperationAbstraction >, bool > & param = std::get < 0 > ( this->getParams ( ) ); ReturnType res = factory::XmlDataFactory::fromTokens ( abstraction::retrieveValue < ext::deque < sax::Token > && > ( param.first, param.second ) ); this->m_data = std::move ( res ); return true; diff --git a/alib2xml/src/abstraction/XmlTokensComposerAbstraction.hpp b/alib2xml/src/abstraction/XmlTokensComposerAbstraction.hpp index 89ece0b8c44d8edf8d2d813c0ae7863b00376de0..1781b348181b2a03ea3ea7e4d6bfc560f4ec6b6f 100644 --- a/alib2xml/src/abstraction/XmlTokensComposerAbstraction.hpp +++ b/alib2xml/src/abstraction/XmlTokensComposerAbstraction.hpp @@ -16,8 +16,8 @@ namespace abstraction { class XmlTokensComposerAbstraction : public BinaryOperationAbstraction < void, const ext::deque < sax::Token > &, const std::string & > { public: bool run ( ) override { - std::pair < std::shared_ptr < OperationAbstraction >, bool > & param2 = std::get < 0 > ( this->m_params ); - std::pair < std::shared_ptr < OperationAbstraction >, bool > & param1 = std::get < 1 > ( this->m_params ); + std::pair < std::shared_ptr < OperationAbstraction >, bool > & param2 = std::get < 0 > ( this->getParams ( ) ); + std::pair < std::shared_ptr < OperationAbstraction >, bool > & param1 = std::get < 1 > ( this->getParams ( ) ); sax::SaxComposeInterface::composeFile ( abstraction::retrieveValue < const std::string & > ( param1.first, param1.second ), abstraction::retrieveValue < const ext::deque < sax::Token > & > ( param2.first, param2.second ) ); return true; } diff --git a/alib2xml/src/abstraction/XmlTokensParserAbstraction.hpp b/alib2xml/src/abstraction/XmlTokensParserAbstraction.hpp index f6e759e23589a846f064b1b389ae6fa99e7d1236..c1f194f144ad0d15be3a2279aaad0c7075a57268 100644 --- a/alib2xml/src/abstraction/XmlTokensParserAbstraction.hpp +++ b/alib2xml/src/abstraction/XmlTokensParserAbstraction.hpp @@ -16,7 +16,7 @@ namespace abstraction { class XmlTokensParserAbstraction : public UnaryOperationAbstraction < ext::deque < sax::Token >, const std::string & > { public: bool run ( ) override { - std::pair < std::shared_ptr < OperationAbstraction >, bool > & param = std::get < 0 > ( this->m_params ); + std::pair < std::shared_ptr < OperationAbstraction >, bool > & param = std::get < 0 > ( this->getParams ( ) ); this->m_data = sax::SaxParseInterface::parseFile ( abstraction::retrieveValue < const std::string & > ( param.first, param.second ) ); return true; }