Jpp
 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 "Jeep/JParser.hh"
#include "Jeep/JMessage.hh"
#include "Jeep/JArgs.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 deliberately crash during the configure transition and 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 127 of file JDAQDemoClient.cc.

128 {
129  using namespace std;
130 
131  string server;
132  string logger;
133  string file_name;
134  string client_name;
135  string tag;
136  int port;
137  int debug;
138 
139  try {
140 
141  JParser<> zap("Run control demo client.");
142 
143  zap['H'] = make_field(server) = "";
144  zap['M'] = make_field(server) = "";
145  zap['f'] = make_field(file_name) = "";
146  zap['u'] = make_field(client_name) = "%";
147  zap['t'] = make_field(tag) = "";
148  zap['P'] = make_field(port) = -1;
149  zap['d'] = make_field(debug) = 2;
150 
151  zap(argc, argv);
152  }
153  catch(const exception &error) {
154  FATAL(error.what() << endl);
155  }
156 
157 
158  using namespace KM3NETDAQ;
159 
160  JDAQDemoClient demo(getProcessName(client_name, argv[0]), tag);
161 
162  if (debug >= JEEP::debug_t) {
163  demo.debug(CHSM::machine::D_all);
164  }
165 
166  if (port == -1) {
167 
168  demo.enter(JEEP::JArgs(argc, argv));
169 
170  if (file_name == "")
171 
172  demo.run();
173 
174  else {
175 
176  ifstream in(file_name.c_str());
177 
178  demo.run(in);
179 
180  in.close();
181  }
182 
183  } else {
184 
185  demo.run(port);
186  }
187 }
Utility class to parse command line options.
Definition: JParser.hh:1410
debug
Definition: JMessage.hh:27
std::string getProcessName(const std::string &name, const std::string &process)
Get process name of run control client.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1836
int debug
debug level
Definition: JSirene.cc:59
Data structure to store command line arguments.
Definition: JArgs.hh:24
#define FATAL(A)
Definition: JMessage.hh:65