13 identifiers_.append(std::move(identifier));
17 : identifiers_(std::move(identifiers))
27bool SocketInterfaceKey::matches(
const SocketInterfaceKey &other)
const
29 for (
const std::string &identifier : other.identifiers_) {
30 if (identifiers_.contains(identifier)) {
37Bundle::Bundle() =
default;
41 for (StoredItem &item : items_) {
42 item.type->geometry_nodes_cpp_type->destruct(item.value);
44 for (
void *buffer : buffers_) {
49Bundle::Bundle(
const Bundle &other)
51 for (
const StoredItem &item : other.items_) {
52 this->add_new(item.key, *item.type, item.value);
56Bundle::Bundle(Bundle &&other) noexcept
57 : items_(std::move(other.items_)), buffers_(std::move(other.buffers_))
61Bundle &Bundle::operator=(
const Bundle &other)
67 new (
this) Bundle(other);
71Bundle &Bundle::operator=(Bundle &&other)
noexcept
77 new (
this) Bundle(std::move(other));
81void Bundle::add_new(SocketInterfaceKey key,
const bke::bNodeSocketType &type,
const void *value)
85 const CPPType &cpp_type = *type.geometry_nodes_cpp_type;
88 items_.append(StoredItem{std::move(key), &type, buffer});
89 buffers_.append(buffer);
99 this->
add_new(key, type, value);
108 this->
add_new(std::move(key), type, value);
114 for (
const StoredItem &item : items_) {
115 if (item.key.matches(key)) {
116 return Item{item.type, item.value};
122bool Bundle::remove(
const SocketInterfaceKey &key)
124 const int removed_num = items_.remove_if([&key](StoredItem &item) {
125 if (item.key.matches(key)) {
126 item.type->geometry_nodes_cpp_type->destruct(item.value);
131 return removed_num >= 1;
134bool Bundle::contains(
const SocketInterfaceKey &key)
const
136 for (
const StoredItem &item : items_) {
137 if (item.key.matches(key)) {
144void Bundle::delete_self()
void copy_construct(const void *src, void *dst) const
bool add(const SocketInterfaceKey &key, const bke::bNodeSocketType &type, const void *value)
void add_new(SocketInterfaceKey key, const bke::bNodeSocketType &type, const void *value)
std::optional< Item > lookup(const SocketInterfaceKey &key) const
bool contains(const SocketInterfaceKey &key) const
SocketInterfaceKey(Vector< std::string > identifiers)
void * MEM_mallocN_aligned(size_t len, size_t alignment, const char *str)
void MEM_freeN(void *vmemh)