Blender
V3.3
|
#include <BLI_cpp_type.hh>
Classes | |
struct | type_tag |
Static Public Member Functions | |
template<typename T > | |
static const CPPType & | get () |
template<typename T > | |
static const CPPType & | get_impl () |
Public Attributes | |
void(*)(void *) | destruct_fn () const |
Friends | |
bool | operator== (const CPPType &a, const CPPType &b) |
bool | operator!= (const CPPType &a, const CPPType &b) |
Definition at line 101 of file BLI_cpp_type.hh.
blender::CPPType::CPPType | ( | CPPTypeParam< T, Flags > | , |
StringRef | debug_name | ||
) |
Definition at line 209 of file BLI_cpp_type_make.hh.
References default_value(), EqualityComparable, Hashable, Printable, and T.
|
virtualdefault |
|
inline |
Required memory alignment for an instance of this type.
C++ equivalent: alignof(T);
Definition at line 207 of file BLI_cpp_type.hh.
Referenced by compute_geometry(), blender::modifiers::geometry_nodes::GeometryNodesEvaluator::execute_multi_function_node__field(), blender::modifiers::geometry_nodes::GeometryNodesEvaluator::execute_multi_function_node__value(), blender::fn::FieldConstant::FieldConstant(), blender::modifiers::geometry_nodes::GeometryNodesEvaluator::forward_output(), blender::modifiers::geometry_nodes::GeometryNodesEvaluator::get_value_from_socket(), blender::GMutableVArraySpan::GMutableVArraySpan(), blender::GVArray::GVArray(), blender::GVArrayImpl_For_SingleValue::GVArrayImpl_For_SingleValue(), blender::GVArrayImpl_For_SmallTrivialSingleValue< BufferSize >::GVArrayImpl_For_SmallTrivialSingleValue(), blender::GVArraySpan::GVArraySpan(), blender::nodes::geometry_nodes_eval_log::LocalGeoLogger::log_value_for_sockets(), and blender::tests::TEST().
|
inline |
Definition at line 629 of file BLI_cpp_type.hh.
Copy an instance of this type from src to dst.
C++ equivalent: dst = src;
Definition at line 393 of file BLI_cpp_type.hh.
References BLI_assert, pointer_can_point_to_instance(), and src.
Referenced by blender::GVArrayImpl_For_SingleValueRef::get(), blender::GVArrayImpl_For_GSpan::get(), blender::GVArrayCommon::get_internal_single(), blender::GVVectorArray_For_GVectorArray::get_vector_element_impl(), blender::GVVectorArray_For_SingleGSpan::get_vector_element_impl(), blender::GVArrayImpl_For_GSpan::set_by_copy(), and blender::tests::TEST().
|
inline |
Similar to copy_assign_indices, but does not leave gaps in the #dst array.
Definition at line 418 of file BLI_cpp_type.hh.
References BLI_assert, mask(), and src.
Referenced by blender::GVArrayImpl_For_GSpan::materialize_compressed().
|
inline |
Definition at line 406 of file BLI_cpp_type.hh.
References BLI_assert, mask(), and src.
Referenced by copy_assign_n(), blender::GVArrayImpl_For_GSpan::materialize(), and blender::tests::TEST().
Definition at line 401 of file BLI_cpp_type.hh.
References copy_assign_indices().
Referenced by blender::GMutableSpan::copy_from(), blender::nodes::node_geo_join_geometry_cc::fill_new_attribute(), blender::bke::CurvesGeometry::interpolate_to_evaluated(), blender::GVMutableArrayImpl::set_all(), and blender::tests::TEST().
Copy an instance of this type from src to dst.
The memory pointed to by dst should be uninitialized.
C++ equivalent: new (dst) T(src);
Definition at line 435 of file BLI_cpp_type.hh.
References BLI_assert, pointer_can_point_to_instance(), and src.
Referenced by blender::GVectorArray::append(), blender::bke::DataTypeConversions::convert_to_uninitialized(), blender::modifiers::geometry_nodes::GeometryNodesEvaluator::convert_value(), blender::fn::FieldConstant::FieldConstant(), blender::GVArrayImpl_For_SingleValueRef::get_to_uninitialized(), blender::GVArrayImpl_For_GSpan::get_to_uninitialized(), blender::GVArrayImpl_For_SingleValue::GVArrayImpl_For_SingleValue(), blender::GVArrayImpl_For_SmallTrivialSingleValue< BufferSize >::GVArrayImpl_For_SmallTrivialSingleValue(), blender::nodes::geometry_nodes_eval_log::LocalGeoLogger::log_value_for_sockets(), blender::GVMutableArrayImpl::set_by_copy(), and blender::tests::TEST().
|
inline |
Similar to copy_construct_indices, but does not leave gaps in the #dst array.
Definition at line 461 of file BLI_cpp_type.hh.
References BLI_assert, mask(), and src.
Referenced by blender::GVArrayImpl_For_GSpan::materialize_compressed_to_uninitialized().
|
inline |
Definition at line 449 of file BLI_cpp_type.hh.
References BLI_assert, mask(), and src.
Referenced by copy_construct_n(), blender::GVArrayImpl_For_GSpan::materialize_to_uninitialized(), and blender::tests::TEST().
Definition at line 444 of file BLI_cpp_type.hh.
References copy_construct_indices().
Referenced by blender::tests::TEST().
Call the default constructor at the given memory location. The memory should be uninitialized before this method is called. For some trivial types (like int), this method does nothing.
C++ equivalent: new (ptr) T;
Definition at line 316 of file BLI_cpp_type.hh.
References BLI_assert, pointer_can_point_to_instance(), and ptr.
Referenced by blender::modifiers::geometry_nodes::GeometryNodesEvaluator::convert_value(), blender::modifiers::geometry_nodes::GeometryNodesEvaluator::execute_multi_function_node__value(), blender::GVArrayCommon::get_internal_single_to_uninitialized(), blender::GVArray_For_GVVectorArrayIndex::get_to_uninitialized(), and blender::tests::TEST().
Definition at line 328 of file BLI_cpp_type.hh.
References BLI_assert, mask(), and ptr.
Referenced by default_construct_n(), and blender::tests::TEST().
Definition at line 323 of file BLI_cpp_type.hh.
References default_construct_indices().
Referenced by blender::GMutableVArraySpan::GMutableVArraySpan(), blender::GArray< Allocator >::reinitialize(), and blender::tests::TEST().
|
inline |
Get a pointer to a constant value of this type. The specific value depends on the type. It is usually a zero-initialized or default constructed value.
Definition at line 690 of file BLI_cpp_type.hh.
Referenced by CPPType(), blender::GVArray::ForSingleDefault(), and print_or_default().
Call the destructor on the given instance of this type. The pointer must not be nullptr.
For some trivial types, this does nothing.
C++ equivalent: ptr->~T();
Definition at line 368 of file BLI_cpp_type.hh.
References BLI_assert, pointer_can_point_to_instance(), and ptr.
Referenced by blender::fn::tests::GenericAppendFunction::call(), blender::GMutablePointer::destruct(), blender::modifiers::geometry_nodes::GeometryNodesEvaluator::destruct_input_value_if_exists(), blender::modifiers::geometry_nodes::GeometryNodesEvaluator::destruct_node_state(), blender::modifiers::geometry_nodes::GeometryNodesEvaluator::execute_multi_function_node__value(), blender::GVectorArray::extend(), blender::GVArrayImpl::get(), blender::GVMutableArrayImpl::set_by_copy(), blender::GVMutableArrayImpl::set_by_relocate(), blender::tests::TEST(), blender::fn::FieldConstant::~FieldConstant(), and blender::GVArrayImpl_For_SingleValue::~GVArrayImpl_For_SingleValue().
Definition at line 380 of file BLI_cpp_type.hh.
References BLI_assert, mask(), and ptr.
Referenced by destruct_n(), and blender::tests::TEST().
Definition at line 375 of file BLI_cpp_type.hh.
References destruct_indices().
Referenced by blender::GVectorArray::clear(), blender::GArray< Allocator >::reinitialize(), blender::tests::TEST(), blender::GArray< Allocator >::~GArray(), blender::GMutableVArraySpan::~GMutableVArraySpan(), blender::GVArraySpan::~GVArraySpan(), and blender::GVectorArray::~GVectorArray().
|
inline |
Definition at line 603 of file BLI_cpp_type.hh.
References BLI_assert, and mask().
Referenced by fill_assign_n(), blender::GVArrayImpl_For_SingleValueRef::materialize(), and blender::tests::TEST().
Copy the given value to the first n elements in an array starting at dst.
Other instances of the same type should live in the array before this method is called.
Definition at line 598 of file BLI_cpp_type.hh.
References fill_assign_indices().
Referenced by blender::GVMutableArray::fill(), blender::GVArrayImpl_For_SingleValueRef::materialize_compressed(), and blender::tests::TEST().
|
inline |
Definition at line 621 of file BLI_cpp_type.hh.
References BLI_assert, and mask().
Referenced by blender::fn::CustomMF_GenericConstant::call(), fill_construct_n(), blender::GVArrayImpl_For_SingleValueRef::materialize_to_uninitialized(), and blender::tests::TEST().
Copy the given value to the first n elements in an array starting at dst.
The array should be uninitialized before this method is called.
Definition at line 616 of file BLI_cpp_type.hh.
References fill_construct_indices().
Referenced by blender::GVArrayImpl_For_SingleValueRef::materialize_compressed_to_uninitialized(), and blender::tests::TEST().
|
inlinestatic |
Get the CPPType
that corresponds to a specific static type. This only works for types that actually implement the template specialization using BLI_CPP_TYPE_MAKE
.
Definition at line 173 of file BLI_cpp_type.hh.
References type.
|
static |
|
inline |
Returns true, when the type has the following functions:
Definition at line 290 of file BLI_cpp_type.hh.
|
inline |
Definition at line 695 of file BLI_cpp_type.hh.
References blender::get_default_hash().
Referenced by hash_or_fallback().
Definition at line 672 of file BLI_cpp_type.hh.
References BLI_assert, and pointer_can_point_to_instance().
|
inline |
Definition at line 678 of file BLI_cpp_type.hh.
References hash(), and is_hashable().
Referenced by blender::fn::CustomMF_GenericConstant::hash().
|
inline |
Definition at line 705 of file BLI_cpp_type.hh.
Referenced by blender::ed::spreadsheet::apply_row_filter(), blender::GVectorArray_TypedMutableRef< T >::GVectorArray_TypedMutableRef(), blender::GMutablePointer::is_type(), blender::GPointer::is_type(), blender::tests::TEST(), blender::GVArrayCommon::try_assign_VArray(), blender::GVMutableArray::try_assign_VMutableArray(), blender::GSpan::typed(), blender::GMutableSpan::typed(), and blender::GVArray::typed().
|
inline |
Definition at line 256 of file BLI_cpp_type.hh.
|
inline |
Definition at line 241 of file BLI_cpp_type.hh.
|
inline |
Definition at line 236 of file BLI_cpp_type.hh.
|
inline |
Definition at line 251 of file BLI_cpp_type.hh.
Definition at line 657 of file BLI_cpp_type.hh.
References Freestyle::a, usdtokens::b(), BLI_assert, and pointer_can_point_to_instance().
Referenced by blender::fn::CustomMF_GenericConstant::equals(), and is_equal_or_false().
Definition at line 664 of file BLI_cpp_type.hh.
References usdtokens::b(), is_equal(), and is_equality_comparable().
|
inline |
Definition at line 271 of file BLI_cpp_type.hh.
Referenced by is_equal_or_false().
|
inline |
Definition at line 276 of file BLI_cpp_type.hh.
Referenced by hash_or_fallback().
|
inline |
Definition at line 261 of file BLI_cpp_type.hh.
|
inline |
Definition at line 246 of file BLI_cpp_type.hh.
|
inline |
Definition at line 266 of file BLI_cpp_type.hh.
Referenced by print_or_default().
|
inline |
When true, the value is like a normal C type, it can be copied around with #memcpy and does not have to be destructed.
C++ equivalent: std::is_trivial_v<T>;
Definition at line 231 of file BLI_cpp_type.hh.
Referenced by blender::GVArray::GVArray(), and blender::GVArrayImpl_For_SmallTrivialSingleValue< BufferSize >::GVArrayImpl_For_SmallTrivialSingleValue().
|
inline |
When true, the destructor does not have to be called on this type. This can sometimes be used for optimization purposes.
C++ equivalent: std::is_trivially_destructible_v<T>;
Definition at line 219 of file BLI_cpp_type.hh.
Referenced by blender::GVectorArray::~GVectorArray().
Move an instance of this type from src to dst.
The memory pointed to by dst should be initialized.
C++ equivalent: dst = std::move(src);
Definition at line 478 of file BLI_cpp_type.hh.
References BLI_assert, pointer_can_point_to_instance(), and src.
Definition at line 491 of file BLI_cpp_type.hh.
References BLI_assert, mask(), and src.
Referenced by move_assign_n().
Definition at line 486 of file BLI_cpp_type.hh.
References move_assign_indices().
Move an instance of this type from src to dst.
The memory pointed to by dst should be uninitialized.
C++ equivalent: new (dst) T(std::move(src));
Definition at line 508 of file BLI_cpp_type.hh.
References BLI_assert, pointer_can_point_to_instance(), and src.
Referenced by blender::GVArrayImpl_For_GSpan::set_by_move().
|
inline |
Definition at line 522 of file BLI_cpp_type.hh.
References BLI_assert, mask(), and src.
Referenced by move_construct_n().
Definition at line 517 of file BLI_cpp_type.hh.
References move_construct_indices().
|
inline |
Returns the name of the type for debugging purposes. This name should not be used as identifier.
Definition at line 185 of file BLI_cpp_type.hh.
Referenced by blender::bke::add_implicit_conversion(), and blender::fn::MFDataType::to_string().
Definition at line 303 of file BLI_cpp_type.hh.
References pointer_has_valid_alignment(), and ptr.
Referenced by copy_assign(), copy_construct(), default_construct(), destruct(), hash(), is_equal(), move_assign(), move_construct(), print(), relocate_assign(), relocate_construct(), and value_initialize().
Returns true, when the given pointer fulfills the alignment requirement of this type.
Definition at line 298 of file BLI_cpp_type.hh.
References ptr.
Referenced by blender::GMutableSpan::GMutableSpan(), blender::GSpan::GSpan(), and pointer_can_point_to_instance().
Definition at line 634 of file BLI_cpp_type.hh.
References BLI_assert, and pointer_can_point_to_instance().
Referenced by print_or_default(), and to_string().
|
inline |
Definition at line 647 of file BLI_cpp_type.hh.
References default_value(), is_printable(), and print().
Relocates an instance of this type from src to dst. src will point to uninitialized memory afterwards.
C++ equivalent: dst = std::move(src); src->~T();
Definition at line 539 of file BLI_cpp_type.hh.
References BLI_assert, pointer_can_point_to_instance(), and src.
Referenced by blender::GMutablePointer::relocate_out(), blender::GVArrayImpl_For_GSpan::set_by_relocate(), and blender::tests::TEST().
|
inline |
Definition at line 553 of file BLI_cpp_type.hh.
References BLI_assert, mask(), and src.
Referenced by relocate_assign_n(), and blender::tests::TEST().
Definition at line 548 of file BLI_cpp_type.hh.
References relocate_assign_indices().
Referenced by blender::tests::TEST().
Relocates an instance of this type from src to dst. src will point to uninitialized memory afterwards.
C++ equivalent: new (dst) T(std::move(src)) src->~T();
Definition at line 570 of file BLI_cpp_type.hh.
References BLI_assert, pointer_can_point_to_instance(), and src.
Referenced by blender::tests::TEST().
|
inline |
Definition at line 584 of file BLI_cpp_type.hh.
References BLI_assert, mask(), and src.
Referenced by relocate_construct_n(), and blender::tests::TEST().
Definition at line 579 of file BLI_cpp_type.hh.
References relocate_construct_indices().
Referenced by blender::tests::TEST().
|
inline |
Required memory in bytes for an instance of this type.
C++ equivalent: sizeof(T);
Definition at line 196 of file BLI_cpp_type.hh.
Referenced by blender::GVArrayImpl_For_SlicedGVArray::common_info(), compute_geometry(), ED_geometry_attribute_convert(), blender::modifiers::geometry_nodes::GeometryNodesEvaluator::execute_multi_function_node__field(), blender::modifiers::geometry_nodes::GeometryNodesEvaluator::execute_multi_function_node__value(), blender::fn::FieldConstant::FieldConstant(), blender::modifiers::geometry_nodes::GeometryNodesEvaluator::forward_output(), blender::ed::geometry::geometry_attribute_convert_exec(), blender::GVMutableArray::get_internal_span(), blender::modifiers::geometry_nodes::GeometryNodesEvaluator::get_value_from_socket(), blender::GMutableVArraySpan::GMutableVArraySpan(), blender::GVArray::GVArray(), blender::GVArrayImpl_For_SingleValue::GVArrayImpl_For_SingleValue(), blender::GVArrayImpl_For_SmallTrivialSingleValue< BufferSize >::GVArrayImpl_For_SmallTrivialSingleValue(), blender::GVArraySpan::GVArraySpan(), blender::nodes::geometry_nodes_eval_log::LocalGeoLogger::log_value_for_sockets(), blender::GVArrayImpl::materialize(), blender::GVArrayImpl::materialize_compressed(), blender::GVArrayImpl::materialize_compressed_to_uninitialized(), blender::GVArrayImpl::materialize_to_uninitialized(), blender::GArray< Allocator >::operator[](), blender::GSpan::operator[](), blender::GMutableSpan::operator[](), blender::GVMutableArrayImpl::set_all(), blender::GSpan::slice(), blender::GMutableSpan::slice(), and blender::tests::TEST().
|
inline |
Convert a CPPType that is only known at run-time, to a static type that is known at compile-time. This allows the compiler to optimize a function for specific types, while all other types can still use a generic fallback function.
Types | The types that code should be generated for. |
fn | The function object to call. This is expected to have a templated operator() and a non-templated operator() . The templated version will be called if the current CPPType matches any of the given types. Otherwise, the non-templated function is called. |
Definition at line 720 of file BLI_cpp_type.hh.
References blender::Map< Key, Value, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::add_new(), callback, blender::Map< Key, Value, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::lookup_default(), and void.
Referenced by to_static_type_tag().
|
inline |
Similar to to_static_type but is easier to use with a lambda function. The function is expected to take a single auto type_tag
parameter. To extract the static type, use: using T = typename decltype(type_tag)type;
If the current CPPType is not in #Types, the type tag is void
.
Definition at line 775 of file BLI_cpp_type.hh.
References to_static_type().
Referenced by blender::attribute_math::convert_to_static_type().
|
inline |
Definition at line 640 of file BLI_cpp_type.hh.
References print().
Same as default_construct, but does zero initialization for trivial types.
C++ equivalent: new (ptr) T();
Definition at line 341 of file BLI_cpp_type.hh.
References BLI_assert, pointer_can_point_to_instance(), and ptr.
Referenced by blender::tests::TEST().
Definition at line 353 of file BLI_cpp_type.hh.
References BLI_assert, mask(), and ptr.
Referenced by blender::tests::TEST(), and value_initialize_n().
Definition at line 348 of file BLI_cpp_type.hh.
References value_initialize_indices().
Referenced by blender::tests::TEST().
Definition at line 163 of file BLI_cpp_type.hh.
Two types only compare equal when their pointer is equal. No two instances of CPPType for the same C++ type should be created.
Definition at line 158 of file BLI_cpp_type.hh.
Definition at line 700 of file BLI_cpp_type.hh.