VariantInfo.cpp
Go to the documentation of this file.
1 /*
2  * This file is part of ArmarX.
3  *
4  * Copyright (C) 2011-2016, High Performance Humanoid Technologies (H2T), Karlsruhe Institute of Technology (KIT), all rights reserved.
5  *
6  * ArmarX is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation.
9  *
10  * ArmarX is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  *
18  * @package
19  * @author
20  * @date
21  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
22  * GNU General Public License
23  */
24 #include "VariantInfo.h"
25 
29 #include <ArmarXCore/interface/observers/VariantContainers.h>
35 
36 #include <filesystem>
37 
38 #include <SimoxUtility/algorithm/string.h>
39 
40 
41 namespace armarx
42 {
44  {
45  }
46 
47  std::vector<VariantInfo::LibEntryPtr> VariantInfo::readVariantInfo(RapidXmlReaderPtr reader, const std::string& packagePath, const std::string& packageName)
48  {
49  std::vector<LibEntryPtr> libs;
50  if (packagePaths.find(packagePath) != packagePaths.end())
51  {
52  ARMARX_DEBUG_S << "path '" << packagePath << "' already in there.";
53  return libs;
54  }
55 
56  packagePaths[(packagePath)] = packageName;
57  RapidXmlReaderNode node = reader->getRoot("VariantInfo");
58  for (RapidXmlReaderNode libNode = node.first_node("Lib"); libNode.is_valid(); libNode = libNode.next_sibling("Lib"))
59  {
60  LibEntryPtr lib(new LibEntry(libNode, packageName));
61  this->libs.push_back(lib);
62  libs.push_back(lib);
63 
64  for (VariantEntryPtr e : lib->variants)
65  {
66  variantToLibMap.insert(std::make_pair(e->baseTypeName, lib));
67  variantMap.insert(std::make_pair(e->baseTypeName, e));
68  humanNameToVariantMap.insert(std::make_pair(e->humanName, e));
69  }
70 
71  for (ProxyEntryPtr p : lib->proxies)
72  {
73  proxyMap.insert(std::make_pair(lib->name + "." + p->memberName, p));
74  }
75  }
76  return libs;
77  }
78 
79  VariantInfo::LibEntryPtr VariantInfo::findLibByVariant(std::string variantTypeName) const
80  {
81  std::map<std::string, LibEntryPtr>::const_iterator it = variantToLibMap.find(variantTypeName);
82 
83  if (it == variantToLibMap.end())
84  {
85  return LibEntryPtr();
86  }
87  else
88  {
89  return it->second;
90  }
91  }
92 
93  VariantInfo::LibEntryPtr VariantInfo::findLibByProxy(std::string proxyTypeName) const
94  {
95  for (VariantInfo::LibEntryPtr lib : getLibs())
96  {
97  std::string libName = lib->getName();
98  for (VariantInfo::ProxyEntryPtr proxy : lib->getProxies())
99  {
100  if (proxy->getMemberName() == proxyTypeName)
101  {
102  return lib;
103  }
104 
105  }
106  }
107  return LibEntryPtr();
108  }
109 
110  Ice::StringSeq VariantInfo::findLibNames(const Ice::StringSeq& variantTypeNames, const Ice::StringSeq& proxyTypeNames) const
111  {
112  Ice::StringSeq result;
113  for (const LibEntryPtr& lib : findLibs(variantTypeNames, proxyTypeNames))
114  {
115  if (lib)
116  {
117  result.push_back(lib->getName());
118  }
119  }
120  return result;
121  }
122 
123  std::set<VariantInfo::LibEntryPtr> VariantInfo::findLibs(const Ice::StringSeq& variantTypeNames, const Ice::StringSeq& proxyTypeNames) const
124  {
125  std::set<VariantInfo::LibEntryPtr> result;
126  for (auto& var : variantTypeNames)
127  {
128  auto lib = findLibByVariant(var);
129  if (lib)
130  {
131  result.insert(lib);
132  }
133  }
134  for (auto& proxy : proxyTypeNames)
135  {
136  auto lib = findLibByProxy(proxy);
137  if (lib)
138  {
139  result.insert(lib);
140  }
141  }
142  return result;
143  }
144 
145  std::string VariantInfo::getDataTypeName(std::string variantBaseTypeName)
146  {
147  std::map<std::string, VariantEntryPtr>::const_iterator it = variantMap.find(variantBaseTypeName);
148 
149  if (it == variantMap.end())
150  {
151  return "NOT_FOUND";
152  }
153  else
154  {
155  return it->second->dataTypeName;
156  }
157  }
158 
159  std::string VariantInfo::getReturnTypeName(std::string variantBaseTypeName)
160  {
161  std::map<std::string, VariantEntryPtr>::const_iterator it = variantMap.find(variantBaseTypeName);
162 
163  if (it == variantMap.end())
164  {
165  return "NOT_FOUND";
166  }
167  else
168  {
169  // NOTE: Here a typedef in the form of "typedef IceInternal::Handle<[VariantDataType]> [VariantDataType]Ptr;" is assumed.
170  // If this typedef is missing, the statechart code generator WILL GENERATE INVALID CODE.
171  VariantEntryPtr e = it->second;
172  return e->basic ? e->dataTypeName : e->dataTypeName + "Ptr";
173  }
174  }
175 
176  bool VariantInfo::isBasic(std::string variantBaseTypeName)
177  {
178  std::map<std::string, VariantEntryPtr>::const_iterator it = variantMap.find(variantBaseTypeName);
179 
180  if (it == variantMap.end())
181  {
182  return false;
183  }
184  else
185  {
186  VariantEntryPtr e = it->second;
187  return e->basic;
188  }
189  }
190 
191  std::vector<VariantInfo::LibEntryPtr> VariantInfo::getLibs() const
192  {
193  return libs;
194  }
195 
197  {
198  std::map<std::string, ProxyEntryPtr>::const_iterator it = proxyMap.find(proxyId);
199 
200  if (it == proxyMap.end())
201  {
202  return ProxyEntryPtr();
203  }
204  else
205  {
206  return it->second;
207  }
208  }
209 
211  {
212  std::map<std::string, VariantEntryPtr>::const_iterator it = variantMap.find(variantBaseTypeName);
213 
214  if (it == variantMap.end())
215  {
216  return VariantEntryPtr();
217  }
218  else
219  {
220  return it->second;
221  }
222  }
223 
225  {
226  std::map<std::string, VariantEntryPtr>::const_iterator it = humanNameToVariantMap.find(humanName);
227 
228  if (it == humanNameToVariantMap.end())
229  {
230  return VariantEntryPtr();
231  }
232  else
233  {
234  return it->second;
235  }
236  }
237 
238  std::string VariantInfo::getNestedHumanNameFromBaseName(std::string variantBaseTypeName)
239  {
240  ContainerTypePtr containerInfo = VariantContainerType::FromString(variantBaseTypeName);
241  std::stringstream containers;
242  std::stringstream parenthesis;
243 
244  while (containerInfo->subType)
245  {
246  if (containerInfo->typeId == SingleTypeVariantList::getTypePrefix())
247  {
248  containers << "List(";
249  }
250  else if (containerInfo->typeId == StringValueMap::getTypePrefix())
251  {
252  containers << "Map(";
253  }
254  else
255  {
256  return "";
257  }
258 
259  parenthesis << ")";
260  containerInfo = containerInfo->subType;
261  }
262 
263  VariantEntryPtr entry = getVariantByName(containerInfo->typeId);
264 
265  if (!entry)
266  {
267  return "";
268  }
269 
270  return containers.str() + entry->humanName + parenthesis.str();
271  }
272 
273  std::string VariantInfo::getNestedBaseNameFromHumanName(std::string humanName)
274  {
275  ContainerTypePtr containerInfo = VariantContainerType::FromString(humanName);
276  std::stringstream containers;
277  std::stringstream parenthesis;
278 
279  while (containerInfo->subType)
280  {
281  if (containerInfo->typeId == "List")
282  {
283  containers << SingleTypeVariantList::getTypePrefix() << "(";
284  }
285  else if (containerInfo->typeId == "Map")
286  {
287  containers << StringValueMap::getTypePrefix() << "(";
288  }
289  else
290  {
291  return "";
292  }
293 
294  parenthesis << ")";
295  containerInfo = containerInfo->subType;
296  }
297 
298  VariantEntryPtr entry = getVariantByHumanName(containerInfo->typeId);
299 
300  if (!entry)
301  {
302  return "";
303  }
304 
305  return containers.str() + entry->baseTypeName + parenthesis.str();
306  }
307 
308  const std::map<std::string, std::string>& VariantInfo::getPackagePaths() const
309  {
310  return packagePaths;
311  }
312 
313  bool VariantInfo::isPackageLoaded(const std::string packageName) const
314  {
315  for (const auto& p : packagePaths)
316  {
317  if (p.second == packageName)
318  {
319  return true;
320  }
321  }
322  return false;
323  }
324 
325  std::string VariantInfo::getDebugInfo() const
326  {
327  std::stringstream ss;
328 
329  for (const LibEntryPtr& e : libs)
330  {
331  ss << e->getName() << "\n";
332 
333  for (const VariantEntryPtr& v : e->variants)
334  {
335  ss << " " << v->getHumanName() << ": " << v->dataTypeName << "\n";
336  }
337 
338  for (const ProxyEntryPtr& p : e->getProxies())
339  {
340  ss << " " << p->getHumanName() << ": " << p->getIncludePath() << "\n";
341  }
342  }
343 
344  return ss.str();
345  }
346 
347  VariantInfoPtr VariantInfo::ReadInfoFilesRecursive(const std::string& eventuallyNamespacedPackage, const std::string& rootPackagePath, bool showErrors, VariantInfoPtr variantInfo)
348  {
349  if (!variantInfo)
350  {
351  variantInfo.reset(new VariantInfo());
352  }
353 
354  const std::string cmakePackageName =
355  simox::alg::replace_all(eventuallyNamespacedPackage, "::", "_");
356 
357 
358  auto finder = CMakePackageFinderCache::GlobalCache.findPackage(cmakePackageName, rootPackagePath, false, true);;
359  ARMARX_CHECK_EXPRESSION(finder.packageFound()) << cmakePackageName << " at " << "'" << rootPackagePath << "'\n";
360 
361  std::filesystem::path variantInfoFile(finder.getDataDir().c_str());
362  variantInfoFile /= cmakePackageName;
363  variantInfoFile /= "VariantInfo-" + cmakePackageName + ".xml";
364 
365  if (std::filesystem::exists(variantInfoFile))
366  {
367  if (!variantInfo->isPackageLoaded(cmakePackageName))
368  {
369  try
370  {
371  RapidXmlReaderPtr xmlReader = RapidXmlReader::FromFile(variantInfoFile.string());
372  variantInfo->readVariantInfo(xmlReader, rootPackagePath, cmakePackageName);
373  ARMARX_DEBUG_S << "Read " << variantInfoFile.string();
374  }
375  catch (std::exception& e)
376  {
377  ARMARX_ERROR_S << "Reading " << variantInfoFile.string() << " failed: " << e.what();
378  }
379  }
380  }
381  else if (showErrors)
382  {
383  ARMARX_WARNING_S << "VariantInfo File not found for project " << cmakePackageName << ": " << variantInfoFile.string();
384  }
385 
386  if (finder.packageFound())
387  {
388  auto depPaths = finder.getDependencyPaths();
389 
390  for (auto& depPath : depPaths)
391  {
392  if (variantInfo->getPackagePaths().find(depPath.second) != variantInfo->getPackagePaths().end())
393  {
394  continue;
395  }
396 
397  if (!depPath.first.empty() && !depPath.second.empty())
398  {
399  std::string packagePath;
400 
401  if (!depPath.second.empty() && std::filesystem::exists(depPath.second))
402  {
403  packagePath = depPath.second;
404  }
405 
406  variantInfo = ReadInfoFilesRecursive(depPath.first, packagePath, showErrors, variantInfo);
407  }
408  }
409  }
410 
411  return variantInfo;
412  }
413 
414  VariantInfoPtr VariantInfo::ReadInfoFiles(const std::vector<std::string>& packages, bool showErrors, bool throwOnError)
415  {
416  VariantInfoPtr variantInfo(new VariantInfo());
417 
418  for (std::string package : packages)
419  {
420  auto finder = CMakePackageFinderCache::GlobalCache.findPackage(package);
421  if (throwOnError)
422  {
423  ARMARX_CHECK_EXPRESSION(finder.packageFound()) << package;
424  }
425  std::filesystem::path variantInfoFile(finder.getDataDir().c_str());
426  variantInfoFile /= package;
427  variantInfoFile /= "VariantInfo-" + package + ".xml";
428 
429  if (std::filesystem::exists(variantInfoFile))
430  {
431  try
432  {
433  RapidXmlReaderPtr xmlReader = RapidXmlReader::FromFile(variantInfoFile.string());
434  std::vector<LibEntryPtr> libs = variantInfo->readVariantInfo(xmlReader, finder.getConfigDir(), package);
435  ARMARX_INFO_S << "Read " << variantInfoFile.string();
436  std::stringstream ss;
437  for (LibEntryPtr e : libs)
438  {
439  ss << "Lib " << e->getName() << "\n";
440 
441  for (const VariantEntryPtr& v : e->variants)
442  {
443  ss << " Variant " << v->getHumanName() << ": " << v->dataTypeName << "\n";
444  }
445 
446  for (const ProxyEntryPtr& p : e->getProxies())
447  {
448  ss << " Proxy " << p->getHumanName() << ": " << p->getIncludePath() << "\n";
449  }
450  }
451  ARMARX_DEBUG_S << "VariantInfo for " << package << ":\n" << ss.str();
452  }
453  catch (std::exception& e)
454  {
455  ARMARX_ERROR_S << "Reading " << variantInfoFile.string() << " failed: " << e.what();
456  }
457  }
458  else if (showErrors)
459  {
460  ARMARX_WARNING_S << "VariantInfo File not found for project " << package << ": " << variantInfoFile.string();
461  }
462  }
463 
464  return variantInfo;
465  }
466 
467  DynamicLibraryPtr VariantInfo::loadLibraryOfVariant(std::string variantTypeName) const
468  {
469  DynamicLibraryPtr result(new DynamicLibrary());
470  auto lib = findLibByVariant(variantTypeName);
471  if (!lib)
472  {
473  ARMARX_WARNING << "Could not find lib for variant " << variantTypeName;
474  return DynamicLibraryPtr();
475  }
476  ARMARX_INFO_S << "Loading lib " << lib->getAbsoluteLibPath();
477  result->load(lib->getAbsoluteLibPath());
478  if (result->isLibraryLoaded())
479  {
480  return result;
481  }
482  else
483  {
484  return DynamicLibraryPtr();
485  }
486  }
487 
488 
489 
490 
491  VariantInfo::LibEntry::LibEntry(RapidXmlReaderNode node, const std::string& packageName) :
492  packageName(packageName)
493  {
494  this->name = node.attribute_value("name");
495 
496  for (RapidXmlReaderNode includeNode = node.first_node("VariantFactory"); includeNode.is_valid(); includeNode = includeNode.next_sibling("VariantFactory"))
497  {
498  factoryIncludes.push_back(includeNode.attribute_value("include"));
499  }
500 
501  for (RapidXmlReaderNode variantNode = node.first_node("Variant"); variantNode.is_valid(); variantNode = variantNode.next_sibling("Variant"))
502  {
503  VariantEntryPtr entry(new VariantEntry(variantNode));
504  variants.push_back(entry);
505  }
506 
507  for (RapidXmlReaderNode proxyNode : node.nodes())
508  {
509  if (proxyNode.name() == "Proxy" || proxyNode.name() == "Topic")
510  {
511  ProxyEntryPtr proxy(new ProxyEntry(proxyNode));
512  proxies.push_back(proxy);
513  }
514  }
515  }
516 
517  std::vector<std::string> VariantInfo::LibEntry::getFactoryIncludes() const
518  {
519  return factoryIncludes;
520  }
521 
522  std::vector<std::string> VariantInfo::LibEntry::getVariantIncludes(const std::string& variantBaseTypeName) const
523  {
524  auto it = std::find_if(variants.begin(), variants.end(), [&](const VariantEntryPtr & entry)
525  {
526  return entry->getBaseTypeName() == variantBaseTypeName;
527  });
528  if (it != variants.end() && (*it)->getIncludePath())
529  {
530  return {*(*it)->getIncludePath()};
531  }
532  else
533  {
534  return factoryIncludes;
535  }
536  }
537 
539  {
540  return packageName;
541  }
542 
544  {
546  if (!finder.packageFound())
547  {
548  throw LocalException() << "Could not find package '" << packageName << "'!";
549  }
550  if (finder.getLibraryPaths().empty())
551  {
552  throw LocalException() << "Library path for package '" << packageName << "' is empty!";
553  }
554  std::filesystem::path path = finder.getLibraryPaths();
555  path /= "lib" + getName() + "." + DynamicLibrary::GetSharedLibraryFileExtension();
556  if (!std::filesystem::exists(path))
557  {
558  throw LocalException() << "Library path '" << path.string() << "' does not exist!";
559  }
560  return path.string();
561  }
562 
563  std::string VariantInfo::LibEntry::getName() const
564  {
565  return name;
566  }
567 
568  std::vector<VariantInfo::ProxyEntryPtr> VariantInfo::LibEntry::getProxies() const
569  {
570  return proxies;
571  }
572 
573  const std::vector<VariantInfo::VariantEntryPtr>& VariantInfo::LibEntry::getVariants() const
574  {
575  return variants;
576  }
577 
579  {
580  baseTypeName = node.attribute_value("baseType");
581  dataTypeName = node.attribute_value("dataType");
582  humanName = node.attribute_value("humanName");
583  if (node.has_attribute("include"))
584  {
585  includePath = node.attribute_value("include");
586  }
587  basic = node.attribute_as_optional_bool("basic", "true", "false", false);
588  }
589 
590  const std::string& VariantInfo::VariantEntry::getHumanName() const
591  {
592  return humanName;
593  }
594 
596  {
597  return baseTypeName;
598  }
599 
601  {
602  return dataTypeName;
603  }
604 
605  const std::optional<std::string>& VariantInfo::VariantEntry::getIncludePath() const
606  {
607  return includePath;
608  }
609 
610 
611  void VariantInfo::ProxyEntry::readVector(RapidXmlReaderNode node, const char* name, std::vector<std::string>& vec)
612  {
613  for (RapidXmlReaderNode n : node.nodes(name))
614  {
615  vec.push_back(n.value());
616  }
617  }
618 
620  {
621  includePath = node.attribute_value("include");
622  humanName = node.attribute_value("humanName");
623  typeName = node.attribute_value("typeName");
624  memberName = node.attribute_value("memberName");
625  getterName = node.attribute_value("getterName");
626  propertyName = node.attribute_value("propertyName");
627  propertyIsOptional = node.attribute_as_optional_bool("propertyIsOptional", "true", "false", false);
628  propertyDefaultValue = node.attribute_value_or_default("propertyDefaultValue", "");
629  proxyType = node.name() == "Topic" ? Topic : SingleProxy;
630 
631  readVector(node, "include", includes);
632  readVector(node, "library", libraries);
633  readVector(node, "member", members);
634  readVector(node, "onInit", onInit);
635  readVector(node, "onConnect", onConnect);
636 
637  for (RapidXmlReaderNode n : node.nodes("method"))
638  {
639  methods.push_back(std::make_pair(n.attribute_value("header"), n.value()));
640  }
641 
642  for (RapidXmlReaderNode n : node.nodes("stateMethod"))
643  {
644  stateMethods.push_back(std::make_pair(n.attribute_value("header"), n.value()));
645  }
646  }
647 }
armarx::RapidXmlReaderPtr
std::shared_ptr< RapidXmlReader > RapidXmlReaderPtr
Definition: RapidXmlReader.h:66
armarx::RapidXmlReader::FromFile
static RapidXmlReaderPtr FromFile(const std::string &path)
Definition: RapidXmlReader.h:497
SingleTypeVariantList.h
armarx::VariantInfo::findLibs
std::set< LibEntryPtr > findLibs(const Ice::StringSeq &variantTypeNames, const Ice::StringSeq &proxyTypeNames={}) const
Definition: VariantInfo.cpp:123
armarx::VariantInfo::getDataTypeName
std::string getDataTypeName(std::string variantBaseTypeName)
Definition: VariantInfo.cpp:145
armarx::CMakePackageFinder::packageFound
bool packageFound() const
Returns whether or not this package was found with cmake.
Definition: CMakePackageFinder.cpp:485
armarx::DynamicLibraryPtr
std::shared_ptr< DynamicLibrary > DynamicLibraryPtr
Definition: DynamicLibrary.h:123
armarx::VariantInfo::loadLibraryOfVariant
armarx::DynamicLibraryPtr loadLibraryOfVariant(std::string variantTypeName) const
Definition: VariantInfo.cpp:467
armarx::VariantInfo::getNestedBaseNameFromHumanName
std::string getNestedBaseNameFromHumanName(std::string humanName)
Definition: VariantInfo.cpp:273
VariantContainer.h
DynamicLibrary.h
armarx::CMakePackageFinderCache::findPackage
const CMakePackageFinder & findPackage(const std::string &packageName, const std::filesystem::path &packagePath="", bool suppressStdErr=false, bool usePackagePathOnlyAsHint=false)
Definition: CMakePackageFinderCache.cpp:20
armarx::RapidXmlReaderNode::attribute_as_optional_bool
bool attribute_as_optional_bool(const char *name, const std::string &trueValue, const std::string &falseValue, bool defaultValue) const
Definition: RapidXmlReader.h:256
armarx::RapidXmlReaderNode::attribute_value
std::string attribute_value(const char *attrName) const
Definition: RapidXmlReader.h:198
armarx::CMakePackageFinder
The CMakePackageFinder class provides an interface to the CMake Package finder capabilities.
Definition: CMakePackageFinder.h:53
armarx::VariantInfo::ProxyEntry
Definition: VariantInfo.h:73
armarx::CMakePackageFinder::getLibraryPaths
std::string getLibraryPaths() const
Returns the library paths seperated by semi-colons.
Definition: CMakePackageFinder.h:128
armarx::VariantInfo::getReturnTypeName
std::string getReturnTypeName(std::string variantBaseTypeName)
Definition: VariantInfo.cpp:159
armarx::VariantInfo::LibEntry::LibEntry
LibEntry(RapidXmlReaderNode node, const std::string &packageName)
Definition: VariantInfo.cpp:491
armarx::VariantInfo::LibEntry::getProxies
std::vector< ProxyEntryPtr > getProxies() const
Definition: VariantInfo.cpp:568
armarx::DynamicLibrary::GetSharedLibraryFileExtension
static std::string GetSharedLibraryFileExtension()
Definition: DynamicLibrary.cpp:157
armarx::VariantInfo::LibEntry::getName
std::string getName() const
Definition: VariantInfo.cpp:563
armarx::VariantInfo::isBasic
bool isBasic(std::string variantBaseTypeName)
Definition: VariantInfo.cpp:176
armarx::VariantInfo::VariantEntryPtr
std::shared_ptr< VariantEntry > VariantEntryPtr
Definition: VariantInfo.h:48
armarx::VariantInfo::findLibNames
Ice::StringSeq findLibNames(const Ice::StringSeq &variantTypeNames, const Ice::StringSeq &proxyTypeNames={}) const
Definition: VariantInfo.cpp:110
armarx::VariantInfo::LibEntry::getAbsoluteLibPath
std::string getAbsoluteLibPath() const
Definition: VariantInfo.cpp:543
armarx::VariantInfo::SingleProxy
@ SingleProxy
Definition: VariantInfo.h:68
armarx::RapidXmlReaderNode::has_attribute
bool has_attribute(const char *attrName) const
Definition: RapidXmlReader.h:209
armarx::VariantInfo::VariantEntry::getBaseTypeName
const std::string & getBaseTypeName() const
Definition: VariantInfo.cpp:595
armarx::RapidXmlReaderNode::name
std::string name() const
Definition: RapidXmlReader.h:349
StringValueMap.h
armarx::VariantInfo::getDebugInfo
std::string getDebugInfo() const
Definition: VariantInfo.cpp:325
armarx::VariantInfo::isPackageLoaded
bool isPackageLoaded(const std::string packageName) const
Definition: VariantInfo.cpp:313
ARMARX_DEBUG_S
#define ARMARX_DEBUG_S
Definition: Logging.h:198
armarx::VariantInfo::VariantInfo
VariantInfo()
Definition: VariantInfo.cpp:43
armarx::VariantInfo::ReadInfoFilesRecursive
static VariantInfoPtr ReadInfoFilesRecursive(const std::string &rootPackageName, const std::string &rootPackagePath, bool showErrors, VariantInfoPtr variantInfo=VariantInfoPtr())
Definition: VariantInfo.cpp:347
ARMARX_ERROR_S
#define ARMARX_ERROR_S
Definition: Logging.h:209
armarx::VariantInfo::VariantEntry::getIncludePath
const std::optional< std::string > & getIncludePath() const
Definition: VariantInfo.cpp:605
armarx::VariantInfo::ProxyEntryPtr
std::shared_ptr< ProxyEntry > ProxyEntryPtr
Definition: VariantInfo.h:71
armarx::VariantInfo::LibEntry::getPackageName
std::string getPackageName() const
Definition: VariantInfo.cpp:538
armarx::VariantInfo::Topic
@ Topic
Definition: VariantInfo.h:68
armarx::VariantInfo::VariantEntry::getHumanName
const std::string & getHumanName() const
Definition: VariantInfo.cpp:590
armarx::RapidXmlReaderNode
Definition: RapidXmlReader.h:68
armarx::VariantInfo::getPackagePaths
const std::map< std::string, std::string > & getPackagePaths() const
Definition: VariantInfo.cpp:308
armarx::VariantInfo::LibEntry::getVariants
const std::vector< VariantEntryPtr > & getVariants() const
Definition: VariantInfo.cpp:573
ARMARX_WARNING_S
#define ARMARX_WARNING_S
Definition: Logging.h:206
armarx::VariantInfo::ReadInfoFiles
static VariantInfoPtr ReadInfoFiles(const std::vector< std::string > &packages, bool showErrors=true, bool throwOnError=true)
Definition: VariantInfo.cpp:414
armarx::VariantInfo::LibEntry
Definition: VariantInfo.h:174
armarx::VariantInfo::getProxyEntry
ProxyEntryPtr getProxyEntry(std::string proxyId)
Definition: VariantInfo.cpp:196
ExpressionException.h
CMakePackageFinder.h
CMakePackageFinderCache.h
armarx::ctrlutil::v
double v(double t, double v0, double a0, double j)
Definition: CtrlUtil.h:39
ARMARX_CHECK_EXPRESSION
#define ARMARX_CHECK_EXPRESSION(expression)
This macro evaluates the expression and if it turns out to be false it will throw an ExpressionExcept...
Definition: ExpressionException.h:73
armarx::VariantInfo::getVariantByHumanName
VariantEntryPtr getVariantByHumanName(std::string humanName)
Definition: VariantInfo.cpp:224
armarx::VariantInfo::ProxyEntry::ProxyEntry
ProxyEntry(RapidXmlReaderNode node)
Definition: VariantInfo.cpp:619
armarx::VariantInfoPtr
std::shared_ptr< VariantInfo > VariantInfoPtr
Definition: VariantInfo.h:39
armarx::RapidXmlReaderNode::nodes
std::vector< RapidXmlReaderNode > nodes(const char *name=nullptr) const
Definition: RapidXmlReader.h:158
armarx::VariantInfo::LibEntry::getVariantIncludes
std::vector< std::string > getVariantIncludes(const std::string &variantBaseTypeName) const
Returns a list of includes for a specific variant (usually only one).
Definition: VariantInfo.cpp:522
armarx::CMakePackageFinderCache::GlobalCache
static CMakePackageFinderCache GlobalCache
Definition: CMakePackageFinderCache.h:19
armarx::RapidXmlReaderNode::is_valid
bool is_valid() const
Definition: RapidXmlReader.h:392
armarx::VariantInfo::readVariantInfo
std::vector< LibEntryPtr > readVariantInfo(RapidXmlReaderPtr reader, const std::string &packagePath, const std::string &packageName)
Definition: VariantInfo.cpp:47
armarx::VariantInfo::LibEntry::getFactoryIncludes
std::vector< std::string > getFactoryIncludes() const
Definition: VariantInfo.cpp:517
ARMARX_INFO_S
#define ARMARX_INFO_S
Definition: Logging.h:195
armarx::DynamicLibrary
The DynamicLibrary class provides a mechanism to load libraries at runtime.
Definition: DynamicLibrary.h:49
armarx::VariantInfo::VariantEntry::VariantEntry
VariantEntry(RapidXmlReaderNode node)
Definition: VariantInfo.cpp:578
Logging.h
armarx::VariantInfo::getLibs
std::vector< LibEntryPtr > getLibs() const
Definition: VariantInfo.cpp:191
ARMARX_WARNING
#define ARMARX_WARNING
Definition: Logging.h:186
armarx::VariantInfo::findLibByVariant
LibEntryPtr findLibByVariant(std::string variantTypeName) const
Definition: VariantInfo.cpp:79
armarx::RapidXmlReaderNode::first_node
RapidXmlReaderNode first_node(const char *name=nullptr) const
Definition: RapidXmlReader.h:140
armarx::VariantInfo::LibEntryPtr
std::shared_ptr< LibEntry > LibEntryPtr
Definition: VariantInfo.h:172
armarx::VariantInfo::VariantEntry
Definition: VariantInfo.h:50
armarx::VariantInfo::getNestedHumanNameFromBaseName
std::string getNestedHumanNameFromBaseName(std::string variantBaseTypeName)
Definition: VariantInfo.cpp:238
armarx::VariantContainerType::FromString
static ContainerTypePtr FromString(const std::string &typeStr)
Definition: VariantContainer.cpp:262
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
armarx::RapidXmlReaderNode::attribute_value_or_default
std::string attribute_value_or_default(const char *attrName, const std::string &defaultValue) const
Definition: RapidXmlReader.h:225
armarx::VariantInfo::getVariantByName
VariantEntryPtr getVariantByName(std::string variantBaseTypeName)
Definition: VariantInfo.cpp:210
armarx::VariantInfo::VariantEntry::getDataTypeName
const std::string & getDataTypeName() const
Definition: VariantInfo.cpp:600
armarx::StringValueMap::getTypePrefix
static std::string getTypePrefix()
Definition: StringValueMap.cpp:179
armarx::SingleTypeVariantList::getTypePrefix
static std::string getTypePrefix()
Definition: SingleTypeVariantList.cpp:201
VariantInfo.h
armarx::VariantInfo::findLibByProxy
LibEntryPtr findLibByProxy(std::string proxyTypeName) const
Definition: VariantInfo.cpp:93