File indexing completed on 2025-01-18 10:17:36
0001
0002
0003
0004
0005 #pragma once
0006
0007 #include <memory>
0008 #include <JANA/JService.h>
0009 #include <JANA/Utils/JProcessorMapping.h>
0010 #include <JANA/Topology/JEventQueue.h>
0011 #include <JANA/Topology/JEventPool.h>
0012
0013 #include <JANA/Services/JParameterManager.h>
0014 #include <JANA/Services/JComponentManager.h>
0015
0016
0017 class JParameterManager;
0018 class JComponentManager;
0019 class JArrow;
0020 class JFoldArrow;
0021 class JUnfoldArrow;
0022
0023 class JTopologyBuilder : public JService {
0024 public:
0025
0026 Service<JParameterManager> m_params {this};
0027 std::shared_ptr<JComponentManager> m_components;
0028
0029
0030 std::vector<JArrow*> arrows;
0031 std::vector<JEventQueue*> queues;
0032 std::vector<JEventPool*> pools;
0033
0034
0035 size_t m_max_inflight_events = 4;
0036 size_t m_location_count = 1;
0037 bool m_enable_stealing = false;
0038 int m_affinity = 0;
0039 int m_locality = 0;
0040
0041
0042 std::function<void(JTopologyBuilder&)> m_configure_topology;
0043 JProcessorMapping mapping;
0044
0045 public:
0046
0047 JTopologyBuilder();
0048 ~JTopologyBuilder() override;
0049
0050 void acquire_services(JServiceLocator *sl) override;
0051
0052
0053
0054
0055
0056 void set_configure_fn(std::function<void(JTopologyBuilder&)> configure_fn);
0057
0058 void create_topology();
0059
0060 void attach_level(JEventLevel current_level, JUnfoldArrow* parent_unfolder, JFoldArrow* parent_folder);
0061 void connect_to_first_available(JArrow* upstream, std::vector<JArrow*> downstreams);
0062 void connect(JArrow* upstream, size_t upstream_index, JArrow* downstream, size_t downstream_index);
0063
0064 std::string print_topology();
0065
0066
0067 };
0068
0069