SpiecsEngine
 
Loading...
Searching...
No Matches
scl::runtime_memory_block Class Reference

The container is wrapper of a continue memory block. Used in Material::BuildMaterial(), helps to update buffer. More...

#include <RuntimeMemoryBlock.h>

Public Member Functions

 runtime_memory_block ()=default
 Constructor Function.
 
virtual ~runtime_memory_block ()
 Destructor Function.
 
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.
 
void build ()
 Malloc a memory to begin_.
 
template<typename T >
void explain_element (const std::string &name, const T &value)
 Fill in a memory with given data.
 
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.
 
template<typename T >
T & get_value (const std::string &name)
 Get value that explained by name.
 
void * get_addr () const
 Get the begin_.
 
size_t get_bytes () const
 Get the bytes_.
 
size_t size () const
 Get the size of object_.
 
size_t item_location (const std::string &name)
 Get item location in blocks.
 
bool has_value (const std::string &name)
 Determine is item inside this container.
 

Private Attributes

void * begin_ = nullptr
 The begin pointer of the continue memory block handled.
 
size_t bytes_ = 0
 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 offset with begin_.
 

Detailed Description

The container is wrapper of a continue memory block. Used in Material::BuildMaterial(), helps to update buffer.

Definition at line 16 of file RuntimeMemoryBlock.h.


The documentation for this class was generated from the following files: