otsdaq  v2_01_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/SupervisorInfo.h"
8 #include "otsdaq-core/SupervisorInfo/SupervisorDescriptorInfoBase.h"
9 
10 namespace ots
11 {
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 
32 public:
33  AllSupervisorInfo (void);
34  AllSupervisorInfo (xdaq::ApplicationContext* applicationContext);
35  ~AllSupervisorInfo (void);
36 
37  void init (xdaq::ApplicationContext* applicationContext);
38  void destroy (void);
39 
40  //BOOLs
41  bool isWizardMode (void) const { return theWizardInfo_?true:false; }
42 
43 
44  //SETTERs
45  void setSupervisorStatus (xdaq::Application* app, const std::string& status);
46  void setSupervisorStatus (const SupervisorInfo& appInfo, const std::string& status);
47  void setSupervisorStatus (const unsigned int& id, const std::string& status);
48 
49 
50  //GETTERs (so searching and iterating is easier)
51  const std::map<unsigned int, SupervisorInfo>& getAllSupervisorInfo (void) const { return allSupervisorInfo_; }
52  const SupervisorInfoMap& getAllFETypeSupervisorInfo (void) const { return allFETypeSupervisorInfo_; }
53  const SupervisorInfoMap& getAllDMTypeSupervisorInfo (void) const { return allDMTypeSupervisorInfo_; }
54  const SupervisorInfoMap& getAllLogbookTypeSupervisorInfo (void) const { return allLogbookTypeSupervisorInfo_; }
55 
56  const SupervisorInfo& getSupervisorInfo (xdaq::Application* app) const;
57  const SupervisorInfo& getGatewayInfo (void) const;
58  XDAQ_CONST_CALL xdaq::ApplicationDescriptor* getGatewayDescriptor (void) const;
59  const SupervisorInfo& getWizardInfo (void) const;
60  XDAQ_CONST_CALL xdaq::ApplicationDescriptor* getWizardDescriptor (void) const;
61 
62  std::vector<const SupervisorInfo*> getOrderedSupervisorDescriptors (const std::string& stateMachineCommand) const;
63 
64 private:
65 
66  SupervisorInfo* theSupervisorInfo_;
67  SupervisorInfo* theWizardInfo_;
68 
69 
70  std::map<unsigned int, SupervisorInfo> allSupervisorInfo_;
71  SupervisorInfoMap allFETypeSupervisorInfo_, allDMTypeSupervisorInfo_, allLogbookTypeSupervisorInfo_;
72 
73 
74 };
75 
76 }
77 
78 #endif