Skip to content
Snippets Groups Projects
Commit eda6121a authored by Jan Travnicek's avatar Jan Travnicek
Browse files

make nary m_params filed private

parent 191ee359
No related branches found
No related tags found
1 merge request!95Many clang-tidy fixes
Pipeline #40808 passed with warnings
Showing
with 29 additions and 21 deletions
......@@ -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;
}
 
......
......@@ -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 )
......
......@@ -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;
......
......@@ -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 ( ) )
......
......@@ -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 ( ) )
......
......@@ -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 ) );
 
......
......@@ -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;
......
......@@ -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 ) );
}
 
......
......@@ -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;
}
......
......@@ -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 ( ) + "." );
 
}
 
......
......@@ -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;
......
......@@ -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;
}
......
......@@ -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;
......
......@@ -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;
}
......
......@@ -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;
}
......
......@@ -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;
......
......@@ -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;
}
......
......@@ -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;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment