本文整理汇总了C++中PluginLoader::Destroy方法的典型用法代码示例。如果您正苦于以下问题:C++ PluginLoader::Destroy方法的具体用法?C++ PluginLoader::Destroy怎么用?C++ PluginLoader::Destroy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PluginLoader
的用法示例。
在下文中一共展示了PluginLoader::Destroy方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
vector<PluginBase*> pluginSequence;
vector<string> pluginList = opts.GetOpt<vector<string> >("h4reco.pluginList");
//---plugin creation
pluginLoaders.reserve(pluginList.size());
for(auto& plugin : pluginList)
{
cout << ">>> Loading plugin <" << plugin << ">" << endl;
//---create loader
loader = new PluginLoader<PluginBase>(opts.GetOpt<string>(plugin+".pluginType"));
pluginLoaders.push_back(loader);
pluginLoaders.back()->Create();
//---get instance and put it in the plugin sequence
PluginBase* newPlugin = pluginLoaders.back()->CreateInstance();
if(newPlugin)
{
pluginSequence.push_back(newPlugin);
pluginSequence.back()->SetInstanceName(plugin);
pluginMap[plugin] = pluginSequence.back();
}
else
{
cout << ">>> ERROR: plugin type " << opts.GetOpt<string>(plugin+".pluginType") << " is not defined." << endl;
return 0;
}
}
//---begin
for(auto& plugin : pluginSequence)
{
plugin->Begin(opts, &index);
for(auto& shared : plugin->GetSharedData("", "TTree", true))
{
TTree* tree = (TTree*)shared.obj;
tree->SetMaxVirtualSize(10000);
tree->SetDirectory(outROOT);
}
}
//---events loop
int maxEvents=opts.GetOpt<int>("h4reco.maxEvents");
cout << ">>> Processing H4DAQ run #" << run << " <<<" << endl;
while(h4Tree.NextEntry() && (index-stoul(run)*1e9<maxEvents || maxEvents==-1))
{
if(index % 1000 == 0)
{
cout << ">>>Processed events: " << index-stoul(run)*1e9 << "/"
<< (maxEvents<0 ? h4Tree.GetEntries() : min((int)h4Tree.GetEntries(), maxEvents))
<< endl;
TrackProcess(cpu, mem, vsz, rss);
}
//---call ProcessEvent for each plugin
for(auto& plugin : pluginSequence)
plugin->ProcessEvent(h4Tree, pluginMap, opts);
//---fill the main tree with info variables and increase event counter
mainTree.time_stamp = h4Tree.evtTimeStart;
mainTree.run = h4Tree.runNumber;
mainTree.spill = h4Tree.spillNumber;
mainTree.event = h4Tree.evtNumber;
mainTree.Fill();
++index;
}
//---end
for(auto& plugin : pluginSequence)
{
//---call endjob for each plugin
plugin->End(opts);
//---get permanent data from each plugin and store them in the out file
for(auto& shared : plugin->GetSharedData())
{
if(shared.obj->IsA()->GetName() == string("TTree"))
{
TTree* currentTree = (TTree*)shared.obj;
outROOT->cd();
currentTree->BuildIndex("index");
currentTree->Write(currentTree->GetName(), TObject::kOverwrite);
mainTree.AddFriend(currentTree->GetName());
}
else
{
outROOT->cd();
shared.obj->Write(shared.tag.c_str(), TObject::kOverwrite);
}
}
}
//---close
mainTree.Write();
opts.Write("cfg");
outROOT->Close();
for(auto& loader : pluginLoaders)
loader->Destroy();
//---info
TrackProcess(cpu, mem, vsz, rss);
exit(0);
}