diff --git a/alib2abstraction/src/abstraction/AnyaryOperationAbstraction.hpp b/alib2abstraction/src/abstraction/AnyaryOperationAbstraction.hpp index fd705dc40ae9aa7095ffa333abec6fdc4326b004..ffec9d017183e405f9e06161937d9278a1b06516 100644 --- a/alib2abstraction/src/abstraction/AnyaryOperationAbstraction.hpp +++ b/alib2abstraction/src/abstraction/AnyaryOperationAbstraction.hpp @@ -51,14 +51,6 @@ public: AnyaryOperationAbstraction ( ) { } - virtual bool inputsReady ( ) const override { - for ( const std::pair < std::shared_ptr < OperationAbstraction >, bool > & param : m_params ) - if ( ! ( bool ) param.first || ! param.first->isReady ( ) ) - return false; - - return true; - } - virtual bool inputsAttached ( ) const override { for ( const std::pair < std::shared_ptr < OperationAbstraction >, bool > & param : m_params ) if ( ! ( bool ) param.first ) diff --git a/alib2abstraction/src/abstraction/NaryOperationAbstraction.hpp b/alib2abstraction/src/abstraction/NaryOperationAbstraction.hpp index 625962c3f85f2e62ec5bdb28dc422f1e1e028158..655852335925da07cb7e39d02c959937996d096d 100644 --- a/alib2abstraction/src/abstraction/NaryOperationAbstraction.hpp +++ b/alib2abstraction/src/abstraction/NaryOperationAbstraction.hpp @@ -58,14 +58,6 @@ public: } } - virtual bool inputsReady ( ) const override { - for ( const std::pair < std::shared_ptr < OperationAbstraction >, bool > & param : m_params ) - if ( ! param.first || ! param.first->isReady ( ) ) - return false; - - return true; - } - virtual bool inputsAttached ( ) const override { for ( const std::pair < std::shared_ptr < OperationAbstraction >, bool > & param : m_params ) if ( ! param.first ) diff --git a/alib2abstraction/src/abstraction/OperationAbstraction.hpp b/alib2abstraction/src/abstraction/OperationAbstraction.hpp index 64b73fa94459190a404bbff156da5c21ac4c05ba..6334afdfaecdb83235aa675a4ce5c9b8ad66b89e 100644 --- a/alib2abstraction/src/abstraction/OperationAbstraction.hpp +++ b/alib2abstraction/src/abstraction/OperationAbstraction.hpp @@ -25,12 +25,10 @@ public: virtual ~OperationAbstraction ( ) noexcept { } - virtual bool inputsReady ( ) const = 0; virtual bool inputsAttached ( ) const = 0; virtual bool eval ( ) = 0; virtual unsigned numberOfParams ( ) const = 0; virtual bool cached ( ) const = 0; - virtual bool isReady ( ) const = 0; virtual ext::type_index getParamTypeIndex ( unsigned index ) const = 0; virtual ext::type_index getReturnTypeIndex ( ) const = 0; diff --git a/alib2abstraction/src/abstraction/PackingAbstraction.hpp b/alib2abstraction/src/abstraction/PackingAbstraction.hpp index 9f9ab75764aa88095ec36e167c5281aaa1bd6863..30a416db5b9c2921accfe744ab8627d74368146a 100644 --- a/alib2abstraction/src/abstraction/PackingAbstraction.hpp +++ b/alib2abstraction/src/abstraction/PackingAbstraction.hpp @@ -66,14 +66,6 @@ private: return res; } public: - virtual bool inputsReady ( ) const override { - for ( const std::shared_ptr < abstraction::OperationAbstraction > & operation : m_abstractions ) - if ( operation->inputsReady ( ) == false ) - return false; - - return true; - } - virtual bool inputsAttached ( ) const override { for ( const std::shared_ptr < abstraction::OperationAbstraction > & operation : m_abstractions ) if ( operation->inputsAttached ( ) == false ) @@ -100,10 +92,6 @@ public: return NumberOfParams; } - virtual bool isReady ( ) const override { - return m_abstractions [ m_resultId ]->isReady ( ); - } - virtual bool cached ( ) const override { return m_abstractions [ m_resultId ]->cached ( ); } diff --git a/alib2abstraction/src/abstraction/ValueOperationAbstraction.hpp b/alib2abstraction/src/abstraction/ValueOperationAbstraction.hpp index e2d8cdbe14baa3b8980d17b06136b513a51f375a..642da8101111f89a6ffc8150d802c7701f438920 100644 --- a/alib2abstraction/src/abstraction/ValueOperationAbstraction.hpp +++ b/alib2abstraction/src/abstraction/ValueOperationAbstraction.hpp @@ -38,27 +38,23 @@ protected: public: template < typename ... ParamTypes, typename Callable > inline void run_helper ( Callable callback, const ext::array < std::pair < std::shared_ptr < OperationAbstraction >, bool >, sizeof ... ( ParamTypes ) > & inputs ) { - if ( ! isReady ( ) ) + if ( ! cached ( ) ) m_data = abstraction::apply < ParamTypes ... > ( callback, inputs ); } - virtual bool isReady ( ) const override { - return ( bool ) m_data; - } - virtual ext::type_index getReturnTypeIndex ( ) const override { return ext::type_index ( typeid ( ReturnType ) ); } virtual ext::type_index getRuntimeReturnTypeIndex ( ) const override { - if ( isReady ( ) ) + if ( cached ( ) ) return ext::type_index ( typeid ( getData ( ) ) ); else throw std::domain_error ( "Runtime type unknown before evaluation." ); } virtual bool cached ( ) const override { - return isReady ( ); + return ( bool ) m_data; } }; @@ -78,27 +74,23 @@ protected: public: template < typename ... ParamTypes, typename Callable > inline void run_helper ( Callable callback, const ext::array < std::pair < std::shared_ptr < OperationAbstraction >, bool >, sizeof ... ( ParamTypes ) > & inputs ) { - if ( ! isReady ( ) ) + if ( ! cached ( ) ) m_data = std::reference_wrapper < ReturnType > ( abstraction::apply < ParamTypes ... > ( callback, inputs ) ); } - virtual bool isReady ( ) const override { - return ( bool ) m_data; - } - virtual ext::type_index getReturnTypeIndex ( ) const override { return ext::type_index ( typeid ( ReturnType ) ); } virtual ext::type_index getRuntimeReturnTypeIndex ( ) const override { - if ( isReady ( ) ) + if ( cached ( ) ) return ext::type_index ( typeid ( getData ( ) ) ); else throw std::domain_error ( "Runtime type unknown before evaluation." ); } virtual bool cached ( ) const override { - return isReady ( ); + return ( bool ) m_data; } }; @@ -114,27 +106,23 @@ protected: public: template < typename ... ParamTypes, typename Callable > inline void run_helper ( Callable callback, const ext::array < std::pair < std::shared_ptr < OperationAbstraction >, bool >, sizeof ... ( ParamTypes ) > & inputs ) { - if ( ! isReady ( ) ) + if ( ! cached ( ) ) m_data = std::reference_wrapper < const ReturnType > ( abstraction::apply < ParamTypes ... > ( callback, inputs ) ); } - virtual bool isReady ( ) const override { - return ( bool ) m_data; - } - virtual ext::type_index getReturnTypeIndex ( ) const override { return ext::type_index ( typeid ( ReturnType ) ); } virtual ext::type_index getRuntimeReturnTypeIndex ( ) const override { - if ( isReady ( ) ) + if ( cached ( ) ) return ext::type_index ( typeid ( getConstData ( ) ) ); else throw std::domain_error ( "Runtime type unknown before evaluation." ); } virtual bool cached ( ) const override { - return isReady ( ); + return ( bool ) m_data; } }; @@ -154,29 +142,25 @@ protected: public: template < typename ... ParamTypes, typename Callable > inline void run_helper ( Callable callback, const ext::array < std::pair < std::shared_ptr < OperationAbstraction >, bool >, sizeof ... ( ParamTypes ) > & inputs ) { - if ( ! isReady ( ) ) { + if ( ! cached ( ) ) { ReturnType && res = abstraction::apply < ParamTypes ... > ( callback, inputs ); m_data = std::reference_wrapper < ReturnType > ( res ); } } - virtual bool isReady ( ) const override { - return ( bool ) m_data; - } - virtual ext::type_index getReturnTypeIndex ( ) const override { return ext::type_index ( typeid ( ReturnType ) ); } virtual ext::type_index getRuntimeReturnTypeIndex ( ) const override { - if ( isReady ( ) ) + if ( cached ( ) ) return ext::type_index ( typeid ( getData ( ) ) ); else throw std::domain_error ( "Runtime type unknown before evaluation." ); } virtual bool cached ( ) const override { - return isReady ( ); + return ( bool ) m_data; } }; @@ -192,29 +176,25 @@ protected: public: template < typename ... ParamTypes, typename Callable > inline void run_helper ( Callable callback, const ext::array < std::pair < std::shared_ptr < OperationAbstraction >, bool >, sizeof ... ( ParamTypes ) > & inputs ) { - if ( ! isReady ( ) ) { + if ( ! cached ( ) ) { const ReturnType && res = abstraction::apply < ParamTypes ... > ( callback, inputs ); m_data = std::reference_wrapper < const ReturnType > ( res ); } } - virtual bool isReady ( ) const override { - return ( bool ) m_data; - } - virtual ext::type_index getReturnTypeIndex ( ) const override { return ext::type_index ( typeid ( ReturnType ) ); } virtual ext::type_index getRuntimeReturnTypeIndex ( ) const override { - if ( isReady ( ) ) + if ( cached ( ) ) return ext::type_index ( typeid ( getConstData ( ) ) ); else throw std::domain_error ( "Runtime type unknown before evaluation." ); } virtual bool cached ( ) const override { - return isReady ( ); + return ( bool ) m_data; } }; @@ -226,10 +206,6 @@ public: abstraction::apply < ParamTypes ... > ( callback, inputs ); } - virtual bool isReady ( ) const override { - return true; - } - virtual ext::type_index getReturnTypeIndex ( ) const override { return ext::type_index ( typeid ( void ) ); } diff --git a/alib2abstraction/src/abstraction/ValueProvider.hpp b/alib2abstraction/src/abstraction/ValueProvider.hpp index 6bc7a301d59a03b651d6365bba477e61d344eec9..596673160920229c376a1d3cd92364c62553badd 100644 --- a/alib2abstraction/src/abstraction/ValueProvider.hpp +++ b/alib2abstraction/src/abstraction/ValueProvider.hpp @@ -53,8 +53,6 @@ public: } virtual bool eval ( ) = 0; - - virtual bool isReady ( ) const = 0; }; template < class Type > @@ -72,8 +70,6 @@ public: } virtual bool eval ( ) = 0; - - virtual bool isReady ( ) const = 0; }; template < class Type > @@ -91,8 +87,6 @@ public: } virtual bool eval ( ) = 0; - - virtual bool isReady ( ) const = 0; }; template < class Type > @@ -113,8 +107,6 @@ public: } virtual bool eval ( ) = 0; - - virtual bool isReady ( ) const = 0; }; template < class Type > @@ -135,8 +127,6 @@ public: } virtual bool eval ( ) = 0; - - virtual bool isReady ( ) const = 0; }; } /* namespace abstraction */ diff --git a/alib2abstraction/src/abstraction/WrapperAbstraction.hpp b/alib2abstraction/src/abstraction/WrapperAbstraction.hpp index b32bfb3ad7094109363c7090769a86c472031d3e..47f050ffe7d66787d14ae514e323fad2f7db02f1 100644 --- a/alib2abstraction/src/abstraction/WrapperAbstraction.hpp +++ b/alib2abstraction/src/abstraction/WrapperAbstraction.hpp @@ -57,14 +57,6 @@ private: } public: - virtual bool inputsReady ( ) const override { - for ( const std::pair < std::shared_ptr < OperationAbstraction >, bool > & param : m_params ) - if ( ! param.first || ! param.first->isReady ( ) ) - return false; - - return true; - } - virtual bool inputsAttached ( ) const override { for ( const std::pair < std::shared_ptr < OperationAbstraction >, bool > & param : m_params ) if ( ! param.first ) @@ -92,12 +84,8 @@ public: return sizeof ... ( ParamTypes ); } - virtual bool isReady ( ) const override { - return ( bool ) m_abstraction && m_abstraction->isReady ( ); - } - virtual bool cached ( ) const override { - return isReady ( ); + return ( bool ) m_abstraction && m_abstraction->cached ( ); } virtual ext::type_index getParamTypeIndex ( unsigned index ) const override { @@ -105,7 +93,7 @@ public: } virtual std::shared_ptr < abstraction::OperationAbstraction > getProxyAbstraction ( ) override { - if ( this->isReady ( ) ) + if ( this->cached ( ) ) return this->m_abstraction->getProxyAbstraction ( ); else throw std::domain_error ( "Proxy abstraction not avaiable before evaluation." ); @@ -142,7 +130,7 @@ public: } virtual ext::type_index getRuntimeReturnTypeIndex ( ) const override { - if ( this->isReady ( ) ) + if ( this->cached ( ) ) return ext::type_index ( typeid ( ReturnType ) ); else throw std::domain_error ( "Runtime type unknown before evaluation." ); @@ -169,7 +157,7 @@ public: } virtual ext::type_index getRuntimeReturnTypeIndex ( ) const override { - if ( this->isReady ( ) ) + if ( this->cached ( ) ) return this->m_abstraction->getProxyAbstraction ( )->getRuntimeReturnTypeIndex ( ); else throw std::domain_error ( "Runtime type unknown before evaluation." );