otsdaq  v2_03_00
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 
41  // SETTERs
42  void setSupervisorStatus(xdaq::Application* app, const std::string& status);
43  void setSupervisorStatus(const SupervisorInfo& appInfo, const std::string& status);
44  void setSupervisorStatus(const unsigned int& id, const std::string& status);
45 
46  // GETTERs (so searching and iterating is easier)
47  const std::map<unsigned int, SupervisorInfo>& getAllSupervisorInfo(void) const
48  {
49  return allSupervisorInfo_;
50  }
51  const SupervisorInfoMap& getAllFETypeSupervisorInfo(void) const
52  {
53  return allFETypeSupervisorInfo_;
54  }
55  const SupervisorInfoMap& getAllDMTypeSupervisorInfo(void) const
56  {
57  return allDMTypeSupervisorInfo_;
58  }
59  const SupervisorInfoMap& getAllLogbookTypeSupervisorInfo(void) const
60  {
61  return allLogbookTypeSupervisorInfo_;
62  }
63  const SupervisorInfoMap& getAllMacroMakerTypeSupervisorInfo(void) const
64  {
65  return allMacroMakerTypeSupervisorInfo_;
66  }
67 
68  const SupervisorInfo& getSupervisorInfo(xdaq::Application* app) const;
69  const SupervisorInfo& getGatewayInfo(void) const;
70  XDAQ_CONST_CALL xdaq::ApplicationDescriptor* getGatewayDescriptor(void) const;
71  const SupervisorInfo& getWizardInfo(void) const;
72  XDAQ_CONST_CALL xdaq::ApplicationDescriptor* getWizardDescriptor(void) const;
73 
74  std::vector<std::vector<const SupervisorInfo*>> getOrderedSupervisorDescriptors(
75  const std::string& stateMachineCommand) const;
76 
77  private:
78  SupervisorInfo* theSupervisorInfo_;
79  SupervisorInfo* theWizardInfo_;
80 
81  std::map<unsigned int, SupervisorInfo> allSupervisorInfo_;
82  SupervisorInfoMap allFETypeSupervisorInfo_, allDMTypeSupervisorInfo_,
83  allLogbookTypeSupervisorInfo_, allMacroMakerTypeSupervisorInfo_;
84 };
85 
86 } // namespace ots
87 
88 #endif
void init(xdaq::ApplicationContext *applicationContext)