6 #ifndef MOTORCORTEX_CORE_PS_LINK_H
7 #define MOTORCORTEX_CORE_PS_LINK_H
9 #include "cmdline_field.h"
10 #include "cmdline_systemmode.h"
11 #include "nlohmann/json.hpp"
12 #include "ps_paramtype.h"
13 #include "ps_setparam.h"
17 namespace mcx::parameter_server {
32 mcx::cmd_line::SystemMode system_mode{mcx::cmd_line::SystemMode::ALL_MODES};
34 std::vector<Link> links;
35 std::vector<SetParam> set_params;
38 using LinkGroups =
typename std::vector<LinkGroup>;
42 LinkGroups load(
const std::string& file_name);
43 static bool link(
const LinkGroups& links,
Parameter* root, cmd_line::SystemMode system_mode);
44 static bool setParameters(
const LinkGroups& linking_groups,
Parameter* root, cmd_line::SystemMode system_mode);
47 static const std::map<std::string, mcx::cmd_line::FieldDesc>& getFields();
48 static std::string buildPathAndCheck(
const std::string& path,
size_t index,
Parameter* root);
49 static bool linkDestWithWildcard(
const Link& l,
Parameter* root);
50 static bool linkSrcWithWildcard(
const Link& l,
Parameter* root);
51 static bool linkBothWithWildcard(
const Link& l,
Parameter* root);
53 LinkGroups loadGroups(
const nlohmann::json& root)
const;
54 LinkGroup loadGroup(
const nlohmann::json& group)
const;
55 Link loadLink(
const nlohmann::json& link)
const;
56 SetParam loadSetParam(
const nlohmann::json& set_param)
const;
57 ParameterPath loadParameterPath(
const nlohmann::json& param_path)
const;
61 bool link(
const std::string& file_name,
Parameter* root, cmd_line::SystemMode system_mode);
65 #endif // MOTORCORTEX_CORE_PS_LINK_H