|
Blender V4.5
|
#include <BLI_cpp_type.hh>
Inherits blender::NonCopyable, and blender::NonMovable.
Public Member Functions | |
| template<typename T, CPPTypeFlags Flags> | |
| CPPType (TypeTag< T >, TypeForValue< CPPTypeFlags, Flags >, StringRef debug_name) | |
| virtual | ~CPPType ()=default |
| StringRefNull | name () const |
| bool | is_printable () const |
| bool | is_equality_comparable () const |
| bool | is_hashable () const |
| bool | pointer_has_valid_alignment (const void *ptr) const |
| bool | pointer_can_point_to_instance (const void *ptr) const |
| void | default_construct (void *ptr) const |
| void | default_construct_n (void *ptr, int64_t n) const |
| void | default_construct_indices (void *ptr, const IndexMask &mask) const |
| void | value_initialize (void *ptr) const |
| void | value_initialize_n (void *ptr, int64_t n) const |
| void | value_initialize_indices (void *ptr, const IndexMask &mask) const |
| void | destruct (void *ptr) const |
| void | destruct_n (void *ptr, int64_t n) const |
| void | destruct_indices (void *ptr, const IndexMask &mask) const |
| void | copy_assign (const void *src, void *dst) const |
| void | copy_assign_n (const void *src, void *dst, int64_t n) const |
| void | copy_assign_indices (const void *src, void *dst, const IndexMask &mask) const |
| void | copy_assign_compressed (const void *src, void *dst, const IndexMask &mask) const |
| void | copy_construct (const void *src, void *dst) const |
| void | copy_construct_n (const void *src, void *dst, int64_t n) const |
| void | copy_construct_indices (const void *src, void *dst, const IndexMask &mask) const |
| void | copy_construct_compressed (const void *src, void *dst, const IndexMask &mask) const |
| void | move_assign (void *src, void *dst) const |
| void | move_assign_n (void *src, void *dst, int64_t n) const |
| void | move_assign_indices (void *src, void *dst, const IndexMask &mask) const |
| void | move_construct (void *src, void *dst) const |
| void | move_construct_n (void *src, void *dst, int64_t n) const |
| void | move_construct_indices (void *src, void *dst, const IndexMask &mask) const |
| void | relocate_assign (void *src, void *dst) const |
| void | relocate_assign_n (void *src, void *dst, int64_t n) const |
| void | relocate_assign_indices (void *src, void *dst, const IndexMask &mask) const |
| void | relocate_construct (void *src, void *dst) const |
| void | relocate_construct_n (void *src, void *dst, int64_t n) const |
| void | relocate_construct_indices (void *src, void *dst, const IndexMask &mask) const |
| void | fill_assign_n (const void *value, void *dst, int64_t n) const |
| void | fill_assign_indices (const void *value, void *dst, const IndexMask &mask) const |
| void | fill_construct_n (const void *value, void *dst, int64_t n) const |
| void | fill_construct_indices (const void *value, void *dst, const IndexMask &mask) const |
| bool | can_exist_in_buffer (const int64_t buffer_size, const int64_t buffer_alignment) const |
| void | print (const void *value, std::stringstream &ss) const |
| std::string | to_string (const void *value) const |
| void | print_or_default (const void *value, std::stringstream &ss, StringRef default_value) const |
| bool | is_equal (const void *a, const void *b) const |
| bool | is_equal_or_false (const void *a, const void *b) const |
| uint64_t | hash (const void *value) const |
| uint64_t | hash () const |
| uint64_t | hash_or_fallback (const void *value, uint64_t fallback_hash) const |
| const void * | default_value () const |
| template<typename T> | |
| bool | is () const |
| template<typename... T> | |
| bool | is_any () const |
| template<typename... Types, typename Fn> | |
| void | to_static_type (const Fn &fn) const |
| template<typename... Types, typename Fn> | |
| void | to_static_type_tag (const Fn &fn) const |
Static Public Member Functions | |
| template<typename T> | |
| static const CPPType & | get () |
| template<typename T> | |
| static const CPPType & | get_impl () |
Public Attributes | |
| int64_t | size = 0 |
| int64_t | alignment = 0 |
| bool | is_trivial = false |
| bool | is_trivially_destructible = false |
| bool | has_special_member_functions = false |
| bool | is_default_constructible = false |
| bool | is_copy_constructible = false |
| bool | is_move_constructible = false |
| bool | is_destructible = false |
| bool | is_copy_assignable = false |
| bool | is_move_assignable = false |
| void(*)(void *) | destruct_fn () const |
Definition at line 100 of file BLI_cpp_type.hh.
| blender::CPPType::CPPType | ( | TypeTag< T > | , |
| TypeForValue< CPPTypeFlags, Flags > | , | ||
| StringRef | debug_name ) |
Definition at line 316 of file BLI_cpp_type_make.hh.
|
virtualdefault |
|
inline |
Definition at line 674 of file BLI_cpp_type.hh.
|
inline |
Copy an instance of this type from src to dst.
C++ equivalent: dst = src;
Definition at line 546 of file BLI_cpp_type.hh.
|
inline |
Similar to copy_assign_indices, but does not leave gaps in the #dst array.
Definition at line 561 of file BLI_cpp_type.hh.
|
inline |
Definition at line 556 of file BLI_cpp_type.hh.
|
inline |
Definition at line 551 of file BLI_cpp_type.hh.
|
inline |
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 568 of file BLI_cpp_type.hh.
|
inline |
Similar to copy_construct_indices, but does not leave gaps in the #dst array.
Definition at line 585 of file BLI_cpp_type.hh.
|
inline |
Definition at line 578 of file BLI_cpp_type.hh.
|
inline |
Definition at line 573 of file BLI_cpp_type.hh.
|
inline |
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 501 of file BLI_cpp_type.hh.
|
inline |
Definition at line 511 of file BLI_cpp_type.hh.
|
inline |
Definition at line 506 of file BLI_cpp_type.hh.
|
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 712 of file BLI_cpp_type.hh.
|
inline |
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 531 of file BLI_cpp_type.hh.
|
inline |
Definition at line 541 of file BLI_cpp_type.hh.
|
inline |
Definition at line 536 of file BLI_cpp_type.hh.
|
inline |
Definition at line 657 of file BLI_cpp_type.hh.
|
inline |
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 652 of file BLI_cpp_type.hh.
|
inline |
Definition at line 667 of file BLI_cpp_type.hh.
|
inline |
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 662 of file BLI_cpp_type.hh.
|
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 464 of file BLI_cpp_type.hh.
Referenced by blender::nodes::evaluate_closure_eagerly(), get_mutable_attribute(), get_span_attribute(), get_varray_attribute(), blender::ed::greasepencil::insert_selected_values(), and blender::ed::greasepencil::select_similar_by_value().
|
static |
|
inline |
Definition at line 717 of file BLI_cpp_type.hh.
|
inline |
Definition at line 699 of file BLI_cpp_type.hh.
|
inline |
Definition at line 704 of file BLI_cpp_type.hh.
|
inline |
Definition at line 727 of file BLI_cpp_type.hh.
|
inline |
Definition at line 732 of file BLI_cpp_type.hh.
|
inline |
Definition at line 686 of file BLI_cpp_type.hh.
|
inline |
Definition at line 691 of file BLI_cpp_type.hh.
|
inline |
Definition at line 481 of file BLI_cpp_type.hh.
|
inline |
Definition at line 486 of file BLI_cpp_type.hh.
|
inline |
Definition at line 476 of file BLI_cpp_type.hh.
|
inline |
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 592 of file BLI_cpp_type.hh.
|
inline |
Definition at line 602 of file BLI_cpp_type.hh.
|
inline |
Definition at line 597 of file BLI_cpp_type.hh.
|
inline |
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 607 of file BLI_cpp_type.hh.
|
inline |
Definition at line 617 of file BLI_cpp_type.hh.
|
inline |
Definition at line 612 of file BLI_cpp_type.hh.
|
inline |
Returns the name of the type for debugging purposes. This name should not be used as identifier.
Definition at line 471 of file BLI_cpp_type.hh.
|
inline |
Definition at line 496 of file BLI_cpp_type.hh.
|
inline |
Returns true, when the given pointer fulfills the alignment requirement of this type.
Definition at line 491 of file BLI_cpp_type.hh.
|
inline |
Definition at line 680 of file BLI_cpp_type.hh.
| void blender::CPPType::print_or_default | ( | const void * | value, |
| std::stringstream & | ss, | ||
| StringRef | default_value ) const |
Definition at line 22 of file cpp_type.cc.
|
inline |
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 622 of file BLI_cpp_type.hh.
|
inline |
Definition at line 632 of file BLI_cpp_type.hh.
|
inline |
Definition at line 627 of file BLI_cpp_type.hh.
|
inline |
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 637 of file BLI_cpp_type.hh.
|
inline |
Definition at line 647 of file BLI_cpp_type.hh.
|
inline |
Definition at line 642 of file BLI_cpp_type.hh.
|
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 737 of file BLI_cpp_type.hh.
|
inline |
Similar to to_static_type but is easier to use with a lambda function. The function is expected to take a single auto TypeTag parameter. To extract the static type, use: using T = typename decltype(TypeTag)::type;
If the current CPPType is not in #Types, the type tag is void.
Definition at line 428 of file BLI_cpp_type.hh.
| std::string blender::CPPType::to_string | ( | const void * | value | ) | const |
Definition at line 15 of file cpp_type.cc.
|
inline |
Same as default_construct, but does zero initialization for trivial types.
C++ equivalent: new (ptr) T();
Definition at line 516 of file BLI_cpp_type.hh.
|
inline |
Definition at line 526 of file BLI_cpp_type.hh.
|
inline |
Definition at line 521 of file BLI_cpp_type.hh.
Required memory alignment for an instance of this type.
C++ equivalent: alignof(T);
Definition at line 116 of file BLI_cpp_type.hh.
| void(*)(void *) blender::CPPType::destruct_fn() const |
Definition at line 722 of file BLI_cpp_type.hh.
Returns true, when the type has the following functions:
Definition at line 145 of file BLI_cpp_type.hh.
Definition at line 151 of file BLI_cpp_type.hh.
Definition at line 148 of file BLI_cpp_type.hh.
Definition at line 147 of file BLI_cpp_type.hh.
Definition at line 150 of file BLI_cpp_type.hh.
Definition at line 152 of file BLI_cpp_type.hh.
Definition at line 149 of file BLI_cpp_type.hh.
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 125 of file BLI_cpp_type.hh.
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 134 of file BLI_cpp_type.hh.
Required memory in bytes for an instance of this type.
C++ equivalent: sizeof(T);
Definition at line 108 of file BLI_cpp_type.hh.