8 #include <framework/datastore/SelectSubset.h>
9 #include <framework/datastore/StoreArray.h>
10 #include <framework/datastore/RelationsObject.h>
11 #include <framework/datastore/RelationArray.h>
14 #include <gtest/gtest.h>
21 #include <unordered_map>
30 class SelectSubsetTest :
public ::testing::Test {
34 using KeyElementType = UInt_t;
38 static bool SelectionCriterium(
const KeyElementType a)
42 return (a % 2) != 0 && (a % 3) != 0 && (a % 5) != 0 && (a % 7) != 0 &&
43 (a % 11) != 0 && (a % 13) != 0 && (a % 17) != 0 && (a % 19) != 0 && (a % 23) != 0 &&
44 (a % 29) != 0 && (a % 31) != 0 ;
47 static bool SelectionCriteriumOnElement(
const StoredElement* a)
49 return SelectionCriterium(a->GetUniqueID());
55 using FromTargetElementsToWeight = map< KeyElementType, double >;
68 using FromStringToArrows = unordered_map< string, FromTargetElementsToWeight >;
71 KeyElementType m_fromElement;
72 FromStringToArrows m_allRelations;
77 explicit Relations(
const KeyElementType& from):
82 const FromStringToArrows&
83 getConstSetOfAllRelations()
const
85 return m_allRelations;
88 FromStringToArrows::const_iterator
89 getConstSetOfToRelations(
const string& toSetName)
const
91 return m_allRelations.find(toSetName) ;
95 FromStringToArrows::iterator
96 getSetOfToRelations(
const string& toSetName)
98 return m_allRelations.find(toSetName) ;
101 FromStringToArrows::const_iterator
102 getSetOfToRelations(
const string& toSetName)
const
104 return m_allRelations.find(toSetName) ;
111 cout <<
"From KeyElement " << m_fromElement <<
"to:" << endl;
112 for (
const auto& toSet : m_allRelations) {
113 for (
auto pair : toSet.second)
115 << toSet.first <<
" "
117 <<
" ( " << pair.second <<
" ) " << endl;
119 cout <<
"-----------------------------------------------------------------" << endl;
124 isPresentRelationTo(
const string& toSetName, KeyElementType to)
const
126 auto toRelations = getConstSetOfToRelations(toSetName);
127 if (toRelations == m_allRelations.end())
129 return toRelations->second.find(to) != toRelations->second.end();
133 appendNewRelationTo(
const string& toName, KeyElementType to,
136 auto toRelations = getSetOfToRelations(toName);
137 if (toRelations == m_allRelations.end()) {
139 m_allRelations.insert(pair <string, FromTargetElementsToWeight>
141 FromTargetElementsToWeight({ {to, weight} })));
144 pair< KeyElementType, double > relation(to, weight);
145 toRelations->second.insert(relation);
149 const FromTargetElementsToWeight&
150 getAllRelations(
const string& toOtherSetName)
const
152 static FromTargetElementsToWeight nothing;
153 auto toRelations = getSetOfToRelations(toOtherSetName);
154 if (toRelations == m_allRelations.end()) {
157 return toRelations->second;
163 #if defined(__INTEL_COMPILER)
164 #pragma warning disable 177
177 map< KeyElementType, Relations > m_set;
188 cout <<
"The NamedSet: " << m_name <<
" contains:" << endl ;
189 for (
auto set : m_set) {
190 cout << set.first << endl;
193 cout <<
"~~~~~~~~~~~~~~~~~~~~~~~" << endl;
197 explicit NamedSet(
const string& name =
"") :
198 m_name(name), m_storeArray(name) {}
201 bool operator()(
const NamedSet& a,
const NamedSet& b)
const
203 return a.getName() < b.getName();
207 [[nodiscard]]
const string getName()
const
218 void initializeDatastore()
222 DataStore::Instance().setInitializeActive(
true);
225 array.registerInDataStore();
226 array.registerRelationTo(array);
228 DataStore::Instance().setInitializeActive(
false);
231 void initializeDatastore(
const string& SetName)
237 DataStore::Instance().setInitializeActive(
true);
241 array.registerInDataStore();
242 array.registerRelationTo(otherSet);
243 otherSet.registerRelationTo(array);
246 DataStore::Instance().setInitializeActive(
false);
262 void appendNewElement(KeyElementType element)
264 m_set.insert(pair< KeyElementType, Relations > (element, Relations(element)));
267 void appendNewRelationTo(KeyElementType fromKey,
const string& toName, KeyElementType toKey,
270 auto fromElement = m_set.find(fromKey);
271 if (fromElement == m_set.end()) {
272 cout <<
"??" << endl;
275 fromElement->second.appendNewRelationTo(toName, toKey, weight);
278 [[nodiscard]]
bool isPresentRelationFromTo(
const KeyElementType& fromKey,
const string& otherSetName,
279 const KeyElementType& toKey)
const
281 auto fromElement = m_set.find(fromKey);
282 if (fromElement != m_set.end()) {
283 return fromElement->second.isPresentRelationTo(otherSetName, toKey);
285 cout <<
"Error: from: " << getName() <<
" id " << fromKey <<
286 " -> " << otherSetName <<
" id " << toKey << endl;
287 for (
const auto& element : m_set)
288 cout << element.first <<
"\t";
290 for (
const auto& element : m_storeArray)
291 cout << element.GetUniqueID() <<
"\t";
297 [[nodiscard]]
const FromTargetElementsToWeight& getAllRelations(
const KeyElementType& fromKey,
const string& toOtherSetName)
const
299 auto fromElement = m_set.find(fromKey);
300 return fromElement->second.getAllRelations(toOtherSetName);
303 using StlRelationArray = map< KeyElementType, FromTargetElementsToWeight >;
305 [[nodiscard]] StlRelationArray getRestrictedDomainRelationTo(
const string& toOtherSetName)
const
307 StlRelationArray theInducedRelation;
308 for (
const auto& element : m_set) {
309 if (SelectionCriterium(element.first) &&
310 element.second.getAllRelations(toOtherSetName).size() != 0)
311 theInducedRelation.insert(pair< KeyElementType, FromTargetElementsToWeight>
312 (element.first, element.second.getAllRelations(toOtherSetName)));
314 return theInducedRelation;
317 [[nodiscard]] StlRelationArray getRestrictedCodomainRelationTo(
const string& setName)
const
319 StlRelationArray theInducedRelation;
320 for (
const auto& element : m_set) {
321 if (element.second.getConstSetOfToRelations(setName) ==
322 element.second.getConstSetOfAllRelations().end())
324 for (
auto image : element.second.getConstSetOfToRelations(setName)->second) {
325 if (SelectionCriterium(image.first)) {
326 if (theInducedRelation.find(element.first) == theInducedRelation.end())
327 theInducedRelation.insert(pair< KeyElementType, FromTargetElementsToWeight>
328 (element.first, FromTargetElementsToWeight()));
329 theInducedRelation.find(element.first)->second.
330 insert(FromTargetElementsToWeight::value_type
331 (image.first, image.second));
335 return theInducedRelation;
338 [[nodiscard]] StlRelationArray getRestrictedSelfRelation()
const
340 StlRelationArray theInducedRelation;
341 for (
const auto& element : m_set) {
342 if (! SelectionCriterium(element.first) ||
343 element.second.getAllRelations(m_name).size() == 0)
345 for (
auto image : element.second.getConstSetOfToRelations(m_name)->second) {
346 if (SelectionCriterium(image.first)) {
347 if (theInducedRelation.find(element.first) == theInducedRelation.end())
348 theInducedRelation.insert(pair< KeyElementType, FromTargetElementsToWeight>
349 (element.first, FromTargetElementsToWeight()));
350 theInducedRelation.find(element.first)->second.
351 insert(FromTargetElementsToWeight::value_type
352 (image.first, image.second));
356 return theInducedRelation;
361 class CollectionOfSets {
371 vector< string > m_otherSetsNames;
372 unordered_map< string, NamedSet > m_otherSets;
376 CollectionOfSets(): m_set(
"theSet"),
377 m_subset(
"theSubset"),
378 m_otherSetsNames {string(
"G"), string(
"F"), string(
"E"),
379 string(
"D"), string(
"C"), string(
"B"), string(
"A")
382 m_setName = m_set.getName();
383 m_subsetName = m_subset.getName();
384 for (
const auto& aSetName : m_otherSetsNames)
385 m_otherSets.insert(pair<string, NamedSet> (aSetName, NamedSet(aSetName)));
398 return m_set.storedArray();
409 getSubsetName()
const
411 return m_subsetName ;
417 return m_subset.storedArray();
423 return m_otherSets.size() ;
426 const vector< string >&
427 getOtherSetsNames()
const
429 return m_otherSetsNames ;
433 getOtherSetsNames(
int i)
const
435 return m_otherSetsNames[i] ;
441 auto otherSet = m_otherSets.find(m_otherSetsNames[ i ]);
442 if (otherSet != m_otherSets.end())
443 return otherSet->second.storedArray();
445 cout <<
" ???????????? " << i << endl;
446 throw std::runtime_error(
"invalid set access");
449 pair< const string, NamedSet>&
450 getOtherNamedSet(
int i)
452 return * m_otherSets.find(m_otherSetsNames[ i ]);
455 unordered_map< string, NamedSet >&
462 initializeDatastore()
466 m_set.initializeDatastore();
468 for (
auto namedSet : m_otherSets)
469 namedSet.second.initializeDatastore(getSetName());
476 unsigned int nElements = 1368;
477 for (
unsigned int i = 0; i < nElements ; i++)
478 appendNewElement(m_set);
482 for (
auto& set : m_otherSets) {
483 unsigned int nOtherElements = nElements - n * 100;
485 for (
unsigned int i = 0; i < nOtherElements ; i++)
486 appendNewElement(set.second);
491 for (
auto& set : m_otherSets) {
494 unsigned int nArrows = nElements * j;
497 for (
unsigned int arrow = 0; arrow < nArrows ; arrow ++) {
498 appendNewRelationToOther(set);
499 appendNewRelationFromOther(set);
505 for (
unsigned int arrow = 0; arrow < 5 * nElements; arrow ++)
506 appendNewSelfRelation();
518 static double counter(0.0);
519 return counter += 1.;
523 flat_random(
unsigned int max)
529 static unsigned int next = 11036;
534 result = (
unsigned int)(next / 65536) % 2048;
539 result ^= (
unsigned int)(next / 65536) % 1024;
544 result ^= (
unsigned int)(next / 65536) % 1024;
551 appendNewElement(NamedSet& namedSet)
555 static int uniqueId(0);
557 namedSet.appendNewElement(uniqueId);
559 set[ i ]->SetUniqueID(uniqueId);
565 appendNewRelationToOther(pair< const string, NamedSet>& set)
568 int from_index = flat_random(getSet().getEntries());
569 KeyElementType from_key = getSet()[from_index]->GetUniqueID();
570 int to_index = flat_random(set.second.storedArray().getEntries());
571 KeyElementType to_key = set.second.storedArray()[to_index]->GetUniqueID();
574 if (getNamedSet().isPresentRelationFromTo(from_key, set.first, to_key))
578 double weight = getWeight();
580 getNamedSet().appendNewRelationTo(from_key, set.first, to_key, weight);
582 RelationArray setToOtherSet(getSet(), set.second.storedArray());
583 setToOtherSet.add(from_index, to_index, weight);
589 appendNewRelationFromOther(pair< const string, NamedSet>& otherSet)
593 unsigned int from_index = flat_random(otherSet.second.storedArray().getEntries());
595 KeyElementType from_key = otherSet.second.storedArray()[from_index]->GetUniqueID();
597 unsigned int to_index = flat_random(getSet().getEntries());
598 KeyElementType to_key = getSet()[to_index]->GetUniqueID();
600 if (otherSet.second.isPresentRelationFromTo(from_key, getSetName(), to_key))
604 double weight = getWeight();
606 otherSet.second.appendNewRelationTo(from_key, getSetName(), to_key, weight);
610 RelationArray otherSetToSet(otherSet.second.storedArray(), getSet());
611 otherSetToSet.add(from_index, to_index, weight);
616 appendNewSelfRelation()
618 unsigned int from_index = flat_random(getSet().getEntries());
619 KeyElementType from_key = getSet()[from_index]->GetUniqueID();
620 unsigned int to_index = flat_random(getSet().getEntries());
621 KeyElementType to_key = getSet()[to_index]->GetUniqueID();
624 if (getNamedSet().isPresentRelationFromTo(from_key, getSetName(), to_key))
627 double weight = getWeight();
629 getNamedSet().appendNewRelationTo(from_key, getSetName(), to_key, weight);
633 setToSet.add(from_index, to_index, weight);
644 CollectionOfSets m_TestBench;
646 void SetUp()
override
651 void TearDown()
override
653 DataStore::Instance().reset();
658 testRelationToOther(pair< const string, NamedSet>& otherSet)
664 otherSet.second.storedArray());
667 NamedSet::StlRelationArray theInducedRelation;
669 for (
int relation = 0 ; relation < subsetToOtherSet.getEntries() ; relation++) {
670 size_t relationSize = subsetToOtherSet[ relation ].getSize();
673 KeyElementType fromElementKey = subset[from]->GetUniqueID();
674 if (theInducedRelation.find(fromElementKey) == theInducedRelation.end())
675 theInducedRelation.insert(pair< KeyElementType, FromTargetElementsToWeight>
676 (fromElementKey, FromTargetElementsToWeight()));
678 for (
unsigned int to_index = 0 ; to_index < relationSize ; to_index++) {
680 double weight = subsetToOtherSet[ relation ].getWeight(to_index);
681 KeyElementType toElementKey = otherSet.second.storedArray()[to]->GetUniqueID();
683 theInducedRelation.find(fromElementKey)->second.insert(pair< KeyElementType, double> (toElementKey, weight));
689 NamedSet::StlRelationArray theExpectedRelation = m_TestBench.getNamedSet().
690 getRestrictedDomainRelationTo(otherSet.first) ;
692 bool OKorKO = equal(theExpectedRelation.begin(), theExpectedRelation.end(), theInducedRelation.begin(),
693 [](
const NamedSet::StlRelationArray::value_type & a,
694 const NamedSet::StlRelationArray::value_type & b) {
696 cout << a.first <<
" vs " << b.first << endl;
698 return a.first == b.first &&
699 equal(a.second.begin(), a.second.end(), b.second.begin(),
700 [](const FromTargetElementsToWeight::value_type & x,
701 const FromTargetElementsToWeight::value_type & y) {
704 << x.first <<
"," << x.second
706 << y.first <<
"," << y.second <<
"\t";
707 cout << (x.first == y.first) <<
" , " << (x.second == y.second) << endl;
709 return x.first == y.first && x.second == y.second;
715 for (
auto relation : theExpectedRelation)
716 for (
auto to : relation.second)
717 cout << relation.first <<
" -> " << to.first <<
" ( " << to.second <<
" )" << endl;
719 for (
auto relation : theInducedRelation)
720 for (
auto to : relation.second)
721 cout << relation.first <<
" --> " << to.first <<
" ( " << to.second <<
" )" << endl;
729 testRelationFromOther(pair< const string, NamedSet>& otherNamedSet)
736 RelationArray subsetFromOtherSet(otherNamedSet.second.storedArray(), subset);
739 NamedSet::StlRelationArray theInducedRelation;
741 for (
int relation = 0 ; relation < subsetFromOtherSet.getEntries() ; relation++) {
742 size_t relationSize = subsetFromOtherSet[ relation ].getSize();
744 KeyElementType fromElementKey = other[from]->GetUniqueID();
745 if (theInducedRelation.find(fromElementKey) == theInducedRelation.end()) {
746 theInducedRelation.insert(pair< KeyElementType, FromTargetElementsToWeight>
747 (fromElementKey, FromTargetElementsToWeight()));
750 for (
unsigned int to_index = 0 ; to_index < relationSize ; to_index++) {
752 subsetFromOtherSet[ relation ].getToIndex(to_index);
753 double weight = subsetFromOtherSet[ relation ].getWeight(to_index);
754 KeyElementType toElementKey = subset[to]->GetUniqueID();
756 theInducedRelation.find(fromElementKey)->second.insert(pair< KeyElementType, double> (toElementKey, weight));
762 NamedSet::StlRelationArray theExpectedRelation
763 = otherNamedSet.second.getRestrictedCodomainRelationTo(m_TestBench.getSetName());
764 bool OKorKO = equal(theExpectedRelation.begin(), theExpectedRelation.end(), theInducedRelation.begin(),
765 [](
const NamedSet::StlRelationArray::value_type & a,
766 const NamedSet::StlRelationArray::value_type & b) {
768 cout << a.first <<
" vs " << b.first << endl;
770 return a.first == b.first &&
771 equal(a.second.begin(), a.second.end(), b.second.begin(),
772 [](const FromTargetElementsToWeight::value_type & x,
773 const FromTargetElementsToWeight::value_type & y) {
776 << x.first <<
"," << x.second
778 << y.first <<
"," << y.second <<
"\t";
779 cout << (x.first == y.first) <<
" , " << (x.second == y.second) << endl;
781 return x.first == y.first && x.second == y.second;
787 for (
auto relation : theExpectedRelation)
788 for (
auto to : relation.second)
789 cout << relation.first <<
" -> " << to.first <<
" ( " << to.second <<
" )" << endl;
791 for (
auto relation : theInducedRelation)
792 for (
auto to : relation.second)
793 cout << relation.first <<
" --> " << to.first <<
" ( " << to.second <<
" )" << endl;
809 NamedSet::StlRelationArray theInducedRelation;
811 for (
int relation = 0 ; relation < selfRelation.getEntries() ; relation++) {
812 size_t relationSize = selfRelation[ relation ].getSize();
814 KeyElementType fromElementKey = subset[from]->GetUniqueID();
815 if (theInducedRelation.find(fromElementKey) == theInducedRelation.end()) {
816 theInducedRelation.insert(pair< KeyElementType, FromTargetElementsToWeight>
817 (fromElementKey, FromTargetElementsToWeight()));
820 for (
unsigned int to_index = 0 ; to_index < relationSize ; to_index++) {
822 selfRelation[ relation ].getToIndex(to_index);
823 double weight = selfRelation[ relation ].getWeight(to_index);
824 KeyElementType toElementKey = subset[to]->GetUniqueID();
826 theInducedRelation.find(fromElementKey)->second.insert(pair< KeyElementType, double> (toElementKey, weight));
832 NamedSet::StlRelationArray theExpectedRelation = m_TestBench.getNamedSet().
833 getRestrictedSelfRelation();
835 bool OKorKO = equal(theExpectedRelation.begin(), theExpectedRelation.end(), theInducedRelation.begin(),
836 [](
const NamedSet::StlRelationArray::value_type & a,
837 const NamedSet::StlRelationArray::value_type & b) {
840 cout << a.first <<
" vs " << b.first << endl;
842 return (true || a.first == b.first) &&
843 equal(a.second.begin(), a.second.end(), b.second.begin(),
844 [](const FromTargetElementsToWeight::value_type & x,
845 const FromTargetElementsToWeight::value_type & y) {
848 << x.first <<
"," << x.second
850 << y.first <<
"," << y.second <<
"\t";
851 cout << (x.first == y.first) <<
" , " << (x.second == y.second) << endl;
853 return x.first == y.first && x.second == y.second;
860 cout <<
"We do expect the following set of relations" << endl;
861 for (
auto relation : theExpectedRelation)
862 for (
auto to : relation.second)
863 cout << relation.first <<
" -> " << to.first <<
" ( " << to.second <<
" )" << endl;
865 cout <<
"We found the following ones" << endl;
866 for (
auto relation : theInducedRelation)
867 for (
auto to : relation.second)
868 cout << relation.first <<
" --> " << to.first <<
" ( " << to.second <<
" )" << endl;
881 TEST_F(SelectSubsetTest, ExtensiveTest)
883 m_TestBench.initializeDatastore();
884 m_TestBench.populateDatastore();
889 DataStore::Instance().setInitializeActive(
true);
893 for (
auto other : m_TestBench.getOtherSets()) {
901 DataStore::Instance().setInitializeActive(
false);
903 selector.
select(SelectionCriteriumOnElement);
907 bool allSubsetElementsAreGood(
true);
912 for (
const auto& element : subset) {
913 if (! SelectionCriteriumOnElement(& element))
914 allSubsetElementsAreGood =
false;
919 EXPECT_TRUE(allSubsetElementsAreGood);
925 for (
const auto& element : set)
926 NSelected += SelectionCriteriumOnElement(&element) ? 1 : 0;
928 EXPECT_TRUE(NSelected == subset.getEntries());
932 EXPECT_TRUE(testSelfRelation());
934 for (
int i = 0 ; i < m_TestBench.getNSets(); i++) {
936 auto otherSet = m_TestBench.getOtherNamedSet(i);
937 EXPECT_TRUE(testRelationToOther(otherSet));
938 EXPECT_TRUE(testRelationFromOther(otherSet));
945 return (a->getArrayIndex() % 2) == 1;
948 TEST_F(SelectSubsetTest, TestWithManyRelations)
953 DataStore::Instance().setInitializeActive(
true);
957 arrayMain.registerInDataStore();
958 arrayA.registerInDataStore();
959 arrayB.registerInDataStore();
960 arrayA.registerRelationTo(arrayMain);
961 arrayMain.registerRelationTo(arrayB);
970 DataStore::Instance().setInitializeActive(
false);
973 for (
int i = 0; i < 10; i++) {
974 auto* mainObj = arrayMain.appendNew();
975 for (
int j = 0; j < 2; j++) {
976 auto* aObj = arrayA.appendNew();
977 aObj->addRelationTo(mainObj);
979 for (
int j = 0; j < 10; j++) {
980 auto* bObj = arrayB.appendNew();
981 mainObj->addRelationTo(bObj);
986 selectorMain.
select(hasOddIndex);
990 EXPECT_EQ(10, arrayMain.getEntries());
991 EXPECT_EQ(20, arrayA.getEntries());
992 EXPECT_EQ(100, arrayB.getEntries());
998 EXPECT_EQ(5, arraySubset.getEntries());
1009 EXPECT_TRUE(hasOddIndex(originalObject));
1013 TEST_F(SelectSubsetTest, InheritAll)
1018 DataStore::Instance().setInitializeActive(
true);
1022 arrayMain.registerInDataStore();
1023 arrayA.registerInDataStore();
1024 arrayB.registerInDataStore();
1025 arrayA.registerRelationTo(arrayMain);
1026 arrayMain.registerRelationTo(arrayB);
1034 DataStore::Instance().setInitializeActive(
false);
1042 TEST_F(SelectSubsetTest, TestExistingSetWithManyRelations)
1047 DataStore::Instance().setInitializeActive(
true);
1051 arrayMain.registerInDataStore();
1052 arrayA.registerInDataStore();
1053 arrayB.registerInDataStore();
1054 arrayA.registerRelationTo(arrayMain);
1055 arrayMain.registerRelationTo(arrayB);
1061 DataStore::Instance().setInitializeActive(
false);
1064 for (
int i = 0; i < 10; i++) {
1065 auto* mainObj = arrayMain.appendNew();
1066 for (
int j = 0; j < 2; j++) {
1067 auto* aObj = arrayA.appendNew();
1068 aObj->addRelationTo(mainObj);
1070 for (
int j = 0; j < 10; j++) {
1071 auto* bObj = arrayB.appendNew();
1072 mainObj->addRelationTo(bObj);
1077 EXPECT_EQ(10, arrayMain.getEntries());
1078 EXPECT_EQ(20, arrayA.getEntries());
1079 EXPECT_EQ(100, arrayB.getEntries());
1082 selectorMain.
select(hasOddIndex);
1086 EXPECT_EQ(5, arrayMain.getEntries());
1096 EXPECT_EQ((i / 2 % 2 == 1) ? 1u : 0u, r.getRelationsTo<
RelationsObject>(
"main").size());
1101 TEST_F(SelectSubsetTest, TestEmptyArray)
1106 DataStore::Instance().setInitializeActive(
true);
1110 arrayMain.registerInDataStore();
1111 arrayA.registerInDataStore();
1112 arrayB.registerInDataStore();
1113 arrayA.registerRelationTo(arrayMain);
1114 arrayMain.registerRelationTo(arrayB);
1120 DataStore::Instance().setInitializeActive(
false);
1123 EXPECT_EQ(0, arrayMain.getEntries());
1124 selectorMain.
select(hasOddIndex);
1125 EXPECT_EQ(0, arrayMain.getEntries());
1128 for (
int i = 0; i < 10; i++) {
1129 auto* mainObj = arrayMain.appendNew();
1130 for (
int j = 0; j < 2; j++) {
1131 auto* aObj = arrayA.appendNew();
1132 aObj->addRelationTo(mainObj);
1134 for (
int j = 0; j < 10; j++) {
1135 auto* bObj = arrayB.appendNew();
1136 mainObj->addRelationTo(bObj);
1141 EXPECT_EQ(10, arrayMain.getEntries());
1142 EXPECT_EQ(20, arrayA.getEntries());
1143 EXPECT_EQ(100, arrayB.getEntries());
1147 selectorMain.
select(never);
1151 EXPECT_EQ(0, arrayMain.getEntries());
Low-level class to create/modify relations between StoreArrays.
unsigned int index_type
type used for indices.
Defines interface for accessing relations of objects in StoreArray.
std::vector< std::string > getInheritToArrays() const
Get list of arrays we inherit relations to.
std::vector< std::string > getInheritFromArrays() const
Get list of arrays we inherit relations from.
bool getInheritToSelf() const
Do we inherit relations from original set to itself?
Class to create a subset of a given StoreArray together with the relations with other StoreArrays.
void inheritRelationsTo(const StoreArray< T > &array, MoreArguments... moreArgs)
Inherit relations pointing from objects selected into this subset to Other.
void inheritRelationsFrom(const StoreArray< T > &array, MoreArguments... moreArgs)
Inherit relations pointing from Other to objects selected into this subset.
void inheritAllRelations()
Automatically inherit all relations to or from the original set (if registered when calling this func...
void registerSubset(const StoreArray< StoredClass > &set, DataStore::EStoreFlags storeFlags=DataStore::c_ErrorIfAlreadyRegistered)
Remove all non-selected objects from set.
Accessor to arrays stored in the data store.
T * appendNew()
Construct a new T object at the end of the array.
int getEntries() const
Get the number of objects in the array.
TEST_F(ChargedParticleIdentificatorTest, TestDBRep)
Test correct storage of weightfiles in the database representation inner structure.
void select(const std::function< bool(const StoredClass *)> &f)
This method is the actual worker.
RelationsInterface< TObject > RelationsObject
Provides interface for getting/adding relations to objects in StoreArrays.
Abstract base class for different kinds of events.