PothosUtilPluginTree.cpp 820 B

123456789101112131415161718192021222324252627282930
  1. // Copyright (c) 2013-2015 Josh Blum
  2. // SPDX-License-Identifier: BSL-1.0
  3. #include "PothosUtil.hpp"
  4. #include <Pothos/Plugin.hpp>
  5. #include <iostream>
  6. static void printPluginTreeR(const Pothos::PluginPath &path)
  7. {
  8. Pothos::Plugin plugin(path);
  9. if (not Pothos::PluginRegistry::empty(path))
  10. {
  11. plugin = Pothos::PluginRegistry::get(path);
  12. }
  13. std::cout << plugin.toString() << std::endl;
  14. //iterate on the subtree stuff
  15. auto nodes = Pothos::PluginRegistry::list(path);
  16. for (auto it = nodes.begin(); it != nodes.end(); it++)
  17. {
  18. printPluginTreeR(path.join(*it));
  19. }
  20. }
  21. void PothosUtilBase::printPluginTree(const std::string &, const std::string &pluginPath)
  22. {
  23. Pothos::ScopedInit init;
  24. printPluginTreeR(pluginPath.empty()?"/":pluginPath);
  25. std::cout << std::endl;
  26. }