Belle II Software development
gearbox.cc
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8#include <framework/gearbox/Gearbox.h>
9#include <framework/gearbox/GearDir.h>
10
11#include <gtest/gtest.h>
12#include <string>
13#include <queue>
14
15using namespace std;
16using namespace Belle2;
17
18namespace {
19
21 TEST(GearBox, Open)
22 {
24 vector<string> backends;
25 backends.emplace_back("file:");
26 gb.setBackends(backends);
27 gb.open("geometry/SuperKEKB.xml");
28 queue<GearDir> nodes;
29 nodes.push(GearDir());
30 while (!nodes.empty()) {
31 GearDir node = nodes.front();
32 nodes.pop();
33 for (const GearDir& child : node.getNodes("*")) {
34 nodes.push(child);
35 }
36 }
37 gb.close();
38 }
39} // namespace
GearDir is the basic class used for accessing the parameter store.
Definition: GearDir.h:31
Singleton class responsible for loading detector parameters from an XML file.
Definition: Gearbox.h:34
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:21
static Gearbox & getInstance()
Return reference to the Gearbox instance.
Definition: Gearbox.cc:81
void close()
Free internal structures of previously parsed tree and clear cache.
Definition: Gearbox.cc:169
void setBackends(const std::vector< std::string > &backends)
Select the backends to use to find resources.
Definition: Gearbox.cc:99
void open(const std::string &name="Belle2.xml", size_t cacheSize=c_DefaultCacheSize)
Open connection to backend and parse tree.
Definition: Gearbox.cc:133
Abstract base class for different kinds of events.
STL namespace.