Commit: 80efd2fed822d6eaeaeb8e954f8550f2fb6dc546
Author: Jacques Lucke
Date:   Fri Mar 1 17:19:36 2019 +0100
Branches: functions
https://developer.blender.org/rB80efd2fed822d6eaeaeb8e954f8550f2fb6dc546

split core into multiple files

===================================================================

M       source/blender/functions/CMakeLists.txt
M       source/blender/functions/FN_core.hpp
M       source/blender/functions/backends/dependencies/dependencies.hpp
D       source/blender/functions/core/core.hpp
M       source/blender/functions/core/data_flow_graph.hpp
A       source/blender/functions/core/function.cpp
A       source/blender/functions/core/function.hpp
A       source/blender/functions/core/parameter.cpp
A       source/blender/functions/core/parameter.hpp
R078    source/blender/functions/core/core.cpp  
source/blender/functions/core/signature.cpp
A       source/blender/functions/core/signature.hpp
A       source/blender/functions/core/type.hpp
M       source/blender/functions/core/type_inferencing.hpp
M       source/blender/functions/core/type_relations.hpp

===================================================================

diff --git a/source/blender/functions/CMakeLists.txt 
b/source/blender/functions/CMakeLists.txt
index 266326d9256..58552c06882 100644
--- a/source/blender/functions/CMakeLists.txt
+++ b/source/blender/functions/CMakeLists.txt
@@ -20,8 +20,13 @@ set(SRC
 
        c_wrapper.cpp
 
-       core/core.hpp
-       core/core.cpp
+       core/type.hpp
+       core/parameter.hpp
+       core/parameter.cpp
+       core/signature.hpp
+       core/signature.cpp
+       core/function.hpp
+       core/function.cpp
        core/data_flow_graph.hpp
        core/data_flow_graph.cpp
        core/dot_export.cpp
diff --git a/source/blender/functions/FN_core.hpp 
b/source/blender/functions/FN_core.hpp
index 45a481584d0..eec539caab9 100644
--- a/source/blender/functions/FN_core.hpp
+++ b/source/blender/functions/FN_core.hpp
@@ -1,6 +1,9 @@
 #pragma once
 
-#include "core/core.hpp"
+#include "core/type.hpp"
+#include "core/parameter.hpp"
+#include "core/signature.hpp"
+#include "core/function.hpp"
 #include "core/data_flow_graph.hpp"
 #include "core/type_relations.hpp"
 #include "core/type_inferencing.hpp"
\ No newline at end of file
diff --git a/source/blender/functions/backends/dependencies/dependencies.hpp 
b/source/blender/functions/backends/dependencies/dependencies.hpp
index 98e15db5a75..ed18aff0c10 100644
--- a/source/blender/functions/backends/dependencies/dependencies.hpp
+++ b/source/blender/functions/backends/dependencies/dependencies.hpp
@@ -29,6 +29,7 @@ namespace FN {
                static const char *identifier_in_composition();
                static void free_self(void *value);
 
+               virtual ~DependenciesBody() {}
                virtual void dependencies(Dependencies &deps) const = 0;
        };
 
diff --git a/source/blender/functions/core/core.hpp 
b/source/blender/functions/core/core.hpp
deleted file mode 100644
index a8b7fefc3bb..00000000000
--- a/source/blender/functions/core/core.hpp
+++ /dev/null
@@ -1,165 +0,0 @@
-#pragma once
-
-#include <string>
-#include <iostream>
-
-#include "BLI_composition.hpp"
-#include "BLI_small_vector.hpp"
-#include "BLI_small_map.hpp"
-#include "BLI_shared.hpp"
-
-namespace FN {
-
-       using namespace BLI;
-
-       class Type;
-       class Signature;
-       class Function;
-
-       using SharedType = Shared<Type>;
-       using SharedFunction = Shared<Function>;
-       using SmallTypeVector = SmallVector<SharedType>;
-
-       class Type final {
-       public:
-               Type() = delete;
-               Type(const std::string &name)
-                       : m_name(name) {}
-
-               const std::string &name() const
-               {
-                       return m_name;
-               }
-
-               template<typename T>
-               inline T *extension() const
-               {
-                       return m_extensions.get<T>();
-               }
-
-               template<typename T>
-               void extend(T *extension)
-               {
-                       BLI_assert(m_extensions.get<T>() == nullptr);
-                       m_extensions.add(extension);
-               }
-
-       private:
-               std::string m_name;
-               Composition m_extensions;
-       };
-
-       class Parameter {
-       public:
-               Parameter(const std::string &name, const SharedType &type)
-                       : m_name(name), m_type(type) {}
-
-               const std::string &name() const
-               {
-                       return m_name;
-               }
-
-               const SharedType &type() const
-               {
-                       return m_type;
-               }
-
-               void print() const;
-
-       private:
-               const std::string m_name;
-               const SharedType m_type;
-       };
-
-       class InputParameter final : public Parameter {
-       public:
-               InputParameter(const std::string &name, const SharedType &type)
-                       : Parameter(name, type) {}
-       };
-
-       class OutputParameter final : public Parameter {
-       public:
-               OutputParameter(const std::string &name, const SharedType &type)
-                       : Parameter(name, type) {}
-       };
-
-       using InputParameters = SmallVector<InputParameter>;
-       using OutputParameters = SmallVector<OutputParameter>;
-
-       class Signature {
-       public:
-               Signature() = default;
-               ~Signature() = default;
-
-               Signature(const InputParameters &inputs, const OutputParameters 
&outputs)
-                       : m_inputs(inputs), m_outputs(outputs) {}
-
-               inline const InputParameters &inputs() const
-               {
-                       return m_inputs;
-               }
-
-               inline const OutputParameters &outputs() const
-               {
-                       return m_outputs;
-               }
-
-               SmallTypeVector input_types() const;
-               SmallTypeVector output_types() const;
-
-               bool has_interface(
-                       const SmallTypeVector &inputs,
-                       const SmallTypeVector &outputs) const;
-
-               bool has_interface(
-                       const Signature &other) const;
-
-               void print(std::string indent = "") const;
-
-       private:
-               const InputParameters m_inputs;
-               const OutputParameters m_outputs;
-       };
-
-       class Function final {
-       public:
-               Function(const std::string &name, const Signature &signature)
-                       : m_name(name), m_signature(signature) {}
-
-               Function(const Signature &signature)
-                       : Function("Function", signature) {}
-
-               ~Function() = default;
-
-               const std::string &name() const
-               {
-                       return m_name;
-               }
-
-               inline const Signature &signature() const
-               {
-                       return m_signature;
-               }
-
-               template<typename T>
-               inline const T *body() const
-               {
-                       return m_bodies.get<T>();
-               }
-
-               template<typename T>
-               void add_body(const T *body)
-               {
-                       BLI_assert(m_bodies.get<T>() == nullptr);
-                       m_bodies.add(body);
-               }
-
-               void print() const;
-
-       private:
-               const std::string m_name;
-               const Signature m_signature;
-               Composition m_bodies;
-       };
-
-} /* namespace FN */
\ No newline at end of file
diff --git a/source/blender/functions/core/data_flow_graph.hpp 
b/source/blender/functions/core/data_flow_graph.hpp
index d23a47e1e2b..6709df54bb6 100644
--- a/source/blender/functions/core/data_flow_graph.hpp
+++ b/source/blender/functions/core/data_flow_graph.hpp
@@ -1,6 +1,6 @@
 #pragma once
 
-#include "core.hpp"
+#include "function.hpp"
 
 #include "BLI_small_set.hpp"
 #include "BLI_small_set_vector.hpp"
diff --git a/source/blender/functions/core/function.cpp 
b/source/blender/functions/core/function.cpp
new file mode 100644
index 00000000000..7a5b7683c66
--- /dev/null
+++ b/source/blender/functions/core/function.cpp
@@ -0,0 +1,11 @@
+#include "function.hpp"
+
+namespace FN {
+
+       void Function::print() const
+       {
+               std::cout << "Function: " << this->name() << std::endl;
+               this->signature().print("  ");
+       }
+
+} /* namespace FN */
\ No newline at end of file
diff --git a/source/blender/functions/core/function.hpp 
b/source/blender/functions/core/function.hpp
new file mode 100644
index 00000000000..b3d012f46a1
--- /dev/null
+++ b/source/blender/functions/core/function.hpp
@@ -0,0 +1,50 @@
+#pragma once
+
+#include "signature.hpp"
+
+namespace FN {
+
+       class Function final {
+       public:
+               Function(const std::string &name, const Signature &signature)
+                       : m_name(name), m_signature(signature) {}
+
+               Function(const Signature &signature)
+                       : Function("Function", signature) {}
+
+               ~Function() = default;
+
+               const std::string &name() const
+               {
+                       return m_name;
+               }
+
+               inline const Signature &signature() const
+               {
+                       return m_signature;
+               }
+
+               template<typename T>
+               inline const T *body() const
+               {
+                       return m_bodies.get<T>();
+               }
+
+               template<typename T>
+               void add_body(const T *body)
+               {
+                       BLI_assert(m_bodies.get<T>() == nullptr);
+                       m_bodies.add(body);
+               }
+
+               void print() const;
+
+       private:
+               const std::string m_name;
+               const Signature m_signature;
+               Composition m_bodies;
+       };
+
+       using SharedFunction = Shared<Function>;
+
+} /* namespace FN */
\ No newline at end of file
diff --git a/source/blender/functions/core/parameter.cpp 
b/source/blender/functions/core/parameter.cpp
new file mode 100644
index 00000000000..8f2b0ec5df3
--- /dev/null
+++ b/source/blender/functions/core/parameter.cpp
@@ -0,0 +1,10 @@
+#include "parameter.hpp"
+
+namespace FN {
+
+       void Parameter::print() const
+       {
+               std::cout << this->type()->name() << " - " << this->name();
+       }
+
+} /* namespace FN */
\ No newline at end of file
diff --git a/source/blender/functions/core/parameter.hpp 
b/source/blender/functions/core/parameter.hpp
new file mode 100644
index 00000000000..0b86af2a29d
--- /dev/null
+++ b/source/blender/functions/core/parameter.hpp
@@ -0,0 +1,44 @@
+#pragma once
+
+#include "type.hpp"
+
+namespace FN {
+
+       class Parameter {
+       public:
+               Parameter(const std::string &name, const SharedType &type)
+                       : m_name(name), m_type(type) {}
+
+               const std::string &name() const
+               {
+                       return m_name;
+               }
+
+               const SharedType &type() const
+               {
+                       return m_type;
+               }
+
+               void print() const;
+
+       private:
+               const std::string m_name;
+               const SharedType m_type;
+       };
+
+       class InputParameter final : public Parameter {
+       public:
+               InputParameter(const std::string &name, const SharedType &type)
+                       : Parameter(name, type) {}
+       };
+
+       class OutputParameter final : public Parameter {
+       public:
+               OutputParameter(const std::string &name, const SharedType &type)
+                       : Parameter(name, type) {}
+       };
+
+       using InputParameters = SmallVector<InputParameter>;
+       using OutputParameters = SmallVector<OutputParameter>;
+
+} /* namespace FN */
\ No newline at end of file
diff --git a/source/blender/functions/core/core.cpp 
b/source/blender/functions/core/signature.cpp
similarity index 78%
rename from source/blender/functions/core/core.cpp
rename to source/blender/functions/core/signature.cpp
index 447c3ece824..ec0d49da696 100644
--- a/source/blender/functions/core/core.cpp
+++ b/source/blender/functions/core/signature.cpp
@@ -1,4 +1,4 @@
-#include "core.hpp"
+#include "signature.hpp"
 
 namespace FN {
 
@@ -35,15 +35,6 @@ namespace FN {
                return this->has_interface(other.input_types(), 
other.output_types());
        }
 
-
-       /* Printing
-        ***************************************/
-
-       void Parameter::print() const
-       {
-               std::cout << this->type()->name() << " - " << this->name();
-       }
-
        void Signature::print(std::string indent) const
        {
                std::cout << indent << "Inputs:" << std::endl;
@@ -60,10 +51,4 @@ namespace FN {
                }
        }
 
-       void Function::print() const
-       {
-               std::cout << "Function: " << this->name() << std::endl;
-               this->signature().print("  ");
-       }
-
 } /* namespace FN */
\ No newline at end of file
diff --git a/source/blender/functions/core/signature.hpp 
b/source/blender/functions/core/signature.hpp
new file mode 100644
index 00000000000..2128aa99896
--- /dev/null
+++ b/source/blender/functions/core/signature.hpp
@@ -0,0 +1,42 @@
+#pragma once
+
+#include "parameter.hpp"
+
+namespace FN {
+
+       class Signature {
+       public:
+               Signature() = default;
+               ~Signature() = default;
+
+               Signature(const InputParameters &inputs, const OutputParameters 
&out

@@ Diff output truncated at 10240 characters. @@

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to