File indexing completed on 2025-01-30 10:12:06
0001
0002
0003
0004
0005
0006 #pragma once
0007
0008 #include <JANA/JEvent.h>
0009 #include <JANA/Services/JComponentManager.h>
0010 #include <JANA/Topology/JPool.h>
0011
0012
0013 class JEventPool : public JPool<std::shared_ptr<JEvent>> {
0014
0015 std::shared_ptr<JComponentManager> m_component_manager;
0016 JEventLevel m_level;
0017
0018 public:
0019 inline JEventPool(std::shared_ptr<JComponentManager> component_manager,
0020 size_t pool_size,
0021 size_t location_count,
0022 bool limit_total_events_in_flight,
0023 JEventLevel level = JEventLevel::PhysicsEvent)
0024 : JPool(pool_size, location_count, limit_total_events_in_flight)
0025 , m_component_manager(component_manager)
0026 , m_level(level) {
0027 }
0028
0029 void configure_item(std::shared_ptr<JEvent>* item) override {
0030 (*item) = std::make_shared<JEvent>();
0031 m_component_manager->configure_event(**item);
0032 item->get()->SetLevel(m_level);
0033 }
0034
0035 void release_item(std::shared_ptr<JEvent>* item) override {
0036 if (auto source = (*item)->GetJEventSource()) source->DoFinish(**item);
0037 (*item)->mFactorySet->Release();
0038 (*item)->mInspector.Reset();
0039 (*item)->GetJCallGraphRecorder()->Reset();
0040 (*item)->Reset();
0041 }
0042 };
0043
0044