Belle II Software  release-05-02-19
RCCallback.h
1 
2 #ifndef _Belle2_RCCallback_hh
3 #define _Belle2_RCCallback_hh
4 
5 #include "daq/slc/runcontrol/RCState.h"
6 #include "daq/slc/runcontrol/RCConfig.h"
7 
8 #include <daq/slc/nsm/NSMCallback.h>
9 
10 namespace Belle2 {
16  class DBInterface;
17 
18  class RCCallback : public NSMCallback {
19 
20  friend class RCMonitor;
21  friend class RCConfigHandler;
22 
23  public:
24  RCCallback(int timeout = 4);
25  virtual ~RCCallback() {}
26 
27  public:
28  virtual void init(NSMCommunicator& com);
29  virtual void boot(const std::string& /* opt */, const DBObject&) {}
30  virtual void load(const DBObject&, const std::string& /*runtype*/) {}
31  virtual void start(int /*expno*/, int /*runno*/) {}
32  virtual void stop() {}
33  virtual void recover(const DBObject&, const std::string& /*runtype*/) {}
34  virtual bool resume(int /*subno*/) { return true; }
35  virtual bool pause() { return true; }
36  virtual void abort() {}
37  virtual void monitor() {}
38  virtual std::string dbdump();
39 
40  public:
41  virtual bool perform(NSMCommunicator& com);
42  virtual void timeout(NSMCommunicator& com);
43 
44  public:
45  virtual void initialize(const DBObject&) {}
46  virtual void configure(const DBObject&) {}
47  void dump(bool isstart);
48 
49  public:
50  const NSMNode& getRuncontrol() const { return m_runcontrol; }
51  void setState(const RCState& state);
52  void setRCConfig(const std::string& rcconfig) { m_rcconfig_org = rcconfig; }
53  void setDBTable(const std::string& table) { m_table = table; }
54  void setDBFile(const std::string& file) { m_file = file; }
55  const std::string& getDBTable() const { return m_table; }
56  void setAutoReply(bool auto_reply) { m_auto = auto_reply; }
57  void setDB(DBInterface* db, const std::string& table);
58  DBInterface* getDB() { return m_db; }
59  void setProvider(const std::string& host, int port)
60  {
61  m_provider_host = host;
62  m_provider_port = port;
63  }
64  DBObject& getDBObject() { return m_obj; }
65  void setRunNumbers(int expno, int runno)
66  {
67  m_expno = expno;
68  m_runno = runno;
69  }
70  int getExpNumber() const { return m_expno; }
71  int getRunNumber() const { return m_runno; }
72  void setRunTypeRecord(const std::string& runtype) { m_runtype_record = runtype; }
73  const std::string& getRunTypeRecord() const { return m_runtype_record; }
74 
75  private:
76  void dbload(int length, const char* data);
77 
78  public:
79  DBObject dbload(const std::string& path);
80  void configure_raw(int length, const char* data);
81 
82  private:
83  RCState m_state_demand;
84  DBObject m_obj;
85  DBInterface* m_db;
86  std::string m_table;
87  std::string m_file;
88  bool m_auto;
89  std::string m_rcconfig;
90  std::string m_rcconfig_org;
91  std::string m_provider_host;
92  int m_provider_port;
93  int m_expno;
94  int m_runno;
95  NSMNode m_runcontrol;
96  std::string m_runtype_record;
97 
98  protected:
99  bool m_showall;
100 
101  };
102 
103  inline void RCCallback::setDB(DBInterface* db, const std::string& table)
104  {
105  m_db = db;
106  m_table = table;
107  }
108 
110 };
111 
112 #endif
Belle2::RCConfigHandler
Definition: RCCallback.cc:29
Belle2::NSMNode
Definition: NSMNode.h:14
Belle2::DBObject
Definition: DBObject.h:14
Belle2::RCCallback
Definition: RCCallback.h:18
Belle2::NSMCommunicator
Definition: NSMCommunicator.h:25
Belle2::NSMCallback
Definition: NSMCallback.h:24
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::DBInterface
Definition: DBInterface.h:19
Belle2::RCState
Definition: RCState.h:12