MVSim
Lightweight simulator for 2.5D vehicles and robots
TParameterDefinitions.h
1 /*+-------------------------------------------------------------------------+
2  | MultiVehicle simulator (libmvsim) |
3  | |
4  | Copyright (C) 2014-2026 Jose Luis Blanco Claraco |
5  | Copyright (C) 2017 Borys Tymchenko (Odessa Polytechnic University) |
6  | Distributed under 3-clause BSD License |
7  | See COPYING |
8  +-------------------------------------------------------------------------+ */
9 #pragma once
10 
11 #include <cstdlib>
12 #include <map>
13 #include <string>
14 
15 namespace mvsim
16 {
39 {
40  const char* format = nullptr;
41  void* val = nullptr;
42 
43  TParamEntry() = default;
44 
45  template <typename T>
46  TParamEntry(const char* format_, T* targetVariable)
47  : format(format_), val(reinterpret_cast<void*>(targetVariable))
48  {
49  }
50 
55  void parse(
56  const std::string& str, const std::string& varName,
57  const std::map<std::string, std::string>& variableNamesValues = {},
58  const char* functionNameContext = "") const;
59 };
60 
64 using TParameterDefinitions = std::map<std::string, TParamEntry>;
65 
66 } // namespace mvsim
Definition: TParameterDefinitions.h:39
void parse(const std::string &str, const std::string &varName, const std::map< std::string, std::string > &variableNamesValues={}, const char *functionNameContext="") const