Jpp  16.0.2
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Functions
JModuleStatusBits.cc File Reference

Example program to test module status bits. More...

#include <string>
#include <iostream>
#include <iomanip>
#include "JDetector/JModule.hh"
#include "JDetector/JModuleStatus.hh"
#include "Jeep/JStreamToolkit.hh"
#include "Jeep/JParser.hh"
#include "Jeep/JMessage.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Example program to test module status bits.

Author
mdejong

Definition in file JModuleStatusBits.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 20 of file JModuleStatusBits.cc.

21 {
22  using namespace std;
23  using namespace JPP;
24 
25  int debug;
26 
27  try {
28 
29  JParser<> zap("Example program to test module status bits.");
30 
31  zap['d'] = make_field(debug) = 3;
32 
33  zap(argc, argv);
34  }
35  catch(const exception &error) {
36  FATAL(error.what() << endl);
37  }
38 
39 
40  if (debug >= debug_t) {
41  cout << "Module status bits: ";
42  writeObject(cout, getModuleStatusBits<string>()) << endl;
43  }
44 
45  JModule module;
46 
47  vector<int> buffer = getModuleStatusBits<int>();
48 
49  for (vector<int>::const_iterator i = buffer.begin(); i != buffer.end(); ++i) {
50 
51  ASSERT(module.has(*i) == false);
52 
53  DEBUG("Set module status " << putModuleStatusBit(*i) << endl);
54 
55  module.set(*i);
56 
57  ASSERT(module.has(*i) == true);
58  }
59 
60  return 0;
61 }
Utility class to parse command line options.
Definition: JParser.hh:1500
debug
Definition: JMessage.hh:29
#define ASSERT(A,...)
Assert macro.
Definition: JMessage.hh:90
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1961
static const JPutModuleStatusBit putModuleStatusBit(getModuleStatusBit)
Function object to map module status bit to key.
int debug
debug level
Definition: JSirene.cc:63
#define FATAL(A)
Definition: JMessage.hh:67
then usage $script< input_file >< detector_file > fi set_variable OUTPUT_DIR set_variable SELECTOR JDAQTimesliceL1 set_variable DEBUG case set_variable DEBUG
std::ostream & writeObject(std::ostream &out, const T &object)
Stream output of object.