DABC (Data Acquisition Backbone Core)  2.9.9
Monitor.h
Go to the documentation of this file.
1 // $Id: Monitor.h 3862 2018-05-11 10:06:18Z linev $
2 
3 /************************************************************
4  * The Data Acquisition Backbone Core (DABC) *
5  ************************************************************
6  * Copyright (C) 2009 - *
7  * GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
8  * Planckstr. 1, 64291 Darmstadt, Germany *
9  * Contact: http://dabc.gsi.de *
10  ************************************************************
11  * This software can be used under the GPL license *
12  * agreements as stated in LICENSE.txt file *
13  * which is part of the distribution. *
14  ************************************************************/
15 
16 #ifndef ROOT_Monitor
17 #define ROOT_Monitor
18 
19 #ifndef DABC_Worker
20 #include "dabc/Worker.h"
21 #endif
22 
23 #ifndef DABC_Hierarchy
24 #include "dabc/Hierarchy.h"
25 #endif
26 
27 #ifndef DABC_CommandsQueue
28 #include "dabc/CommandsQueue.h"
29 #endif
30 
31 class THttpServer;
32 class TRootSniffer;
33 
34 namespace root {
35 
36 
41  class MonitorRef;
42 
43  class Monitor : public dabc::Worker {
44 
45  friend class MonitorRef;
46 
47  protected:
48 
49  bool fEnabled;
50 
51  std::string fPrefix;
52 
55 
58 
60 
62 
63  virtual void OnThreadAssigned();
64 
65  virtual void InitializeHierarchy() {}
66 
67  virtual double ProcessTimeout(double last_diff);
68 
70  void RescanHierarchy(TRootSniffer* sniff, dabc::Hierarchy& main, const char* path = 0);
71 
72  virtual int ExecuteCommand(dabc::Command cmd);
73 
74  void ProcessActionsInRootContext(THttpServer* serv, TRootSniffer* sniff);
75 
77  virtual bool ProcessHCommand(const std::string &cmdname, dabc::Command cmd) { return false; }
78 
79  virtual int ProcessGetBinary(THttpServer* serv, TRootSniffer* sniff, dabc::Command cmd);
80 
81  public:
82  Monitor(const std::string &name, dabc::Command cmd = nullptr);
83 
84  virtual ~Monitor();
85 
86  virtual const char* ClassName() const { return "Player"; }
87 
88  bool IsEnabled() const { return fEnabled; }
89  };
90 
91 
92  class MonitorRef : public dabc::WorkerRef {
94 
95  void ProcessActionsInRootContext(THttpServer* serv, TRootSniffer* sniff)
96  {
97  if (GetObject()) GetObject()->ProcessActionsInRootContext(serv, sniff);
98  }
99 
100  };
101 
102 }
103 
104 #endif
Represents command with its arguments.
Definition: Command.h:99
Queue of commands
Definition: CommandsQueue.h:39
Represents objects hierarchy of remote (or local) DABC process.
Definition: Hierarchy.h:285
Object * GetObject() const
Return pointer on the object.
Definition: Reference.h:129
Reference on dabc::Worker
Definition: Worker.h:466
Active object, which is working inside dabc::Thread.
Definition: Worker.h:116
DABC_REFERENCE(MonitorRef, dabc::WorkerRef, Monitor)
void ProcessActionsInRootContext(THttpServer *serv, TRootSniffer *sniff)
Definition: Monitor.h:95
virtual void OnThreadAssigned()
Definition: Monitor.cxx:110
Monitor(const std::string &name, dabc::Command cmd=nullptr)
Definition: Monitor.cxx:92
virtual double ProcessTimeout(double last_diff)
Definition: Monitor.cxx:127
virtual ~Monitor()
Definition: Monitor.cxx:105
dabc::TimeStamp fLastUpdate
Definition: Monitor.h:61
dabc::CommandsQueue fRootCmds
list of commands, which must be executed in the ROOT context
Definition: Monitor.h:59
void RescanHierarchy(TRootSniffer *sniff, dabc::Hierarchy &main, const char *path=0)
Method scans normal objects, registered in ROOT and DABC.
Definition: Monitor.cxx:147
dabc::Hierarchy fRoot
Last hierarchy, build in ROOT main thread.
Definition: Monitor.h:54
virtual int ProcessGetBinary(THttpServer *serv, TRootSniffer *sniff, dabc::Command cmd)
Definition: Monitor.cxx:157
virtual void InitializeHierarchy()
Definition: Monitor.h:65
virtual bool ProcessHCommand(const std::string &cmdname, dabc::Command cmd)
Execute extra command in ROOT context, used in Go4 plugin.
Definition: Monitor.h:77
virtual const char * ClassName() const
Returns class name of the object instance.
Definition: Monitor.h:86
bool fEnabled
Definition: Monitor.h:49
bool IsEnabled() const
Definition: Monitor.h:88
void ProcessActionsInRootContext(THttpServer *serv, TRootSniffer *sniff)
Definition: Monitor.cxx:258
dabc::Hierarchy fHierarchy
hierarchy, used for version control
Definition: Monitor.h:57
std::string fPrefix
name prefix for hierarchy like ROOT or Go4
Definition: Monitor.h:51
virtual int ExecuteCommand(dabc::Command cmd)
Main method where commands are executed.
Definition: Monitor.cxx:133
int main(int numc, char *args[])
Definition: dabc_exe.cxx:68
Definition: Factory.h:24
Class for acquiring and holding timestamps.
Definition: timing.h:40