otsdaq  v2_05_02_indev
AllSupervisorInfo.h
1 #ifndef _ots_AllSupervisorInfo_h
2 #define _ots_AllSupervisorInfo_h
3 
4 #include <map>
5 #include <vector>
6 
7 #include "otsdaq/SupervisorInfo/SupervisorDescriptorInfoBase.h"
8 #include "otsdaq/SupervisorInfo/SupervisorInfo.h"
9 
10 // clang-format off
11 namespace ots
12 {
14 typedef std::map<unsigned int, const SupervisorInfo&> SupervisorInfoMap;
15 
17 // AllSupervisorInfo
18 // xdaq Supervisors can use this class to gain access to
19 // info for all supervisors in the xdaq Context. Supervisors
20 // are organized by type/class. Note that if a supervisor is
21 // encountered in the xdaq context that is of unknown type, then
22 // it is ignored and not organized.
23 //
24 // Supervisors should call init to setup data members of this class.
25 //
26 // This class, when in normal mode, also interprets the active configuration
27 // to associate configuration UID/names to the supervisors in the xdaq context.
28 // In wizard mode, UID/name is taken from class name.
30 {
31  public:
32  AllSupervisorInfo(void);
33  AllSupervisorInfo(xdaq::ApplicationContext* applicationContext);
34  ~AllSupervisorInfo(void);
35 
36  void init(xdaq::ApplicationContext* applicationContext);
37  void destroy(void);
38 
39  // BOOLs
40  bool isWizardMode(void) const { return theWizardInfo_ ? true : false; }
41  bool isMacroMakerMode(void) const { return AllSupervisorInfo::MACROMAKER_MODE; }
42 
43  // SETTERs
44  void setSupervisorStatus(xdaq::Application* app, const std::string& status, const unsigned int progress = 100, const std::string& detail = "");
45  void setSupervisorStatus(const SupervisorInfo& appInfo, const std::string& status, const unsigned int progress = 100, const std::string& detail = "");
46  void setSupervisorStatus(const unsigned int& id, const std::string& status, const unsigned int progress = 100, const std::string& detail = "");
47 
48  // GETTERs (so searching and iterating is easier)
49  const std::map<unsigned int /* lid */, SupervisorInfo>& getAllSupervisorInfo(void) const { return allSupervisorInfo_; }
50  const SupervisorInfoMap& getAllFETypeSupervisorInfo(void) const { return allFETypeSupervisorInfo_; }
51  const SupervisorInfoMap& getAllDMTypeSupervisorInfo(void) const { return allDMTypeSupervisorInfo_; }
52  const SupervisorInfoMap& getAllLogbookTypeSupervisorInfo(void) const { return allLogbookTypeSupervisorInfo_; }
53  const SupervisorInfoMap& getAllMacroMakerTypeSupervisorInfo(void) const { return allMacroMakerTypeSupervisorInfo_; }
54 
55  const SupervisorInfo& getSupervisorInfo(xdaq::Application* app) const;
56  const SupervisorInfo& getGatewayInfo(void) const;
57  XDAQ_CONST_CALL xdaq::ApplicationDescriptor* getGatewayDescriptor(void) const;
58  const SupervisorInfo& getWizardInfo(void) const;
59  XDAQ_CONST_CALL xdaq::ApplicationDescriptor* getWizardDescriptor(void) const;
60 
61  std::vector<std::vector<const SupervisorInfo*>> getOrderedSupervisorDescriptors(const std::string& stateMachineCommand) const;
62 
63  private:
64  SupervisorInfo* theSupervisorInfo_;
65  SupervisorInfo* theWizardInfo_;
66 
67  std::map<unsigned int /* lid */, SupervisorInfo> allSupervisorInfo_;
68  SupervisorInfoMap allFETypeSupervisorInfo_, allDMTypeSupervisorInfo_, allLogbookTypeSupervisorInfo_, allMacroMakerTypeSupervisorInfo_;
69 
70  static const bool MACROMAKER_MODE;
71 };
72 
73 // clang-format off
74 
75 } // namespace ots
76 
77 #endif