Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions src/Store/Store.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,18 @@ class Store{
else return false;

}

template<typename T> bool Get(std::string name, T* &out){
if(m_variables.count(name)>0){
std::stringstream stream(m_variables[name]);
intptr_t tmp;
stream>>tmp;
out = reinterpret_cast<T*>(tmp);
return true;
}

else return false;
}

/**
Templated setter function to assign vairables in the Store.
Expand All @@ -66,6 +78,13 @@ class Store{
stream<<in;
m_variables[name]=stream.str();
}

template<typename T> void Set(std::string name,T* in){
intptr_t ptr_cast = reinterpret_cast<intptr_t>(in);
std::stringstream stream;
stream<<ptr_cast;
m_variables[name]=stream.str();
}

/**
Returns string pointer to Store element.
Expand Down