SpiecsEngine
 
Loading...
Searching...
No Matches

◆ add_element()

void scl::runtime_memory_block::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.

Parameters
[in]nameThe name of parameter.
[in]typeThe type of parameter.

Only allow add to object_ with parameter that has not added.

Recording current parameter's position to object_.

Add to bytes_ with parameter type.

Only allow add to object_ with parameter that has not added.

Recording current parameter's position to object_.

Add to bytes_ with parameter type.

Definition at line 21 of file RuntimeMemoryBlock.cpp.

22 {
26 if(object_.find(name) != object_.end())
27 {
28 std::stringstream ss;
29 ss << "runtime_memory_block:: add failed: already has the element: " << name;
30
31 SPICES_CORE_WARN(ss.str());
32 return;
33 }
34
38 object_[name] = bytes_;
39
44 }
size_t bytes_
The bytes of the continue memory block handled.
std::unordered_map< std::string, size_t > object_
The data information of the continue memory block handled. Data: parameter name - parameter position ...
static size_t StrType2Size(const std::string &type)
Definition TypeReflect.h:6

Referenced by SpicesTest::TEST_F(), and SpicesTest::TEST_F().