Line data Source code
1 : #ifndef artdaq_Application_MPI2_RoutingManagerApp_hh
2 : #define artdaq_Application_MPI2_RoutingManagerApp_hh
3 :
4 : #include "artdaq/Application/Commandable.hh"
5 : #include "artdaq/Application/RoutingManagerCore.hh"
6 :
7 : #include <boost/thread.hpp>
8 :
9 : #include <memory>
10 :
11 : namespace artdaq {
12 : class RoutingManagerApp;
13 : }
14 :
15 : /**
16 : * \brief RoutingManagerApp is an artdaq::Commandable derived class which controls the RoutingManagerCore state machine
17 : */
18 : class artdaq::RoutingManagerApp : public artdaq::Commandable
19 : {
20 : public:
21 : /**
22 : * \brief RoutingManagerApp Constructor
23 : */
24 : RoutingManagerApp();
25 :
26 : /**
27 : * \brief Copy Constructor is deleted
28 : */
29 : RoutingManagerApp(RoutingManagerApp const&) = delete;
30 :
31 : /**
32 : * \brief Default Destructor
33 : */
34 0 : virtual ~RoutingManagerApp() = default;
35 :
36 : /**
37 : * \brief Copy Assignment Operator is deleted
38 : * \return RoutingManagerApp copy
39 : */
40 : RoutingManagerApp& operator=(RoutingManagerApp const&) = delete;
41 : RoutingManagerApp(RoutingManagerApp&&) = delete; ///< Move Constructor is deleted
42 : RoutingManagerApp& operator=(RoutingManagerApp&&) = delete; ///< Move Assignment Operator is deleted
43 :
44 : // these methods provide the operations that are used by the state machine
45 : /**
46 : * \brief Initialize the RoutingManagerCore
47 : * \param pset ParameterSet used to configure the RoutingManagerCore
48 : * \param timeout Timeout for transition
49 : * \param timestamp Timestamp of transition
50 : * \return Whether the transition succeeded
51 : */
52 : bool do_initialize(fhicl::ParameterSet const& pset, uint64_t timeout, uint64_t timestamp) override;
53 :
54 : /**
55 : * \brief Start the RoutingManagerCore
56 : * \param id Run ID of new run
57 : * \param timeout Timeout for transition
58 : * \param timestamp Timestamp of transition
59 : * \return Whether the transition succeeded
60 : */
61 : bool do_start(art::RunID id, uint64_t timeout, uint64_t timestamp) override;
62 :
63 : /**
64 : * \brief Stop the RoutingManagerCore
65 : * \param timeout Timeout for transition
66 : * \param timestamp Timestamp of transition
67 : * \return Whether the transition succeeded
68 : */
69 : bool do_stop(uint64_t timeout, uint64_t timestamp) override;
70 :
71 : /**
72 : * \brief Pause the RoutingManagerCore
73 : * \param timeout Timeout for transition
74 : * \param timestamp Timestamp of transition
75 : * \return Whether the transition succeeded
76 : */
77 : bool do_pause(uint64_t timeout, uint64_t timestamp) override;
78 :
79 : /**
80 : * \brief Resume the RoutingManagerCore
81 : * \param timeout Timeout for transition
82 : * \param timestamp Timestamp of transition
83 : * \return Whether the transition succeeded
84 : */
85 : bool do_resume(uint64_t timeout, uint64_t timestamp) override;
86 :
87 : /**
88 : * \brief Shutdown the RoutingManagerCore
89 : * \param timeout Timeout for transition
90 : * \return Whether the transition succeeded
91 : */
92 : bool do_shutdown(uint64_t timeout) override;
93 :
94 : /**
95 : * \brief Soft-Initialize the RoutingManagerCore
96 : * \param pset ParameterSet used to configure the RoutingManagerCore
97 : * \param timeout Timeout for transition
98 : * \param timestamp Timestamp of transition
99 : * \return Whether the transition succeeded
100 : */
101 : bool do_soft_initialize(fhicl::ParameterSet const& pset, uint64_t timeout, uint64_t timestamp) override;
102 :
103 : /**
104 : * \brief Reinitialize the RoutingManagerCore
105 : * \param pset ParameterSet used to configure the RoutingManagerCore
106 : * \param timeout Timeout for transition
107 : * \param timestamp Timestamp of transition
108 : * \return Whether the transition succeeded
109 : */
110 : bool do_reinitialize(fhicl::ParameterSet const& pset, uint64_t timeout, uint64_t timestamp) override;
111 :
112 : /**
113 : * \brief Action taken upon entering the "Booted" state
114 : *
115 : * This resets the RoutingManagerCore pointer
116 : */
117 : void BootedEnter() override;
118 :
119 : /* Report_ptr */
120 : /**
121 : * \brief If which is "transition_status", report the status of the last transition. Otherwise pass through to AggregatorCore
122 : * \param which What to report on
123 : * \return Report string. Empty for unknown "which" parameter
124 : */
125 : std::string report(std::string const&) const override;
126 :
127 : private:
128 : std::unique_ptr<artdaq::RoutingManagerCore> routing_manager_ptr_;
129 : boost::thread routing_manager_thread_;
130 : };
131 :
132 : #endif /* artdaq_Application_MPI2_RoutingManagerApp_hh */
|