Changeset View
Changeset View
Standalone View
Standalone View
source/blender/functions/FN_generic_virtual_array.hh
| Show First 20 Lines • Show All 150 Lines • ▼ Show 20 Lines | public: | ||||
| bool is_span() const; | bool is_span() const; | ||||
| GSpan get_internal_span() const; | GSpan get_internal_span() const; | ||||
| bool is_single() const; | bool is_single() const; | ||||
| void get_internal_single(void *r_value) const; | void get_internal_single(void *r_value) const; | ||||
| void get_internal_single_to_uninitialized(void *r_value) const; | void get_internal_single_to_uninitialized(void *r_value) const; | ||||
| void get(const int64_t index, void *r_value) const; | void get(const int64_t index, void *r_value) const; | ||||
| template<typename T> T get(const int64_t index) const; | |||||
| void get_to_uninitialized(const int64_t index, void *r_value) const; | void get_to_uninitialized(const int64_t index, void *r_value) const; | ||||
JacquesLucke: The comment makes it sound like you pass in the destination that the value is copied to. | |||||
| }; | }; | ||||
| /** Generic version of #VArray. */ | /** Generic version of #VArray. */ | ||||
| class GVArray : public GVArrayCommon { | class GVArray : public GVArrayCommon { | ||||
| private: | private: | ||||
| friend GVMutableArray; | friend GVMutableArray; | ||||
| public: | public: | ||||
| ▲ Show 20 Lines • Show All 497 Lines • ▼ Show 20 Lines | |||||
| * expected to point to initialized memory. */ | * expected to point to initialized memory. */ | ||||
| inline void GVArrayCommon::get(const int64_t index, void *r_value) const | inline void GVArrayCommon::get(const int64_t index, void *r_value) const | ||||
| { | { | ||||
| BLI_assert(index >= 0); | BLI_assert(index >= 0); | ||||
| BLI_assert(index < this->size()); | BLI_assert(index < this->size()); | ||||
| impl_->get(index, r_value); | impl_->get(index, r_value); | ||||
| } | } | ||||
| /* Copies the value at the given index into the result. Generally a typed virtual array should be | |||||
| * used instead, but sometimes when only a few indices are needed, this is simpler. */ | |||||
| template<typename T> inline T GVArrayCommon::get(const int64_t index) const | |||||
| { | |||||
| BLI_assert(index >= 0); | |||||
| BLI_assert(index < this->size()); | |||||
| BLI_assert(this->type().is<T>()); | |||||
| T value{}; | |||||
| impl_->get(index, &value); | |||||
| return value; | |||||
| } | |||||
| /* Same as `get`, but `r_value` is expected to point to uninitialized memory. */ | /* Same as `get`, but `r_value` is expected to point to uninitialized memory. */ | ||||
| inline void GVArrayCommon::get_to_uninitialized(const int64_t index, void *r_value) const | inline void GVArrayCommon::get_to_uninitialized(const int64_t index, void *r_value) const | ||||
| { | { | ||||
| BLI_assert(index >= 0); | BLI_assert(index >= 0); | ||||
| BLI_assert(index < this->size()); | BLI_assert(index < this->size()); | ||||
| impl_->get_to_uninitialized(index, r_value); | impl_->get_to_uninitialized(index, r_value); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 177 Lines • Show Last 20 Lines | |||||
The comment makes it sound like you pass in the destination that the value is copied to.