From da3b35e77c1e22b46264df4c1b2a48f867d1e15e Mon Sep 17 00:00:00 2001 From: Andreas Stöckel Date: Sun, 21 Dec 2014 15:28:30 +0100 Subject: changed RttiTypes from class to namespace --- src/core/common/Function.hpp | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) (limited to 'src/core/common/Function.hpp') diff --git a/src/core/common/Function.hpp b/src/core/common/Function.hpp index 0274603..e0d87dd 100644 --- a/src/core/common/Function.hpp +++ b/src/core/common/Function.hpp @@ -29,23 +29,25 @@ #define _OUSIA_FUNCTION_HPP_ #include -#include #include +#include "Rtti.hpp" #include "Variant.hpp" namespace ousia { /** - * The AbstractFunction interface defines all the methods needed to represent - * a reference at a generic function object. Function objects can be called - * using the call function in which an array of Variant is supplied to the - * function and a Variant is returned to the caller. + * The Function interface defines all the methods needed to represent a + * generic function. Function objects can be called using the "call" function in + * which an array of Variant is supplied to the function and a Variant is + * returned to the caller. */ -class AbstractFunction : public Managed { -public: +class Function : public Managed { +protected: + using Managed::Managed; +public: /** * Abstract function which is meant to call the underlying function (be it * a host or a script function) with the given arguments. @@ -65,7 +67,7 @@ public: * @tparam T is the type of the method that should be called. */ template -class Method : public AbstractFunction { +class Method : public Function { public: /** * Type of the Callback function that is being called by the "call" @@ -85,6 +87,8 @@ private: const Callback method; public: + using Function::Function; + /** * Constructor of the Method class. * @@ -92,14 +96,6 @@ public: */ Method(Callback method) : method(method){}; - /** - * Creates a copy of this Method object. - */ - std::unique_ptr clone() const override - { - return std::unique_ptr{new Method(method)}; - } - /** * Calls the underlying method. * @@ -120,6 +116,11 @@ public: return method(args, tRef); } }; + +namespace RttiTypes { + extern const Rtti Function; +} + } #endif /* _OUSIA_FUNCTION_HPP_ */ -- cgit v1.2.3