Blender  V2.93
generic_virtual_array.cc
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  */
16 
18 
19 namespace blender::fn {
20 
22 {
23  for (const int64_t i : mask) {
24  void *elem_dst = POINTER_OFFSET(dst, type_->size() * i);
25  this->get_to_uninitialized(i, elem_dst);
26  }
27 }
28 
29 void GVArray::get_impl(const int64_t index, void *r_value) const
30 {
31  type_->destruct(r_value);
32  this->get_to_uninitialized_impl(index, r_value);
33 }
34 
36 {
37  return false;
38 }
39 
41 {
42  BLI_assert(false);
43  return GSpan(*type_);
44 }
45 
47 {
48  return false;
49 }
50 
51 void GVArray::get_single_impl(void *UNUSED(r_value)) const
52 {
53  BLI_assert(false);
54 }
55 
56 void GVArrayForGSpan::get_impl(const int64_t index, void *r_value) const
57 {
59 }
60 
61 void GVArrayForGSpan::get_to_uninitialized_impl(const int64_t index, void *r_value) const
62 {
64 }
65 
67 {
68  return true;
69 }
70 
72 {
73  return GSpan(*type_, data_, size_);
74 }
75 
76 void GVArrayForSingleValueRef::get_impl(const int64_t UNUSED(index), void *r_value) const
77 {
78  type_->copy_to_initialized(value_, r_value);
79 }
80 
82  void *r_value) const
83 {
84  type_->copy_to_uninitialized(value_, r_value);
85 }
86 
88 {
89  return size_ == 1;
90 }
91 
93 {
94  return GSpan{*type_, value_, 1};
95 }
96 
98 {
99  return true;
100 }
101 
103 {
104  type_->copy_to_initialized(value_, r_value);
105 }
106 
107 } // namespace blender::fn
#define BLI_assert(a)
Definition: BLI_assert.h:58
#define UNUSED(x)
#define POINTER_OFFSET(v, ofs)
int64_t size() const
Definition: FN_cpp_type.hh:280
void destruct(void *ptr) const
Definition: FN_cpp_type.hh:358
void copy_to_initialized(const void *src, void *dst) const
Definition: FN_cpp_type.hh:390
void copy_to_uninitialized(const void *src, void *dst) const
Definition: FN_cpp_type.hh:425
bool is_span_impl() const override
GSpan get_span_impl() const override
void get_to_uninitialized_impl(const int64_t index, void *r_value) const override
void get_impl(const int64_t index, void *r_value) const override
void get_impl(const int64_t index, void *r_value) const override
void get_to_uninitialized_impl(const int64_t index, void *r_value) const override
void get_single_impl(void *r_value) const override
virtual bool is_span_impl() const
virtual bool is_single_impl() const
virtual GSpan get_span_impl() const
void get_to_uninitialized(const int64_t index, void *r_value) const
virtual void get_impl(const int64_t index, void *r_value) const
void materialize_to_uninitialized(const IndexMask mask, void *dst) const
virtual void get_to_uninitialized_impl(const int64_t index, void *r_value) const =0
virtual void get_single_impl(void *UNUSED(r_value)) const
__int64 int64_t
Definition: stdint.h:92
ccl_device_inline float4 mask(const int4 &mask, const float4 &a)