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

merge runtimeReturnType and ReturnType

parent 8397321f
No related branches found
No related tags found
No related merge requests found
......@@ -33,7 +33,6 @@ public:
 
virtual ext::type_index getParamTypeIndex ( unsigned index ) const = 0;
virtual ext::type_index getReturnTypeIndex ( ) const = 0;
virtual ext::type_index getRuntimeReturnTypeIndex ( ) const = 0;
 
std::string getParamType ( unsigned index ) const {
return ext::to_string ( getParamTypeIndex ( index ) );
......@@ -43,10 +42,6 @@ public:
return ext::to_string ( getReturnTypeIndex ( ) );
}
 
std::string getRuntimeReturnType ( ) const {
return ext::to_string ( getRuntimeReturnTypeIndex ( ) );
}
virtual std::shared_ptr < abstraction::OperationAbstraction > getProxyAbstraction ( ) {
return shared_from_this();
}
......
......@@ -109,10 +109,6 @@ public:
return m_abstractions [ m_resultId ]->getReturnTypeIndex ( );
}
 
virtual ext::type_index getRuntimeReturnTypeIndex ( ) const override {
return m_abstractions [ m_resultId ]->getRuntimeReturnTypeIndex ( );
}
virtual std::shared_ptr < abstraction::OperationAbstraction > getProxyAbstraction ( ) override {
return m_abstractions [ m_resultId ]->getProxyAbstraction ( );
}
......
......@@ -58,13 +58,6 @@ public:
return ext::type_index ( typeid ( ReturnType ) );
}
 
virtual ext::type_index getRuntimeReturnTypeIndex ( ) const override {
if ( cached ( ) )
return ext::type_index ( typeid ( getData ( ) ) );
else
throw std::domain_error ( "Runtime type unknown before evaluation." );
}
virtual bool cached ( ) const override {
return ( bool ) m_data;
}
......@@ -110,13 +103,6 @@ public:
return ext::type_index ( typeid ( ReturnType ) );
}
 
virtual ext::type_index getRuntimeReturnTypeIndex ( ) const override {
if ( cached ( ) )
return ext::type_index ( typeid ( getData ( ) ) );
else
throw std::domain_error ( "Runtime type unknown before evaluation." );
}
virtual bool cached ( ) const override {
return ( bool ) m_data;
}
......@@ -162,13 +148,6 @@ public:
return ext::type_index ( typeid ( ReturnType ) );
}
 
virtual ext::type_index getRuntimeReturnTypeIndex ( ) const override {
if ( cached ( ) )
return ext::type_index ( typeid ( getData ( ) ) );
else
throw std::domain_error ( "Runtime type unknown before evaluation." );
}
virtual bool cached ( ) const override {
return ( bool ) m_data;
}
......@@ -214,13 +193,6 @@ public:
return ext::type_index ( typeid ( ReturnType ) );
}
 
virtual ext::type_index getRuntimeReturnTypeIndex ( ) const override {
if ( cached ( ) )
return ext::type_index ( typeid ( getConstData ( ) ) );
else
throw std::domain_error ( "Runtime type unknown before evaluation." );
}
virtual bool cached ( ) const override {
return ( bool ) m_data;
}
......@@ -268,13 +240,6 @@ public:
return ext::type_index ( typeid ( ReturnType ) );
}
 
virtual ext::type_index getRuntimeReturnTypeIndex ( ) const override {
if ( cached ( ) )
return ext::type_index ( typeid ( getData ( ) ) );
else
throw std::domain_error ( "Runtime type unknown before evaluation." );
}
virtual bool cached ( ) const override {
return ( bool ) m_data;
}
......@@ -322,13 +287,6 @@ public:
return ext::type_index ( typeid ( ReturnType ) );
}
 
virtual ext::type_index getRuntimeReturnTypeIndex ( ) const override {
if ( cached ( ) )
return ext::type_index ( typeid ( getConstData ( ) ) );
else
throw std::domain_error ( "Runtime type unknown before evaluation." );
}
virtual bool cached ( ) const override {
return ( bool ) m_data;
}
......@@ -350,10 +308,6 @@ public:
return ext::type_index ( typeid ( void ) );
}
 
virtual ext::type_index getRuntimeReturnTypeIndex ( ) const override {
return ext::type_index ( typeid ( void ) );
}
virtual bool cached ( ) const override {
return false;
}
......
......@@ -133,13 +133,6 @@ public:
return ext::type_index ( typeid ( ReturnType ) );
}
 
virtual ext::type_index getRuntimeReturnTypeIndex ( ) const override {
if ( this->cached ( ) )
return ext::type_index ( typeid ( ReturnType ) );
else
throw std::domain_error ( "Runtime type unknown before evaluation." );
}
};
 
template < class ... ParamTypes >
......@@ -157,14 +150,10 @@ public:
}
 
virtual ext::type_index getReturnTypeIndex ( ) const override {
return getRuntimeReturnTypeIndex ( );
}
virtual ext::type_index getRuntimeReturnTypeIndex ( ) const override {
if ( this->cached ( ) )
return this->m_abstraction->getProxyAbstraction ( )->getRuntimeReturnTypeIndex ( );
return this->m_abstraction->getProxyAbstraction ( )->getReturnTypeIndex ( );
else
throw std::domain_error ( "Runtime type unknown before evaluation." );
throw std::domain_error ( "Return type unknown before evaluation." );
}
 
};
......
......@@ -81,7 +81,7 @@ public:
const T & getVariable ( const std::string & name ) const {
std::shared_ptr < abstraction::ValueProvider < const T & > > ptr = abstraction::translateParam < const T & > ( getVariableInt ( name ) );
if ( ! ptr )
throw exception::CommonException ( "Invalid variable type. Requested: " + ext::to_string < T > ( ) + ", actual : " + getVariableInt ( name )->getRuntimeReturnType ( ) );
throw exception::CommonException ( "Invalid variable type. Requested: " + ext::to_string < T > ( ) + ", actual : " + getVariableInt ( name )->getReturnType ( ) );
return ptr->getConstValueReference ( );
}
 
......@@ -124,7 +124,7 @@ public:
if ( ptr3 )
return ! ptr3->getValue ( false );
 
throw exception::CommonException ( "Invalid result type. Provided: " + m_result->getRuntimeReturnType ( ) );
throw exception::CommonException ( "Invalid result type. Provided: " + m_result->getReturnType ( ) );
} else {
return 0;
}
......
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