[Bf-blender-cvs] [7a7592e6158] functions: comment on CPPTypeInfo
Jacques Lucke
noreply at git.blender.org
Tue Jul 2 18:39:14 CEST 2019
Commit: 7a7592e6158e7f6b92e0f149473ddc418d37c295
Author: Jacques Lucke
Date: Tue Jul 2 18:01:06 2019 +0200
Branches: functions
https://developer.blender.org/rB7a7592e6158e7f6b92e0f149473ddc418d37c295
comment on CPPTypeInfo
===================================================================
M source/blender/functions/backends/tuple/cpp_types.hpp
===================================================================
diff --git a/source/blender/functions/backends/tuple/cpp_types.hpp b/source/blender/functions/backends/tuple/cpp_types.hpp
index 4130264a424..2ba6badf962 100644
--- a/source/blender/functions/backends/tuple/cpp_types.hpp
+++ b/source/blender/functions/backends/tuple/cpp_types.hpp
@@ -1,5 +1,13 @@
#pragma once
+/**
+ * The CPPTypeInfo class is a type extension for the C++ backend. It contains run-time type
+ * information for an arbitrary C++ type.
+ *
+ * Usually, the class does not have to be subclassed manually, because there is a template that
+ * implements all methods for any C++ type automatically.
+ */
+
#include "FN_core.hpp"
namespace FN {
@@ -12,14 +20,48 @@ class CPPTypeInfo : public TypeExtension {
{
}
+ /**
+ * Get the size of the type in bytes.
+ */
virtual uint size_of_type() const = 0;
+
+ /**
+ * Construct a default version of that type at the given pointer.
+ */
virtual void construct_default(void *ptr) const = 0;
+
+ /**
+ * Destruct the value at the given pointer.
+ */
virtual void destruct_type(void *ptr) const = 0;
+
+ /**
+ * Copy the value from src to dst. The destination buffer already contains another instance of
+ * the same type which should be overriden.
+ */
virtual void copy_to_initialized(void *src, void *dst) const = 0;
+
+ /**
+ * Copy the value from src to dst. The destination buffer contains uninitialized memory.
+ */
virtual void copy_to_uninitialized(void *src, void *dst) const = 0;
+
+ /**
+ * Copy the value from src to dst and destroy the original value in src. The destination buffer
+ * already contains another instance of the same type which should be overriden.
+ */
virtual void relocate_to_initialized(void *src, void *dst) const = 0;
+
+ /**
+ * Copy the value from src to dst and destroy the original value in src. The destination buffer
+ * contains uninitialized memory.
+ */
virtual void relocate_to_uninitialized(void *src, void *dst) const = 0;
+ /**
+ * Return true when the type can be destructed without doing anything. Otherwise false.
+ * This is just a hint to improve performance in some cases.
+ */
virtual bool trivially_destructible() const = 0;
};
More information about the Bf-blender-cvs
mailing list