Belle II Software  release-05-01-25
gearbox.cc
1 #include <framework/gearbox/Gearbox.h>
2 #include <framework/gearbox/GearDir.h>
3 
4 #include <gtest/gtest.h>
5 #include <string>
6 #include <queue>
7 
8 using namespace std;
9 using namespace Belle2;
10 
11 namespace {
12 
14  TEST(GearBox, Open)
15  {
16  Gearbox& gb = Gearbox::getInstance();
17  vector<string> backends;
18  backends.emplace_back("file:");
19  gb.setBackends(backends);
20  gb.open("geometry/SuperKEKB.xml");
21  queue<GearDir> nodes;
22  nodes.push(GearDir());
23  while (!nodes.empty()) {
24  GearDir node = nodes.front();
25  nodes.pop();
26  for (const GearDir& child : node.getNodes("*")) {
27  nodes.push(child);
28  }
29  }
30  gb.close();
31  }
32 } // namespace
Belle2::Gearbox::close
void close()
Free internal structures of previously parsed tree and clear cache.
Definition: Gearbox.cc:162
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::Gearbox
Singleton class responsible for loading detector parameters from an XML file.
Definition: Gearbox.h:44
Belle2::GearDir
GearDir is the basic class used for accessing the parameter store.
Definition: GearDir.h:41
Belle2::TEST
TEST(TestgetDetectorRegion, TestgetDetectorRegion)
Test Constructors.
Definition: utilityFunctions.cc:18
Belle2::Gearbox::open
void open(const std::string &name="Belle2.xml", size_t cacheSize=c_DefaultCacheSize)
Open connection to backend and parse tree.
Definition: Gearbox.cc:126
Belle2::gearbox::Interface::getNodes
std::vector< GearDir > getNodes(const std::string &path="") const
Get vector of GearDirs which point to all the nodes the given path evaluates to.
Definition: Interface.cc:31
Belle2::Gearbox::setBackends
void setBackends(const std::vector< std::string > &backends)
Select the backends to use to find resources.
Definition: Gearbox.cc:92