Skip to content
Snippets Groups Projects
Commit 0c73f2da authored by Jan Travnicek's avatar Jan Travnicek Committed by Jan Trávníček
Browse files

reorganize code

parent cf8f91eb
No related branches found
No related tags found
No related merge requests found
......@@ -31,7 +31,7 @@ private:
if ( input == nullptr )
return false;
 
if ( checkInput && ! abstraction::CheckInput < ValueProvider < ParamType > >::checkInput ( input, 0 /* Note: yes index zero */ ) )
if ( checkInput && ! abstraction::checkInput < ValueProvider < ParamType > > ( input, 0 /* Note: yes index zero */ ) )
return false;
 
if ( m_params.size ( ) < index + 1 )
......
......@@ -35,7 +35,7 @@ private:
if ( input == nullptr )
return false;
 
if ( checkInput && ! abstraction::CheckInput < ValueProvider < ParamTypes > ... >::checkInput ( input, index ) )
if ( checkInput && ! abstraction::checkInput < ValueProvider < ParamTypes > ... > ( input, index ) )
return false;
 
m_params [ index ].first = input;
......@@ -89,11 +89,11 @@ public:
}
 
ext::type_index getParamTypeIndex ( size_t index ) const override {
return abstraction::ParamType < ParamTypes ... >::paramType ( index );
return abstraction::paramType < ParamTypes ... > ( index );
}
 
ext::set < abstraction::ParamQualifiers::ParamQualifier > getParamTypeQualifiers ( size_t index ) const override {
return abstraction::ParamType < ParamTypes ... >::paramTypeQualifiers ( index );
return abstraction::paramTypeQualifiers < ParamTypes ... > ( index );
}
 
};
......
......@@ -49,7 +49,7 @@ private:
if ( input == nullptr )
return false;
 
if ( checkInput && ! CheckInput < ValueProvider < ParamTypes > ... >::checkInput ( input, index ) )
if ( checkInput && ! abstraction::checkInput < ValueProvider < ParamTypes > ... > ( input, index ) )
return false;
 
m_params [ index ].first = input;
......@@ -105,11 +105,11 @@ public:
}
 
ext::type_index getParamTypeIndex ( size_t index ) const override {
return ParamType < ParamTypes ... >::paramType ( index );
return abstraction::paramType < ParamTypes ... > ( index );
}
 
ext::set < abstraction::ParamQualifiers::ParamQualifier > getParamTypeQualifiers ( size_t index ) const override {
return ParamType < ParamTypes ... >::paramTypeQualifiers ( index );
return abstraction::paramTypeQualifiers < ParamTypes ... > ( index );
}
 
std::shared_ptr < abstraction::OperationAbstraction > getProxyAbstraction ( ) override {
......
......@@ -35,46 +35,43 @@ constexpr decltype ( auto ) apply ( F && f, Tuple && t ) {
}
 
template < class ... Params >
struct CheckInput {
static bool checkInput ( const std::shared_ptr < OperationAbstraction > & operation, unsigned index ) {
bool res = false;
bool checkInput ( const std::shared_ptr < OperationAbstraction > & operation, unsigned index ) {
bool res = false;
 
auto lambda = [ & ] ( auto I ) {
res = ( bool ) std::dynamic_pointer_cast < std::decay_t < std::tuple_element_t < decltype ( I )::value, std::tuple < Params ... > > > > ( operation->getProxyAbstraction ( ) );
};
auto lambda = [ & ] ( auto I ) {
res = ( bool ) std::dynamic_pointer_cast < std::decay_t < std::tuple_element_t < decltype ( I )::value, std::tuple < Params ... > > > > ( operation->getProxyAbstraction ( ) );
};
 
ext::constexpr_switch < sizeof ... ( Params ) > ( index, lambda );
ext::constexpr_switch < sizeof ... ( Params ) > ( index, lambda );
 
return res;
}
};
return res;
}
 
template < class ... Params >
struct ParamType {
static ext::type_index paramType ( unsigned index ) {
ext::type_index res ( typeid ( void ) );
static ext::type_index paramType ( unsigned index ) {
ext::type_index res ( typeid ( void ) );
 
auto lambda = [ & ] ( auto I ) {
res = ext::type_index ( typeid ( std::tuple_element_t < decltype ( I )::value, std::tuple < Params ... > > ) );
};
auto lambda = [ & ] ( auto I ) {
res = ext::type_index ( typeid ( std::tuple_element_t < decltype ( I )::value, std::tuple < Params ... > > ) );
};
 
ext::constexpr_switch < sizeof ... ( Params ) > ( index, lambda );
ext::constexpr_switch < sizeof ... ( Params ) > ( index, lambda );
 
return res;
}
return res;
}
 
static ext::set < abstraction::ParamQualifiers::ParamQualifier > paramTypeQualifiers ( unsigned index ) {
ext::set < abstraction::ParamQualifiers::ParamQualifier > res;
template < class ... Params >
ext::set < abstraction::ParamQualifiers::ParamQualifier > paramTypeQualifiers ( unsigned index ) {
ext::set < abstraction::ParamQualifiers::ParamQualifier > res;
 
auto lambda = [ & ] ( auto I ) {
res = abstraction::ParamQualifiers::paramQualifiers < std::tuple_element_t < decltype ( I )::value, std::tuple < Params ... > > > ( );
};
auto lambda = [ & ] ( auto I ) {
res = abstraction::ParamQualifiers::paramQualifiers < std::tuple_element_t < decltype ( I )::value, std::tuple < Params ... > > > ( );
};
 
ext::constexpr_switch < sizeof ... ( Params ) > ( index, lambda );
ext::constexpr_switch < sizeof ... ( Params ) > ( index, lambda );
 
return res;
}
};
return res;
}
 
} /* namespace abstraction */
 
......
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