18 #ifndef __H__OCULAR_CORE_EXPOSABLE__H__
19 #define __H__OCULAR_CORE_EXPOSABLE__H__
21 #include "ExposedVariable.hpp"
22 #include "Buildable.hpp"
24 #include "Utilities/Types.hpp"
25 #include "Utilities/StringUtils.hpp"
28 #include <unordered_map>
105 auto find = m_ExposedVariables.find(name);
107 if(find != m_ExposedVariables.end())
109 if(String::IsEqual(OCULAR_TYPE(T), find->second.type))
111 value = *(T*)(find->second.ptr);
133 auto find = m_ExposedVariables.find(name);
135 if(find != m_ExposedVariables.end())
137 if(String::IsEqual(OCULAR_TYPE(T), find->second.type))
139 *(find->second.ptr) = value;
172 void exposeVariable(std::string
const& name, std::string
const& type,
bool isPointer,
bool isExposed,
void* data);
174 std::unordered_map<std::string, ExposedVariable> m_ExposedVariables;
182 #define OCULAR_EXPOSE(X) exposeVariable(std::string(#X), Ocular::Utils::TypeName<decltype(X)>::name, std::is_pointer<decltype(X)>::value, std::is_base_of<Ocular::Core::Exposable, decltype(X)>::value, &X)
bool setVariableValue(std::string const &name, T const &value)
Definition: Exposable.hpp:130
Definition: Exposable.hpp:67
Note: Once this library is made dynamic, this will no longer be needed.
Definition: Common.hpp:70
Definition: Buildable.hpp:54
void exposeVariable(std::string const &name, std::string const &type, bool isPointer, bool isExposed, void *data)
Definition: Exposable.cpp:67
bool getVariable(std::string const &name, ExposedVariable &var)
Definition: Exposable.cpp:44
void getAllExposedNames(std::vector< std::string > &names) const
Definition: Exposable.cpp:33
Definition: ExposedVariable.hpp:44
virtual void onVariableModified(std::string const &varName)
Definition: Exposable.cpp:58
bool getVariableValue(std::string const &name, T &var)
Definition: Exposable.hpp:102