2
3
4
5
9#include "Core/Reflect/TypeReflect.h"
16
17
24
25
26 if(object_.find(name) != object_.end())
29 ss <<
"runtime_memory_block:: add failed: already has the element: " << name;
31 SPICES_CORE_WARN(ss.str());
36
37
38 object_[name] = bytes_;
41
42
43 bytes_ += Spices::StrType2Size(type);
49
50
54
55
56 begin_ = malloc(bytes_);
62
63
64 for(
auto& pair : object_)
67
68
69 void* it =
static_cast<
char*>(begin_) + pair.second;
72
73
74
75
76 if(fn(pair.first, it))
break;
83
84
85 if (object_.find(name) == object_.end())
return UINT32_MAX;
92
93
94 if (object_.find(name) != object_.end())
return true;
bool has_value(const std::string &name)
Determine is item inside this container.
void for_each(const std::function< bool(const std::string &name, void *pt)> &fn) const
Iter the object_ and call explain_element() to filling data.
void build()
Malloc a memory to begin_.
void add_element(const std::string &name, const std::string &type)
Add a element to object_, means a memory block will be occupied with given param type.
size_t item_location(const std::string &name)
Get item location in blocks.
virtual ~runtime_memory_block()
Destructor Function.
void * begin_
The begin pointer of the continue memory block handled.
The container is wrapper of a continue memory block. Used in Material::BuildMaterial(),...