29 #include <SimoxUtility/algorithm/string/string_tools.h>
45 : selectedProfile(selectedProfile)
53 this->groupDefinitionFile = groupDefinitionFile;
54 basePath = groupDefinitionFile;
55 basePath = basePath.remove_filename();
74 std::set<std::string> proxySet;
78 proxySet.insert(proxyNode.attribute_value(
"value"));
80 proxySet.insert(
"ArmarXCoreInterfaces.systemObserver");
81 proxySet.insert(
"ArmarXCoreInterfaces.conditionHandler");
82 proxies.insert(proxies.end(), proxySet.begin(), proxySet.end());
84 profileConfigurations.clear();
87 auto profileName = configNode.attribute_value(
"profileName");
88 auto configuration = configNode.value();
89 profileConfigurations[profileName] = configuration;
92 ReadChildren(xmlGroupNode, basePath, 0);
97 return groupDefinitionFile;
101 void StatechartGroupXmlReader::ReadChildren(
RapidXmlReaderNode xmlNode,
const std::filesystem::path& path,
int nesting)
105 std::filesystem::path basename(xmlFolderNode.attribute_value(
"basename"));
107 ReadChildren(xmlFolderNode, path / basename, nesting + 1);
112 std::filesystem::path
filename(xmlStateNode.attribute_value(
"filename").c_str());
113 std::string fullpath = (path /
filename).
string();
114 allstateFilePaths.push_back(fullpath);
115 std::string visibility = xmlStateNode.attribute_value_or_default(
"visibility",
"");
116 stateVisibilityMap[fullpath] = visibility ==
"public" ?
ePublic :
ePrivate;
117 stateNestingMap[fullpath] = nesting;
129 return generateContext;
134 auto it = stateVisibilityMap.find(filepath);
136 if (it == stateVisibilityMap.end())
138 throw LocalException(
"State ") << filepath <<
" not found.";
147 auto it = stateNestingMap.find(filepath);
149 if (it == stateNestingMap.end())
151 std::stringstream ss;
153 for (std::pair<std::string, int> pair : stateNestingMap)
155 ss <<
"\n" << pair.first;
158 throw LocalException(
"State File ") << filepath <<
" not found in nesting map. States in map (" << stateNestingMap.size() <<
"):" << ss.str();
171 return selectedProfile;
177 auto profile = selectedProfile;
181 if (profileConfigurations.count(profile->getName()) > 0)
183 configs = profileConfigurations.at(profile->getName());
185 if (!configs.empty())
187 result =
"# Profile: " + profile->getName() +
"\n"
188 + configs +
"\n\n" + result;
190 profile = profile->getParent();
193 profile = selectedProfile;
194 std::string profileProperties;
197 profileProperties = profile->getAdditionalProperties() + profileProperties;
198 profile = profile->getParent();
201 profileProperties = simox::alg::replace_all(profileProperties,
"{#GroupName#}", groupName);
202 result = profileProperties + result;