SpiecsEngine
 
Loading...
Searching...
No Matches

◆ explain_element()

template<typename T >
void scl::runtime_memory_block::explain_element ( const std::string & name,
const T & value )

Fill in a memory with given data.

Template Parameters
TThe type of parameter.
Parameters
[in]nameThe name of parameter.
[in]valueThe value of parameter.

Only allow explain the memory block with parameter that already added.

Offest the begin_ to correct position.

Writing the value of parameter.

Definition at line 119 of file RuntimeMemoryBlock.h.

120 {
124 if(object_.find(name) == object_.end())
125 {
126 std::stringstream ss;
127 ss << "runtime_memory_block:: explain failed: without the element: " << name;
128
129 throw std::runtime_error(ss.str());
130 }
131
135 void* mem = static_cast<char*>(begin_) + object_[name];
136
140 *static_cast<T*>(mem) = value;
141 }
std::unordered_map< std::string, size_t > object_
The data information of the continue memory block handled. Data: parameter name - parameter position ...
void * begin_
The begin pointer of the continue memory block handled.