8#include <framework/utilities/Stream.h>
9#include <framework/dataobjects/RelationContainer.h>
10#include <framework/dataobjects/RelationElement.h>
11#include <framework/datastore/DataStore.h>
12#include <framework/gearbox/Gearbox.h>
13#include <framework/gearbox/GearDir.h>
18#include <gtest/gtest.h>
29 relCont->setToName(
"b");
32 TClonesArray& relations = relCont->elements();
34 for (
int i = 0; i < 100; i++)
35 new (relations.AddrAt(relations.GetLast() + 1))
RelationElement(0, i + 1, 42.0);
43 ASSERT_NE(rel,
nullptr);
47 for (
int i = 0; i < 100; i++) {
54 void checkGbContents()
62 checkObject(
dynamic_cast<const RelationContainer*
>(detector.getTObject(
"RelationContainer")));
68 TVector3 v(1.0, 2.0, 3.0);
74 auto* v2 =
dynamic_cast<TVector3*
>(obj);
75 ASSERT_NE(v2,
nullptr);
76 EXPECT_TRUE(*v2 == v);
97 std::string truncated = vStr.substr(0, 12);
99 EXPECT_TRUE(broken_obj ==
nullptr);
103 TEST(StreamTest, GearboxRaw)
106 vector<string> backends;
107 backends.emplace_back(
"file:/framework/tests/");
109 gb.
open(
"object_base64.xml");
@ c_Event
Different object in each event, all objects/arrays are invalidated after event() function has been ca...
GearDir is the basic class used for accessing the parameter store.
Singleton class responsible for loading detector parameters from an XML file.
Class to store relations between StoreArrays in the DataStore.
const std::string & getFromName() const
Get name of the StoreArray we relate from.
const RelationElement & getElement(int i) const
Get reference to RelationElement at index i.
const std::string & getToName() const
Get name of the StoreArray we relate to.
int getEntries() const
Get number of elements.
void setFromName(const std::string &name)
Set name of the StoreArray we relate from.
Class to store a single element of a relation.
index_type getToIndex(size_t n=0) const
Get nth index we point to.
weight_type getWeight(size_t n=0) const
Get nth weight we point to.
static Gearbox & getInstance()
Return reference to the Gearbox instance.
virtual const TObject * getTObject(const std::string &path) const noexcept(false) override
Get the parameter path as a TObject.
void setBackends(const std::vector< std::string > &backends)
Select the backends to use to find resources.
void open(const std::string &name="Belle2.xml", size_t cacheSize=c_DefaultCacheSize)
Open connection to backend and parse tree.
std::string serializeAndEncode(const TObject *obj)
Convert given TObject into encoded byte stream (for storing in XML).
TObject * deserializeEncodedRawData(const std::string &base64Data)
Convert given serialized raw data back into TObject.
Abstract base class for different kinds of events.