Jpp  15.0.5
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Functions
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. More...
 

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

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 }
Utility class to parse command line options.
Definition: JParser.hh:1500
debug
Definition: JMessage.hh:29
std::string getProcessName(const std::string &name, const std::string &process)
Get process name of run control client.
Message logging based on std::ostream.
Interface for logging messages.
Definition: JLogger.hh:22
Message logging based on ControlHost.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1961
int debug
debug level
Definition: JSirene.cc:63
#define FATAL(A)
Definition: JMessage.hh:67
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY source JAcoustics sh $DETECTOR_ID CHECK_EXIT_CODE typeset A TRIPODS get_tripods $WORKDIR tripod txt TRIPODS for EMITTER in
Definition: JCanberra.sh:41