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