SpiecsEngine
 
Loading...
Searching...
No Matches

◆ get_value()

template<typename T >
T & scl::runtime_memory_block::get_value ( const std::string & name)

Get value that explained by name.

Template Parameters
Tthe type of parameter.
Parameters
[in]nameThe name of parameter.
Returns
Returns the value of parameter.

Only allow get value the memory block with parameter that already added.

Offest the begin_ to correct position.

Definition at line 144 of file RuntimeMemoryBlock.h.

145 {
149 if(object_.find(name) == object_.end())
150 {
151 std::stringstream ss;
152 ss << "runtime_memory_block:: get_value failed: without the element: " << name;
153
154 throw std::runtime_error(ss.str());
155 }
156
160 void* mem = static_cast<char*>(begin_) + object_[name];
161
162 return *static_cast<T*>(mem);
163 }
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.