Jpp test-rotations-new
the software that should make you happy
Loading...
Searching...
No Matches
JDAQDemoClient.cc File Reference

Run control demo client class. More...

#include <string>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <sys/types.h>
#include <unistd.h>
#include "Jeep/JParser.hh"
#include "Jeep/JMessage.hh"
#include "Jeep/JArgs.hh"
#include "JSystem/JShell.hh"
#include "JRuncontrol/JDAQClient.hh"

Go to the source code of this file.

Classes

class  JDAQDemoClient
 

Functions

int main (int argc, char *argv[])
 Run control demo client.
 

Detailed Description

Run control demo client class.

The various action methods could be implemented in this class. Note that process with extension /- will sleep and kill itself at event ev_configure according the specified inputs. Note that process with extension /+ will sleep forever during the exit transition.

Author
mdejong

Definition in file JDAQDemoClient.cc.

Function Documentation

◆ main()

int main ( int argc,
char * argv[] )

Run control demo client.

Definition at line 161 of file JDAQDemoClient.cc.

162{
163 using namespace std;
164 using namespace JPP;
165 using namespace KM3NETDAQ;
166
167 string server;
168 string logger;
169 string client_name;
170 bool use_cout;
171 int debug;
172
173 string file_name;
174 int port;
175
176 try {
177
178 JParser<> zap("Application for writing real-time data to disk.");
179
180 zap['H'] = make_field(server) = "localhost";
181 zap['M'] = make_field(logger) = "localhost";
182 zap['u'] = make_field(client_name) = "%";
183 zap['c'] = make_field(use_cout);
184 zap['d'] = make_field(debug) = 3;
185
186 zap['f'] = make_field(file_name) = "";
187 zap['P'] = make_field(port) = -1;
188
189 zap(argc, argv);
190 }
191 catch(const exception &error) {
192 FATAL(error.what() << endl);
193 }
194
195 if (port == -1) {
196
197 JLogger* out = NULL;
198
199 if (use_cout)
200 out = new JStreamLogger(cout);
201 else
202 out = new JControlHostLogger(logger);
203
204 if (file_name == "") {
205
206 JDAQDemoClient demo(getProcessName(client_name, argv[0]), server, out, debug);
207
208 demo.enter();
209 demo.run();
210
211 } else {
212
213 JDAQDemoClient demo(getProcessName(client_name, argv[0]), out, debug);
214
215 if (debug >= debug_t && use_cout) {
216 demo.debug(CHSM::machine::D_all);
217 }
218 demo.CHSM::machine::enter();
219
220 ifstream in(file_name.c_str());
221
222 demo.run(in);
223
224 in.close();
225 }
226
227 } else {
228
229 JDAQDemoClient demo(getProcessName(client_name, argv[0]));
230
231 demo.run(port);
232 }
233}
#define FATAL(A)
Definition JMessage.hh:67
int debug
debug level
Definition JSirene.cc:72
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition JParser.hh:2142
Message logging based on ControlHost.
Interface for logging messages.
Definition JLogger.hh:22
Message logging based on std::ostream.
Utility class to parse command line options.
Definition JParser.hh:1698
@ debug_t
debug
Definition JMessage.hh:29
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
KM3NeT DAQ data structures and auxiliaries.
Definition DataQueue.cc:39
std::string getProcessName(const std::string &name, const std::string &process)
Get process name of run control client.