[Bf-blender-cvs] [11bfd81] depsgraph_refactor: Moved function templates for operation binding into the main depsgraph_build.h header.
Lukas Tönne
noreply at git.blender.org
Thu Jun 19 09:11:32 CEST 2014
Commit: 11bfd81f3e2e37d24acaf28b9a175257464516b9
Author: Lukas Tönne
Date: Thu Jun 19 07:38:40 2014 +0200
https://developer.blender.org/rB11bfd81f3e2e37d24acaf28b9a175257464516b9
Moved function templates for operation binding into the main
depsgraph_build.h header.
===================================================================
M source/blender/depsgraph/intern/depsgraph_build.h
M source/blender/depsgraph/intern/depsgraph_build_nodes.cpp
===================================================================
diff --git a/source/blender/depsgraph/intern/depsgraph_build.h b/source/blender/depsgraph/intern/depsgraph_build.h
index 9d964ef..4b875ed 100644
--- a/source/blender/depsgraph/intern/depsgraph_build.h
+++ b/source/blender/depsgraph/intern/depsgraph_build.h
@@ -27,6 +27,10 @@
#ifndef __DEPSGRAPH_BUILD_H__
#define __DEPSGRAPH_BUILD_H__
+#include <cstddef> /* for std::size_t */
+#include <tuple>
+#include <type_traits>
+
#include "depsgraph_types.h"
#include "depsgraph_util_id.h"
@@ -59,6 +63,45 @@ struct TimeSourceDepsNode;
struct ComponentDepsNode;
struct OperationDepsNode;
+namespace detail {
+
+using std::forward;
+using std::tuple;
+using std::tuple_size;
+using std::get;
+using std::size_t;
+
+template <size_t N>
+struct bind_operation_tuple_impl {
+ template <typename Func, typename... Args, typename... ArgsTail>
+ static DepsEvalOperationCb bind_operation_tuple(Func &&func, tuple<Args...> &&args, ArgsTail... tail)
+ {
+ typedef decltype(get<N-1>(args)) T;
+ T &&head = get<N-1>(args);
+
+ return bind_operation_tuple_impl<N-1>::bind_operation_tuple(forward<Func>(func), forward<tuple<Args...>>(args), forward<T>(head), tail...);
+ }
+};
+
+template <>
+struct bind_operation_tuple_impl<0> {
+ template <typename Func, typename... Args, typename... ArgsTail>
+ static DepsEvalOperationCb bind_operation_tuple(Func &&func, tuple<Args...> &&args, ArgsTail... tail)
+ {
+ return std::bind(func, tail...);
+ }
+};
+
+} /* namespace detail */
+
+template <typename Func, typename... Args>
+static DepsEvalOperationCb bind_operation(Func func, Args... args)
+{
+ typedef std::tuple_size<std::tuple<Args...>> args_size;
+
+ return detail::bind_operation_tuple_impl<args_size::value>::bind_operation_tuple(func, std::tuple<Args...>(args...));
+}
+
struct DepsgraphNodeBuilder {
DepsgraphNodeBuilder(Main *bmain, Depsgraph *graph);
~DepsgraphNodeBuilder();
diff --git a/source/blender/depsgraph/intern/depsgraph_build_nodes.cpp b/source/blender/depsgraph/intern/depsgraph_build_nodes.cpp
index 5f73c42..1a2fbc2 100644
--- a/source/blender/depsgraph/intern/depsgraph_build_nodes.cpp
+++ b/source/blender/depsgraph/intern/depsgraph_build_nodes.cpp
@@ -282,53 +282,6 @@ IDDepsNode *DepsgraphNodeBuilder::build_object(Scene *scene, Object *ob)
return ob_node;
}
-#include <cstddef> // for std::size_t
-#include <tuple>
-#include <type_traits>
-
-typedef function<void ()> EvalFunc;
-//typedef function<EvalFunc ()> BindFunc;
-
-namespace detail {
-
-using std::forward;
-using std::tuple;
-using std::tuple_size;
-using std::get;
-using std::size_t;
-
-template <size_t N>
-struct bind_tuple_impl {
- template <typename Func, typename... Args, typename... ArgsTail>
- static EvalFunc bind_operation_tuple(Func &&func, tuple<Args...> &&args, ArgsTail... tail)
- {
- typedef decltype(get<N-1>(args)) T;
- T &&head = get<N-1>(args);
-
- return bind_tuple_impl<N-1>::bind_operation_tuple(forward<Func>(func), forward<tuple<Args...>>(args), forward<T>(head), tail...);
- }
-};
-
-template <>
-struct bind_tuple_impl<0> {
- template <typename Func, typename... Args, typename... ArgsTail>
- static EvalFunc bind_operation_tuple(Func &&func, tuple<Args...> &&args, ArgsTail... tail)
- {
- return std::bind(func, tail...);
- }
-};
-
-} /* namespace detail */
-
-template <typename Func, typename... Args>
-static EvalFunc bind_operation(Func func, Args... args)
-{
- typedef std::tuple_size<std::tuple<Args...>> args_size;
-
- return detail::bind_tuple_impl<args_size::value>::bind_operation_tuple(func, std::tuple<Args...>(args...));
-}
-
-
ComponentDepsNode *DepsgraphNodeBuilder::build_object_transform(Object *ob, IDDepsNode *ob_node)
{
/* component to hold all transform operations */
More information about the Bf-blender-cvs
mailing list