summaryrefslogtreecommitdiff
path: root/src/core/common/Function.hpp
diff options
context:
space:
mode:
authorAndreas Stöckel <astoecke@techfak.uni-bielefeld.de>2014-12-21 15:28:30 +0100
committerAndreas Stöckel <andreas@somweyr.de>2014-12-21 15:28:30 +0100
commitda3b35e77c1e22b46264df4c1b2a48f867d1e15e (patch)
treed483940d49f2d5ba7fac86187174cc7d70714f9d /src/core/common/Function.hpp
parent54d66cfa220128ae6c7cd05aa5db3354e459105b (diff)
changed RttiTypes from class to namespace
Diffstat (limited to 'src/core/common/Function.hpp')
-rw-r--r--src/core/common/Function.hpp33
1 files changed, 17 insertions, 16 deletions
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 <cassert>
-#include <memory>
#include <core/managed/Managed.hpp>
+#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 T>
-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.
*
@@ -93,14 +97,6 @@ public:
Method(Callback method) : method(method){};
/**
- * Creates a copy of this Method object.
- */
- std::unique_ptr<AbstractFunction> clone() const override
- {
- return std::unique_ptr<AbstractFunction>{new Method<T>(method)};
- }
-
- /**
* Calls the underlying method.
*
* @param args is a vector containing all arguments that shouild be passed
@@ -120,6 +116,11 @@ public:
return method(args, tRef);
}
};
+
+namespace RttiTypes {
+ extern const Rtti<Function> Function;
+}
+
}
#endif /* _OUSIA_FUNCTION_HPP_ */