45 std::variant<BundleItemSocketValue, BundleItemInternalValue>
value;
54 template<
typename T> std::optional<T>
as()
const;
163 std::optional<StringRef>
type()
const;
169 BundleItemMap::ItemIterator
items()
const;
170 BundleItemMap::MutableItemIterator
items();
207 if (
const std::optional<bke::SocketValueVariant>
value = this->
as_socket_value(dst_socket_type))
209 return *
value->get_if<
T>();
216 return const_cast<T *
>(std::as_const(*this).as_pointer<
T>());
234 const std::optional<eNodeSocketDatatype> socket_type =
239 return socket_type_info;
242 const std::optional<eNodeSocketDatatype> socket_type =
253 if constexpr (is_ImplicitSharingPtr_strong_v<T>) {
254 if constexpr (std::is_base_of_v<BundleItemInternalValueMixin, typename T::element_type>) {
264 using SharingInfoT =
typename T::element_type;
265 const auto *internal_value = std::get_if<BundleItemInternalValue>(&this->
value);
266 if (!internal_value) {
270 const SharingInfoT *converted_value =
dynamic_cast<const SharingInfoT *
>(sharing_info);
271 if (!converted_value) {
277 else if constexpr (std::is_same_v<T, bke::SocketValueVariant>) {
281 return socket_value->value;
285 else if constexpr (std::is_same_v<T, GListPtr>) {
309 return item->
as<
T>();
354 return item->
as<
T>();
363 return item->
as<
T>();
375 base_type = &
list->cpp_type();
378 base_type = value.
get().
type();
380 const std::optional<eNodeSocketDatatype> socket_type =
388 using DecayT = std::decay_t<T>;
389 if constexpr (std::is_same_v<DecayT, BundleItemValue>) {
390 fn(std::forward<T>(value));
392 else if constexpr (std::is_same_v<DecayT, BundleItemSocketValue>) {
395 else if constexpr (std::is_same_v<DecayT, BundleItemInternalValue>) {
398 else if constexpr (std::is_same_v<DecayT, bke::SocketValueVariant>) {
425 [&]<
typename U>(
U &&item_value) { this->
add(key, std::forward<U>(item_value)); });
433 this->
add_new(key, std::forward<U>(item_value));
442 this->
add_path(path, std::forward<U>(item_value));
475 return items_.items();
480 return items_.items();
485 return items_.is_empty();
490 return items_.size();
493inline BundleKey::BundleKey(
const UString key) : key_(key) {}
503 return BundleKey(key);
512 return BundleKey(
UString(key));
#define BLI_assert_unreachable()
static const CPPType & get()
const CPPType * type() const
StringRefNull ref() const
static SocketValueVariant from(T &&value)
static std::optional< BundleKey > from_ustr(UString key)
static std::optional< BundleKey > from_str(StringRef key)
virtual StringRefNull type_name() const =0
bool operator==(const BundleKey &other) const =default
static bool is_valid_key(StringRef key)
static constexpr StringRefNull forbidden_key_chars
static std::optional< BundleKey > from_ustr(UString key)
static std::optional< BundleKey > from_str(StringRef key)
void ensure_owns_direct_data()
void delete_self() override
void add_path_new(StringRef path, const BundleItemValue &value)
static BundleKey type_item_name
void merge_override(const Bundle &other)
Vector< std::string > gather_paths(FunctionRef< bool(const Bundle &bundle)> fn) const
T * lookup_ptr(BundleKey key)
void count_memory(MemoryCounter &memory) const
bool add(BundleKey key, const BundleItemValue &value)
static std::string combine_path(Span< StringRef > path)
static bool is_valid_path(StringRef path)
bool contains(BundleKey key) const
bool contains_path(StringRef path) const
static BundlePtr create()
const T * lookup_path_ptr(StringRef path) const
std::optional< StringRef > type() const
BundleItemValue * lookup_path_for_write(Span< BundleKey > path)
void add_override(BundleKey key, const BundleItemValue &value)
void add_path_override(StringRef path, const BundleItemValue &value)
Map< BundleKey, BundleItemValue > BundleItemMap
bool remove_path(StringRef path)
bool remove(BundleKey key)
void merge(const Bundle &other)
const BundleItemValue * lookup_path(Span< BundleKey > path) const
bool owns_direct_data() const
const BundleItemValue * lookup(BundleKey key) const
static std::optional< Vector< BundleKey > > split_path(StringRef path)
Bundle & ensure_nested_bundle(StringRef path)
bool add_path(StringRef path, const BundleItemValue &value)
void add_new(BundleKey key, const BundleItemValue &value)
T * lookup_path_for_write_ptr(StringRef path)
BundleItemMap::ItemIterator items() const
std::optional< eNodeSocketDatatype > geo_nodes_base_cpp_type_to_socket_type(const CPPType &type)
bNodeSocketType * node_socket_type_find_static(int type, int subtype=0)
constexpr bool is_field_v
const bke::bNodeSocketType * socket_type_info_by_static_type()
std::string_view format_as(const BundleKey key)
constexpr bool is_valid_internal_bundle_item_type()
Vector< std::string > gather_bundle_paths_by_bundle_type(const Bundle &bundle, const FunctionRef< bool(StringRef type)> type_filter_fn)
void to_stored_type(T &&value, Fn &&fn)
eNodeSocketDatatype socket_type_for_value_variant(const bke::SocketValueVariant &value)
Vector< std::string > gather_bundle_paths_by_data_type(const Bundle &bundle, const eNodeSocketDatatype data_type)
BundlePathsGatherFilterResult
void foreach_nested_bundle_item(const Bundle &bundle, const FunctionRef< void(Span< BundleKey >, const BundleItemValue &value)> fn)
ImplicitSharingPtr< Bundle > BundlePtr
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
unsigned __int64 uint64_t
constexpr uint64_t get_default_hash(const T &v, const Args &...args)
ImplicitSharingPtr< BundleItemInternalValueMixin > value
const bke::bNodeSocketType * type
bke::SocketValueVariant value
std::variant< BundleItemSocketValue, BundleItemInternalValue > value
std::optional< T > as() const
std::optional< bke::SocketValueVariant > as_socket_value(const bke::bNodeSocketType &dst_socket_type) const