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