3 #include "../RTWrapper.h" 28 for (
auto it : this->objectMap.map)
53 this->stringMap.Set(
id, s);
58 return this->stringMap.Get(ids, defaultValue, found);
64 *result = this->
GetString(ids, defaultValue, &found);
68 template<
typename T = Object>
72 Object* current = this->objectMap.Get({
id },
nullptr);
79 this->objectMap.Set(
id,
object);
84 this->objectMap.Remove(
id);
88 template<
typename T = Object>
89 inline T*
GetObject(
const std::vector<std::string>& ids, T* defaultValue =
nullptr,
bool* found =
nullptr)
const 91 return reinterpret_cast<T*
>(this->objectMap.Get(ids, reinterpret_cast<Object*>(defaultValue), found));
94 template<
typename T = Object>
95 inline bool GetObject(
const std::vector<std::string>& ids, T** result, T* defaultValue =
nullptr)
98 *result = this->GetObject<T>(ids, defaultValue, &found);
104 this->int1Map.Set(
id, x);
107 inline int32_t
Get1i(
const std::vector<std::string>& ids, int32_t defaultValue = 0,
bool* found =
nullptr)
const 109 return this->int1Map.Get(ids, defaultValue, found);
112 inline bool Get1i(
const std::vector<std::string>& ids, int32_t* result, int32_t defaultValue = 0)
115 *result = this->
Get1i(ids, defaultValue, &found);
121 this->float1Map.Set(
id, x);
124 inline float Get1f(
const std::vector<std::string>& ids,
float defaultValue = 0.0f,
bool* found =
nullptr)
const 126 return this->float1Map.Get(ids, defaultValue, found);
129 inline bool Get1f(
const std::vector<std::string>& ids,
float* result,
float defaultValue = 0.0f)
132 *result = this->
Get1f(ids, defaultValue, &found);
138 this->int2Map.Set(
id, VisRTX::Vec2i(x, y));
141 inline VisRTX::Vec2i
Get2i(
const std::vector<std::string>& ids,
const VisRTX::Vec2i& defaultValue = VisRTX::Vec2i(),
bool* found =
nullptr)
const 143 return this->int2Map.Get(ids, defaultValue, found);
146 inline bool Get2i(
const std::vector<std::string>& ids, VisRTX::Vec2i* result,
const VisRTX::Vec2i& defaultValue = VisRTX::Vec2i())
149 *result = this->
Get2i(ids, defaultValue, &found);
155 this->float2Map.Set(
id, VisRTX::Vec2f(x, y));
158 inline VisRTX::Vec2f
Get2f(
const std::vector<std::string>& ids,
const VisRTX::Vec2f& defaultValue = VisRTX::Vec2f(),
bool* found =
nullptr)
const 160 return this->float2Map.Get(ids, defaultValue, found);
163 inline bool Get2f(
const std::vector<std::string>& ids, VisRTX::Vec2f* result,
const VisRTX::Vec2f& defaultValue = VisRTX::Vec2f())
166 *result = this->
Get2f(ids, defaultValue, &found);
172 this->int3Map.Set(
id, VisRTX::Vec3i(x, y, z));
175 inline VisRTX::Vec3i
Get3i(
const std::vector<std::string>& ids,
const VisRTX::Vec3i& defaultValue = VisRTX::Vec3i(),
bool* found =
nullptr)
const 177 return this->int3Map.Get(ids, defaultValue, found);
180 inline bool Get3i(
const std::vector<std::string>& ids, VisRTX::Vec3i* result,
const VisRTX::Vec3i& defaultValue = VisRTX::Vec3i())
183 *result = this->
Get3i(ids, defaultValue, &found);
189 this->float3Map.Set(
id, VisRTX::Vec3f(x, y, z));
192 inline VisRTX::Vec3f
Get3f(
const std::vector<std::string>& ids,
const VisRTX::Vec3f& defaultValue = VisRTX::Vec3f(),
bool* found =
nullptr)
const 194 return this->float3Map.Get(ids, defaultValue, found);
197 inline bool Get3f(
const std::vector<std::string>& ids, VisRTX::Vec3f* result,
const VisRTX::Vec3f& defaultValue = VisRTX::Vec3f())
200 *result = this->
Get3f(ids, defaultValue, &found);
206 this->float4Map.Set(
id, VisRTX::Vec4f(x, y, z, w));
209 inline VisRTX::Vec4f
Get4f(
const std::vector<std::string>& ids,
const VisRTX::Vec4f& defaultValue = VisRTX::Vec4f(),
bool* found =
nullptr)
const 211 return this->float4Map.Get(ids, defaultValue, found);
214 inline bool Get4f(
const std::vector<std::string>& ids, VisRTX::Vec4f* result,
const VisRTX::Vec4f& defaultValue = VisRTX::Vec4f())
217 *result = this->
Get4f(ids, defaultValue, &found);
223 this->stringMap.Remove(
id);
224 this->objectMap.Remove(
id);
225 this->int1Map.Remove(
id);
226 this->float1Map.Remove(
id);
227 this->float2Map.Remove(
id);
228 this->int2Map.Remove(
id);
229 this->int3Map.Remove(
id);
230 this->float3Map.Remove(
id);
231 this->float4Map.Remove(
id);
237 for (
auto it : this->stringMap.map)
238 std::cout <<
"String: \"" << it.first <<
"\" -> \"" << it.second <<
"\"" << std::endl;
240 for (
auto it : this->objectMap.map)
241 std::cout <<
"Object/Data: \"" << it.first <<
"\"" << std::endl;
243 for (
auto it : this->int1Map.map)
244 std::cout <<
"int1: \"" << it.first <<
"\" -> " << it.second << std::endl;
246 for (
auto it : this->float1Map.map)
247 std::cout <<
"float1: \"" << it.first <<
"\" -> " << it.second << std::endl;
249 for (
auto it : this->int2Map.map)
250 std::cout <<
"int2: \"" << it.first <<
"\" -> (" << it.second.x <<
", " << it.second.y <<
")" << std::endl;
252 for (
auto it : this->float2Map.map)
253 std::cout <<
"float2: \"" << it.first <<
"\" -> (" << it.second.x <<
", " << it.second.y <<
")" << std::endl;
255 for (
auto it : this->int3Map.map)
256 std::cout <<
"int3: \"" << it.first <<
"\" -> (" << it.second.x <<
", " << it.second.y <<
", " << it.second.z <<
")" << std::endl;
258 for (
auto it : this->float3Map.map)
259 std::cout <<
"float3: \"" << it.first <<
"\" -> (" << it.second.x <<
", " << it.second.y <<
", " << it.second.z <<
")" << std::endl;
261 for (
auto it : this->float4Map.map)
262 std::cout <<
"float4: \"" << it.first <<
"\" -> (" << it.second.x <<
", " << it.second.y <<
", " << it.second.z <<
", " << it.second.w <<
")" << std::endl;
267 std::set<std::string> result;
268 for (
auto it : this->stringMap.map)
269 result.insert(
"string " + it.first);
271 for (
auto it : this->objectMap.map)
272 result.insert(
"object " + it.first);
274 for (
auto it : this->int1Map.map)
275 result.insert(
"int1 " + it.first);
277 for (
auto it : this->float1Map.map)
278 result.insert(
"float1 " + it.first);
280 for (
auto it : this->int2Map.map)
281 result.insert(
"int2 " + it.first);
283 for (
auto it : this->float2Map.map)
284 result.insert(
"float2 " + it.first);
286 for (
auto it : this->int3Map.map)
287 result.insert(
"int3 " + it.first);
289 for (
auto it : this->float3Map.map)
290 result.insert(
"float3 " + it.first);
292 for (
auto it : this->float4Map.map)
293 result.insert(
"float4 " + it.first);
304 this->map[id] =
value;
307 inline T Get(
const std::vector<std::string>& ids,
const T& defaultValueValue,
bool* found =
nullptr)
const 311 auto it = this->map.find(
id);
312 if (it != this->map.end())
322 return defaultValueValue;
327 auto it = this->map.find(
id);
328 if (it != this->map.end())
333 std::map<std::string, T> map;
337 ParameterMap<std::string> stringMap;
338 ParameterMap<Object*> objectMap;
340 ParameterMap<int32_t> int1Map;
341 ParameterMap<float> float1Map;
342 ParameterMap<VisRTX::Vec2f> float2Map;
343 ParameterMap<VisRTX::Vec2i> int2Map;
344 ParameterMap<VisRTX::Vec3i> int3Map;
345 ParameterMap<VisRTX::Vec3f> float3Map;
346 ParameterMap<VisRTX::Vec4f> float4Map;
VisRTX::Vec2i Get2i(const std::vector< std::string > &ids, const VisRTX::Vec2i &defaultValue=VisRTX::Vec2i(), bool *found=nullptr) const
VisRTX::Vec4f Get4f(const std::vector< std::string > &ids, const VisRTX::Vec4f &defaultValue=VisRTX::Vec4f(), bool *found=nullptr) const
void SetObject(const std::string &id, T *object)
void Set3i(const std::string &id, int32_t x, int32_t y, int32_t z)
void RemoveParam(const std::string &id)
void Set4f(const std::string &id, float x, float y, float z, float w)
bool Get2f(const std::vector< std::string > &ids, VisRTX::Vec2f *result, const VisRTX::Vec2f &defaultValue=VisRTX::Vec2f())
void Set2i(const std::string &id, int32_t x, int32_t y)
bool GetString(const std::vector< std::string > &ids, std::string *result, const std::string &defaultValue=nullptr)
bool Get3i(const std::vector< std::string > &ids, VisRTX::Vec3i *result, const VisRTX::Vec3i &defaultValue=VisRTX::Vec3i())
void Set1i(const std::string &id, int32_t x)
void Set2f(const std::string &id, float x, float y)
VisRTX::Vec3f Get3f(const std::vector< std::string > &ids, const VisRTX::Vec3f &defaultValue=VisRTX::Vec3f(), bool *found=nullptr) const
VisRTX::Vec3i Get3i(const std::vector< std::string > &ids, const VisRTX::Vec3i &defaultValue=VisRTX::Vec3i(), bool *found=nullptr) const
void Set3f(const std::string &id, float x, float y, float z)
T * GetObject(const std::vector< std::string > &ids, T *defaultValue=nullptr, bool *found=nullptr) const
bool Get4f(const std::vector< std::string > &ids, VisRTX::Vec4f *result, const VisRTX::Vec4f &defaultValue=VisRTX::Vec4f())
void PrintAllParameters() const
bool Get1f(const std::vector< std::string > &ids, float *result, float defaultValue=0.0f)
int32_t Get1i(const std::vector< std::string > &ids, int32_t defaultValue=0, bool *found=nullptr) const
void Set1f(const std::string &id, float x)
bool Get3f(const std::vector< std::string > &ids, VisRTX::Vec3f *result, const VisRTX::Vec3f &defaultValue=VisRTX::Vec3f())
bool Get1i(const std::vector< std::string > &ids, int32_t *result, int32_t defaultValue=0)
const std::string GetString(const std::vector< std::string > &ids, const std::string &defaultValue="", bool *found=nullptr) const
bool GetObject(const std::vector< std::string > &ids, T **result, T *defaultValue=nullptr)
VisRTX::Vec2f Get2f(const std::vector< std::string > &ids, const VisRTX::Vec2f &defaultValue=VisRTX::Vec2f(), bool *found=nullptr) const
bool Get2i(const std::vector< std::string > &ids, VisRTX::Vec2i *result, const VisRTX::Vec2i &defaultValue=VisRTX::Vec2i())
float Get1f(const std::vector< std::string > &ids, float defaultValue=0.0f, bool *found=nullptr) const
std::set< std::string > GetAllParameters() const
void SetString(const std::string &id, const std::string &s)