3#include "../RTWrapper.h"
30 for (
auto it : this->objectMap.map)
58 this->stringMap.Set(
id, s);
63 return this->stringMap.Get(ids, defaultValue, found);
69 *result = this->
GetString(ids, defaultValue, &found);
75 this->boolMap.Set(
id, b);
81 Object* current = this->objectMap.Get({
id },
nullptr);
88 this->objectMap.Set(
id,
object);
93 this->objectMap.Remove(
id);
97 template<
typename T = Object>
98 inline T*
GetObject(
const std::vector<std::string>& ids, T* defaultValue =
nullptr,
bool* found =
nullptr)
const
100 return reinterpret_cast<T*
>(this->objectMap.Get(ids,
reinterpret_cast<Object*
>(defaultValue), found));
103 template<
typename T = Object>
104 inline bool GetObject(
const std::vector<std::string>& ids, T** result, T* defaultValue =
nullptr)
107 *result = this->GetObject<T>(ids, defaultValue, &found);
113 this->int1Map.Set(
id, x);
116 inline int32_t
GetInt(
const std::vector<std::string>& ids, int32_t defaultValue = 0,
bool* found =
nullptr)
const
118 return this->int1Map.Get(ids, defaultValue, found);
121 inline bool GetInt(
const std::vector<std::string>& ids, int32_t* result, int32_t defaultValue = 0)
124 *result = this->
GetInt(ids, defaultValue, &found);
130 this->float1Map.Set(
id, x);
133 inline float GetFloat(
const std::vector<std::string>& ids,
float defaultValue = 0.0f,
bool* found =
nullptr)
const
135 return this->float1Map.Get(ids, defaultValue, found);
138 inline bool GetFloat(
const std::vector<std::string>& ids,
float* result,
float defaultValue = 0.0f)
141 *result = this->
GetFloat(ids, defaultValue, &found);
147 this->int2Map.Set(
id, VisRTX::Vec2i(x, y));
150 inline VisRTX::Vec2i
GetVec2i(
const std::vector<std::string>& ids,
const VisRTX::Vec2i& defaultValue = VisRTX::Vec2i(),
bool* found =
nullptr)
const
152 return this->int2Map.Get(ids, defaultValue, found);
155 inline bool GetVec2i(
const std::vector<std::string>& ids, VisRTX::Vec2i* result,
const VisRTX::Vec2i& defaultValue = VisRTX::Vec2i())
158 *result = this->
GetVec2i(ids, defaultValue, &found);
164 this->float2Map.Set(
id, VisRTX::Vec2f(x, y));
167 inline VisRTX::Vec2f
GetVec2f(
const std::vector<std::string>& ids,
const VisRTX::Vec2f& defaultValue = VisRTX::Vec2f(),
bool* found =
nullptr)
const
169 return this->float2Map.Get(ids, defaultValue, found);
172 inline bool GetVec2f(
const std::vector<std::string>& ids, VisRTX::Vec2f* result,
const VisRTX::Vec2f& defaultValue = VisRTX::Vec2f())
175 *result = this->
GetVec2f(ids, defaultValue, &found);
181 this->int3Map.Set(
id, VisRTX::Vec3i(x, y, z));
184 inline VisRTX::Vec3i
GetVec3i(
const std::vector<std::string>& ids,
const VisRTX::Vec3i& defaultValue = VisRTX::Vec3i(),
bool* found =
nullptr)
const
186 return this->int3Map.Get(ids, defaultValue, found);
189 inline bool GetVec3i(
const std::vector<std::string>& ids, VisRTX::Vec3i* result,
const VisRTX::Vec3i& defaultValue = VisRTX::Vec3i())
192 *result = this->
GetVec3i(ids, defaultValue, &found);
198 this->float3Map.Set(
id, VisRTX::Vec3f(x, y, z));
201 inline VisRTX::Vec3f
GetVec3f(
const std::vector<std::string>& ids,
const VisRTX::Vec3f& defaultValue = VisRTX::Vec3f(),
bool* found =
nullptr)
const
203 return this->float3Map.Get(ids, defaultValue, found);
206 inline bool GetVec3f(
const std::vector<std::string>& ids, VisRTX::Vec3f* result,
const VisRTX::Vec3f& defaultValue = VisRTX::Vec3f())
209 *result = this->
GetVec3f(ids, defaultValue, &found);
215 this->float4Map.Set(
id, VisRTX::Vec4f(x, y, z, w));
218 inline VisRTX::Vec4f
GetVec4f(
const std::vector<std::string>& ids,
const VisRTX::Vec4f& defaultValue = VisRTX::Vec4f(),
bool* found =
nullptr)
const
220 return this->float4Map.Get(ids, defaultValue, found);
223 inline bool GetVec4f(
const std::vector<std::string>& ids, VisRTX::Vec4f* result,
const VisRTX::Vec4f& defaultValue = VisRTX::Vec4f())
226 *result = this->
GetVec4f(ids, defaultValue, &found);
232 this->stringMap.Remove(
id);
233 this->objectMap.Remove(
id);
234 this->int1Map.Remove(
id);
235 this->float1Map.Remove(
id);
236 this->float2Map.Remove(
id);
237 this->int2Map.Remove(
id);
238 this->int3Map.Remove(
id);
239 this->float3Map.Remove(
id);
240 this->float4Map.Remove(
id);
246 for (
auto it : this->stringMap.map)
247 std::cout <<
"String: \"" << it.first <<
"\" -> \"" << it.second <<
"\"" << std::endl;
249 for (
auto it : this->objectMap.map)
250 std::cout <<
"Object/Data: \"" << it.first <<
"\"" << std::endl;
252 for (
auto it : this->int1Map.map)
253 std::cout <<
"int1: \"" << it.first <<
"\" -> " << it.second << std::endl;
255 for (
auto it : this->float1Map.map)
256 std::cout <<
"float1: \"" << it.first <<
"\" -> " << it.second << std::endl;
258 for (
auto it : this->int2Map.map)
259 std::cout <<
"int2: \"" << it.first <<
"\" -> (" << it.second.x <<
", " << it.second.y <<
")" << std::endl;
261 for (
auto it : this->float2Map.map)
262 std::cout <<
"float2: \"" << it.first <<
"\" -> (" << it.second.x <<
", " << it.second.y <<
")" << std::endl;
264 for (
auto it : this->int3Map.map)
265 std::cout <<
"int3: \"" << it.first <<
"\" -> (" << it.second.x <<
", " << it.second.y <<
", " << it.second.z <<
")" << std::endl;
267 for (
auto it : this->float3Map.map)
268 std::cout <<
"float3: \"" << it.first <<
"\" -> (" << it.second.x <<
", " << it.second.y <<
", " << it.second.z <<
")" << std::endl;
270 for (
auto it : this->float4Map.map)
271 std::cout <<
"float4: \"" << it.first <<
"\" -> (" << it.second.x <<
", " << it.second.y <<
", " << it.second.z <<
", " << it.second.w <<
")" << std::endl;
276 std::set<std::string> result;
277 for (
auto it : this->stringMap.map)
278 result.insert(
"string " + it.first);
280 for (
auto it : this->objectMap.map)
281 result.insert(
"object " + it.first);
283 for (
auto it : this->int1Map.map)
284 result.insert(
"int1 " + it.first);
286 for (
auto it : this->float1Map.map)
287 result.insert(
"float1 " + it.first);
289 for (
auto it : this->int2Map.map)
290 result.insert(
"int2 " + it.first);
292 for (
auto it : this->float2Map.map)
293 result.insert(
"float2 " + it.first);
295 for (
auto it : this->int3Map.map)
296 result.insert(
"int3 " + it.first);
298 for (
auto it : this->float3Map.map)
299 result.insert(
"float3 " + it.first);
301 for (
auto it : this->float4Map.map)
302 result.insert(
"float4 " + it.first);
318 this->map[id] =
value;
321 inline T Get(
const std::vector<std::string>& ids,
const T& defaultValueValue,
bool* found =
nullptr)
const
325 auto it = this->map.find(
id);
326 if (it != this->map.end())
336 return defaultValueValue;
341 auto it = this->map.find(
id);
342 if (it != this->map.end())
347 std::map<std::string, T> map;
351 ParameterMap<std::string> stringMap;
352 ParameterMap<bool> boolMap;
353 ParameterMap<Object*> objectMap;
355 ParameterMap<int32_t> int1Map;
356 ParameterMap<float> float1Map;
357 ParameterMap<VisRTX::Vec2f> float2Map;
358 ParameterMap<VisRTX::Vec2i> int2Map;
359 ParameterMap<VisRTX::Vec3i> int3Map;
360 ParameterMap<VisRTX::Vec3f> float3Map;
361 ParameterMap<VisRTX::Vec4f> float4Map;
bool GetVec3i(const std::vector< std::string > &ids, VisRTX::Vec3i *result, const VisRTX::Vec3i &defaultValue=VisRTX::Vec3i())
void SetVec4f(const std::string &id, float x, float y, float z, float w)
VisRTX::Vec2i GetVec2i(const std::vector< std::string > &ids, const VisRTX::Vec2i &defaultValue=VisRTX::Vec2i(), bool *found=nullptr) const
bool GetString(const std::vector< std::string > &ids, std::string *result, const std::string &defaultValue=nullptr)
bool GetVec2i(const std::vector< std::string > &ids, VisRTX::Vec2i *result, const VisRTX::Vec2i &defaultValue=VisRTX::Vec2i())
RTWDataType GetDataType() const
int32_t GetInt(const std::vector< std::string > &ids, int32_t defaultValue=0, bool *found=nullptr) const
void SetVec3i(const std::string &id, int32_t x, int32_t y, int32_t z)
void SetInt(const std::string &id, int32_t x)
const std::string GetString(const std::vector< std::string > &ids, const std::string &defaultValue="", bool *found=nullptr) const
void SetVec3f(const std::string &id, float x, float y, float z)
void SetVec2f(const std::string &id, float x, float y)
bool GetInt(const std::vector< std::string > &ids, int32_t *result, int32_t defaultValue=0)
bool GetVec2f(const std::vector< std::string > &ids, VisRTX::Vec2f *result, const VisRTX::Vec2f &defaultValue=VisRTX::Vec2f())
VisRTX::Vec2f GetVec2f(const std::vector< std::string > &ids, const VisRTX::Vec2f &defaultValue=VisRTX::Vec2f(), bool *found=nullptr) const
std::set< std::string > GetAllParameters() const
void SetBool(const std::string &id, bool b)
virtual void SetObject(const std::string &id, Object *object)
void SetVec2i(const std::string &id, int32_t x, int32_t y)
bool GetObject(const std::vector< std::string > &ids, T **result, T *defaultValue=nullptr)
void SetFloat(const std::string &id, float x)
VisRTX::Vec3i GetVec3i(const std::vector< std::string > &ids, const VisRTX::Vec3i &defaultValue=VisRTX::Vec3i(), bool *found=nullptr) const
bool GetFloat(const std::vector< std::string > &ids, float *result, float defaultValue=0.0f)
T * GetObject(const std::vector< std::string > &ids, T *defaultValue=nullptr, bool *found=nullptr) const
Object(RTWDataType type=RTW_OBJECT)
void PrintAllParameters() const
bool GetVec4f(const std::vector< std::string > &ids, VisRTX::Vec4f *result, const VisRTX::Vec4f &defaultValue=VisRTX::Vec4f())
virtual void RemoveParam(const std::string &id)
float GetFloat(const std::vector< std::string > &ids, float defaultValue=0.0f, bool *found=nullptr) const
void SetString(const std::string &id, const std::string &s)
VisRTX::Vec4f GetVec4f(const std::vector< std::string > &ids, const VisRTX::Vec4f &defaultValue=VisRTX::Vec4f(), bool *found=nullptr) const
bool GetVec3f(const std::vector< std::string > &ids, VisRTX::Vec3f *result, const VisRTX::Vec3f &defaultValue=VisRTX::Vec3f())
VisRTX::Vec3f GetVec3f(const std::vector< std::string > &ids, const VisRTX::Vec3f &defaultValue=VisRTX::Vec3f(), bool *found=nullptr) const