void test6(MyContainer& container) { MyTest *a = new MyTest(2,3,1,770,7000); container.insert(a); MyTest *b = new MyTest(2,3,2,880,8000); container.insert(b); MyTest *c = new MyTest(2,3,3,990,9000); container.insert(c); }
void test5(MyContainer& container) { MyTest *a = new MyTest(2,2,1,440,4000); container.insert(a); MyTest *b = new MyTest(2,2,2,550,5000); container.insert(b); MyTest *c = new MyTest(2,2,3,660,6000); container.insert(c); }
void test4(MyContainer& container) { MyTest *a = new MyTest(2,1,1,110,1000); container.insert(a); MyTest *b = new MyTest(2,1,2,220,2000); container.insert(b); MyTest *c = new MyTest(2,1,3,330,3000); container.insert(c); }
void missingsplit_write(const char *filename = "missingsplit.root") { TFile *f = new TFile(filename,"RECREATE"); TTree *tree = new TTree("T","T"); MyContainer cont; cont.Set(3); tree->Branch("cont.",&cont); tree->Fill(); f->Write(); delete f; }
int main() { MyContainer c; MyContainer::index<Tag1>::type& index1 = c.get<Tag1>(); MyContainer::index<Tag2>::type& index2 = c.get<Tag2>(); //! Add some values for (int i = 0; i < 10; ++i) { MyStruct s = { i, i * 2, i * 3 }; c.insert(s); } auto loop = [](const MyStruct& s){ std::cout << "{ " << s.a << ", " << s.b << ", " << s.c << " }" << std::endl; }; // Search in container bool useIndex1 = true; if (useIndex1) { auto range = std::make_pair(index1.begin(), index1.end()); std::for_each(range.first, range.second, loop); } else { auto range = std::make_pair(index1.begin(), index1.end()); std::for_each(range.first, range.second, loop); } // Loop through range //for (auto i = range.first; i != range.second; ++i) // ; IndexedFileInfo c1; std::vector<MLLEntry::LoadableFilePair> fileInfo_03_08_12_23 = { MLLEntry::LoadableFilePair("004.txt", "004.txt"), MLLEntry::LoadableFilePair("005.txt", "005.txt"), MLLEntry::LoadableFilePair("005.txt", "005.txt"), }; // emplace construct MLLEntries for (const auto& next : fileInfo_03_08_12_23) { c1.emplace(MLLEntry::HRQuartet(3, 8, 12, 23), next); } IndexedFileInfo c2(std::move(c1)); IndexedFileInfo::index<composite>::type& index3 = c2.get<composite>(); IndexedFileInfo::index<dirfilter>::type& index4 = c1.get<composite>(); auto range = std::make_pair(index3.begin(), index3.end()); std::copy(range.first, range.second, std::ostream_iterator<MLLEntry>(std::cout, "\n")); auto range1 = std::make_pair(index4.begin(), index4.end()); std::copy(range1.first, range1.second, std::ostream_iterator<MLLEntry>(std::cout, "\n")); return 0; }
int main() { MyContainer mycontainer; test2(mycontainer); test4(mycontainer); test6(mycontainer); test1(mycontainer); test3(mycontainer); test5(mycontainer); mycontainer.print(); cout<<endl; test_find(mycontainer); cout<<endl; mycontainer.free(); return 0; }
void test_find(MyContainer& container) { container.find(MyIndex(1,1,1)); container.find(MyIndex(1,1,2)); container.find(MyIndex(1,1,3)); container.find(MyIndex(1,2,1)); container.find(MyIndex(1,2,2)); container.find(MyIndex(1,2,3)); container.find(MyIndex(1,3,1)); container.find(MyIndex(1,3,2)); container.find(MyIndex(1,3,3)); container.find(MyIndex(2,1,1)); container.find(MyIndex(2,1,2)); container.find(MyIndex(2,1,3)); container.find(MyIndex(2,2,1)); container.find(MyIndex(2,2,2)); container.find(MyIndex(2,2,3)); container.find(MyIndex(2,3,1)); container.find(MyIndex(2,3,2)); container.find(MyIndex(2,3,3)); }