5#include "../RTWrapper.h"
18VTK_ABI_NAMESPACE_BEGIN
33 for (
auto it : this->objectMap.map)
59 inline void SetString(
const std::string&
id,
const std::string& s)
61 this->stringMap.Set(
id, s);
64 inline const std::string
GetString(
const std::vector<std::string>& ids,
const std::string& defaultValue =
"",
bool* found =
nullptr)
const
66 return this->stringMap.Get(ids, defaultValue, found);
69 inline bool GetString(
const std::vector<std::string>& ids, std::string* result,
const std::string& defaultValue =
nullptr)
72 *result = this->
GetString(ids, defaultValue, &found);
76 inline void SetBool(
const std::string&
id,
bool b)
78 this->boolMap.Set(
id, b);
84 Object* current = this->objectMap.Get({
id },
nullptr);
91 this->objectMap.Set(
id,
object);
96 this->objectMap.Remove(
id);
100 template<
typename T = Object>
101 inline T*
GetObject(
const std::vector<std::string>& ids, T* defaultValue =
nullptr,
bool* found =
nullptr)
const
103 return reinterpret_cast<T*
>(this->objectMap.Get(ids,
reinterpret_cast<Object*
>(defaultValue), found));
106 template<
typename T = Object>
107 inline bool GetObject(
const std::vector<std::string>& ids, T** result, T* defaultValue =
nullptr)
110 *result = this->GetObject<T>(ids, defaultValue, &found);
114 inline void SetInt(
const std::string&
id, int32_t x)
116 this->int1Map.Set(
id, x);
119 inline int32_t
GetInt(
const std::vector<std::string>& ids, int32_t defaultValue = 0,
bool* found =
nullptr)
const
121 return this->int1Map.Get(ids, defaultValue, found);
124 inline bool GetInt(
const std::vector<std::string>& ids, int32_t* result, int32_t defaultValue = 0)
127 *result = this->
GetInt(ids, defaultValue, &found);
131 inline void SetFloat(
const std::string&
id,
float x)
133 this->float1Map.Set(
id, x);
136 inline float GetFloat(
const std::vector<std::string>& ids,
float defaultValue = 0.0f,
bool* found =
nullptr)
const
138 return this->float1Map.Get(ids, defaultValue, found);
141 inline bool GetFloat(
const std::vector<std::string>& ids,
float* result,
float defaultValue = 0.0f)
144 *result = this->
GetFloat(ids, defaultValue, &found);
148 inline void SetVec2i(
const std::string&
id, int32_t x, int32_t y)
150 this->int2Map.Set(
id, VisRTX::Vec2i(x, y));
153 inline VisRTX::Vec2i
GetVec2i(
const std::vector<std::string>& ids,
const VisRTX::Vec2i& defaultValue = VisRTX::Vec2i(),
bool* found =
nullptr)
const
155 return this->int2Map.Get(ids, defaultValue, found);
158 inline bool GetVec2i(
const std::vector<std::string>& ids, VisRTX::Vec2i* result,
const VisRTX::Vec2i& defaultValue = VisRTX::Vec2i())
161 *result = this->
GetVec2i(ids, defaultValue, &found);
165 inline void SetVec2f(
const std::string&
id,
float x,
float y)
167 this->float2Map.Set(
id, VisRTX::Vec2f(x, y));
170 inline VisRTX::Vec2f
GetVec2f(
const std::vector<std::string>& ids,
const VisRTX::Vec2f& defaultValue = VisRTX::Vec2f(),
bool* found =
nullptr)
const
172 return this->float2Map.Get(ids, defaultValue, found);
175 inline bool GetVec2f(
const std::vector<std::string>& ids, VisRTX::Vec2f* result,
const VisRTX::Vec2f& defaultValue = VisRTX::Vec2f())
178 *result = this->
GetVec2f(ids, defaultValue, &found);
182 inline void SetVec3i(
const std::string&
id, int32_t x, int32_t y, int32_t z)
184 this->int3Map.Set(
id, VisRTX::Vec3i(x, y, z));
187 inline VisRTX::Vec3i
GetVec3i(
const std::vector<std::string>& ids,
const VisRTX::Vec3i& defaultValue = VisRTX::Vec3i(),
bool* found =
nullptr)
const
189 return this->int3Map.Get(ids, defaultValue, found);
192 inline bool GetVec3i(
const std::vector<std::string>& ids, VisRTX::Vec3i* result,
const VisRTX::Vec3i& defaultValue = VisRTX::Vec3i())
195 *result = this->
GetVec3i(ids, defaultValue, &found);
199 inline void SetVec3f(
const std::string&
id,
float x,
float y,
float z)
201 this->float3Map.Set(
id, VisRTX::Vec3f(x, y, z));
204 inline VisRTX::Vec3f
GetVec3f(
const std::vector<std::string>& ids,
const VisRTX::Vec3f& defaultValue = VisRTX::Vec3f(),
bool* found =
nullptr)
const
206 return this->float3Map.Get(ids, defaultValue, found);
209 inline bool GetVec3f(
const std::vector<std::string>& ids, VisRTX::Vec3f* result,
const VisRTX::Vec3f& defaultValue = VisRTX::Vec3f())
212 *result = this->
GetVec3f(ids, defaultValue, &found);
216 inline void SetVec4f(
const std::string&
id,
float x,
float y,
float z,
float w)
218 this->float4Map.Set(
id, VisRTX::Vec4f(x, y, z, w));
221 inline VisRTX::Vec4f
GetVec4f(
const std::vector<std::string>& ids,
const VisRTX::Vec4f& defaultValue = VisRTX::Vec4f(),
bool* found =
nullptr)
const
223 return this->float4Map.Get(ids, defaultValue, found);
226 inline bool GetVec4f(
const std::vector<std::string>& ids, VisRTX::Vec4f* result,
const VisRTX::Vec4f& defaultValue = VisRTX::Vec4f())
229 *result = this->
GetVec4f(ids, defaultValue, &found);
235 this->stringMap.Remove(
id);
236 this->objectMap.Remove(
id);
237 this->int1Map.Remove(
id);
238 this->float1Map.Remove(
id);
239 this->float2Map.Remove(
id);
240 this->int2Map.Remove(
id);
241 this->int3Map.Remove(
id);
242 this->float3Map.Remove(
id);
243 this->float4Map.Remove(
id);
249 for (
auto it : this->stringMap.map)
250 std::cout <<
"String: \"" << it.first <<
"\" -> \"" << it.second <<
"\"" << std::endl;
252 for (
auto it : this->objectMap.map)
253 std::cout <<
"Object/Data: \"" << it.first <<
"\"" << std::endl;
255 for (
auto it : this->int1Map.map)
256 std::cout <<
"int1: \"" << it.first <<
"\" -> " << it.second << std::endl;
258 for (
auto it : this->float1Map.map)
259 std::cout <<
"float1: \"" << it.first <<
"\" -> " << it.second << std::endl;
261 for (
auto it : this->int2Map.map)
262 std::cout <<
"int2: \"" << it.first <<
"\" -> (" << it.second.x <<
", " << it.second.y <<
")" << std::endl;
264 for (
auto it : this->float2Map.map)
265 std::cout <<
"float2: \"" << it.first <<
"\" -> (" << it.second.x <<
", " << it.second.y <<
")" << std::endl;
267 for (
auto it : this->int3Map.map)
268 std::cout <<
"int3: \"" << it.first <<
"\" -> (" << it.second.x <<
", " << it.second.y <<
", " << it.second.z <<
")" << std::endl;
270 for (
auto it : this->float3Map.map)
271 std::cout <<
"float3: \"" << it.first <<
"\" -> (" << it.second.x <<
", " << it.second.y <<
", " << it.second.z <<
")" << std::endl;
273 for (
auto it : this->float4Map.map)
274 std::cout <<
"float4: \"" << it.first <<
"\" -> (" << it.second.x <<
", " << it.second.y <<
", " << it.second.z <<
", " << it.second.w <<
")" << std::endl;
279 std::set<std::string> result;
280 for (
auto it : this->stringMap.map)
281 result.insert(
"string " + it.first);
283 for (
auto it : this->objectMap.map)
284 result.insert(
"object " + it.first);
286 for (
auto it : this->int1Map.map)
287 result.insert(
"int1 " + it.first);
289 for (
auto it : this->float1Map.map)
290 result.insert(
"float1 " + it.first);
292 for (
auto it : this->int2Map.map)
293 result.insert(
"int2 " + it.first);
295 for (
auto it : this->float2Map.map)
296 result.insert(
"float2 " + it.first);
298 for (
auto it : this->int3Map.map)
299 result.insert(
"int3 " + it.first);
301 for (
auto it : this->float3Map.map)
302 result.insert(
"float3 " + it.first);
304 for (
auto it : this->float4Map.map)
305 result.insert(
"float4 " + it.first);
319 inline void Set(
const std::string&
id,
const T& value)
321 this->map[id] = value;
324 inline T Get(
const std::vector<std::string>& ids,
const T& defaultValueValue,
bool* found =
nullptr)
const
326 for (
const std::string&
id : ids)
328 auto it = this->map.find(
id);
329 if (it != this->map.end())
339 return defaultValueValue;
342 inline void Remove(
const std::string&
id)
344 auto it = this->map.find(
id);
345 if (it != this->map.end())
350 std::map<std::string, T> map;
354 ParameterMap<std::string> stringMap;
355 ParameterMap<bool> boolMap;
356 ParameterMap<Object*> objectMap;
358 ParameterMap<int32_t> int1Map;
359 ParameterMap<float> float1Map;
360 ParameterMap<VisRTX::Vec2f> float2Map;
361 ParameterMap<VisRTX::Vec2i> int2Map;
362 ParameterMap<VisRTX::Vec3i> int3Map;
363 ParameterMap<VisRTX::Vec3f> float3Map;
364 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