ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
pmonstate.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file pmonstate.h
1 #ifndef __PMONSTATE__
2 #define __PMONSTATE__
3 
4 #define ETSTREAM 1001
5 #define FILESTREAM 1002
6 #define TESTSTREAM 1003
7 #define RCDAQSTREAM 1004
8 
9 #include "Event/Eventiterator.h"
10 
11 #include "Event/msg_profile.h"
12 #include "Event/msg_control.h"
13 
14 #include <iostream>
15 
16 class pmonstate
17 {
18 
19  friend std::ostream& operator<< (std::ostream& os, pmonstate &c)
20  {
21  // std::cout << "Status:" << std::endl;
22 
23  if (c.isRunning())
24  {
25  std::cout << "Running at Event " << c.getNoevt() << " ";
26  }
27  else
28  {
29  std::cout << "Not running ";
30  }
31 
32  if ( c.streamOpened() )
33  {
34  os << "Stream open: ";
35  }
36  else
37  {
38  os << "no stream open.";
39  }
40  return os;
41  };
42 
43 
44 
45  private:
46  int stream;
49  int running;
51  char * Name;
52  int idflag;
53 
54 // Eventiterator * it;
55 
56  public:
58  {
60 
61 
63  Name = 0;
66  MSG_SEV_INFORMATIONAL, "pmonitor");
67  std::cout << *Message << "Welcome to pmonitor. Type phelp() for help " << std::endl;
68  delete Message;
69  initstatus = pinit();
70  };
71 
72  virtual ~pmonstate()
73  {
74  if (Name)
75  delete [] Name;
76  };
77 
78  inline virtual int streamOpened() const
79  {
80  return stream;
81  };
82 
83  virtual int setETOpened(const char *name )
84  {
85  stream = ETSTREAM;
86  Name = new char[strlen(name) + 1];
87  strcpy (Name, name);
88  return 0;
89  };
90 
91  virtual int setFileOpened(const char *name)
92  {
94  Name = new char[strlen(name) + 1];
95  strcpy (Name, name);
96  return 0;
97  };
98 
99  virtual int setRCDAQOpened(const char *name)
100  {
102  Name = new char[strlen(name) + 1];
103  strcpy (Name, name);
104  return 0;
105  };
106 
107  virtual int setTestOpened()
108  {
109  stream = TESTSTREAM;
110  Name = new char[strlen("Test") + 1];
111  strcpy (Name, "Test");
112  return 0;
113  };
114 
115  virtual int clearOpened()
116  {
117  stream = 0;
118  delete [] Name;
119  Name = 0;
120  return 0;
121  };
122 
123 
124  virtual int isRunning() const
125  {
126  return running;
127  return 0;
128  };
129 
130  virtual int setRunning()
131  {
132  running = 1;
133  return 0;
134  };
135 
136  virtual int clearRunning()
137  {
138  running = 0;
139  return 0;
140  }
141 
142  virtual int isBroken() const
143  {
144  return initstatus;
145  }
146 
147 
148  virtual int getNoevt() const
149  {
150  return number_of_events;
151  };
152 
153  virtual int setNoevt(const int n)
154  {
155  number_of_events = n ;
156  return 0;
157  };
158 
159  virtual int clearNoevt()
160  {
161  number_of_events = 0 ;
162  return 0;
163  };
164 
165  virtual int incrementNoevt()
166  {
168  return 0;
169  };
170 
171  virtual int getloopStatus()
172  {
173  return eventloopexitstatus;
174  };
175 
176  virtual void setloopStatus(const int s)
177  {
179  };
180 
181  virtual int setIdentifyFlag(const int n = -1)
182  {
183  idflag = n;
184  return 0;
185  };
186 
187  virtual int isIdentifyFlag()
188  {
189  int i = idflag;
190  if (idflag > 0)
191  {
192  idflag--;
193  }
194  return i;
195  };
196 
197  virtual char *name() const
198  {
199  return Name;
200  }
201 };
202 
203 #endif /* __PMONSTATE__ */