Belle II Software  release-08-01-10
rf_eventserver.cc
1 /**************************************************************************
2  * basf2 (Belle II Analysis Software Framework) *
3  * Author: The Belle II Collaboration *
4  * *
5  * See git log for contributors and copyright holders. *
6  * This file is licensed under LGPL-3.0, see LICENSE.md. *
7  **************************************************************************/
8 #include "daq/rfarm/manager/RFEventServer.h"
9 #include "daq/rfarm/manager/RFNSM.h"
10 
11 #include <csignal>
12 
13 using namespace std;
14 using namespace Belle2;
15 
16 static RFEventServer* evs = NULL;
17 
18 extern "C" void sighandler(int /*sig*/)
19 {
20  printf("SIGTERM handler here\n");
21  evs->cleanup();
22 }
23 
24 int main(int argc, char** argv)
25 {
26  if (argc < 2) {
27  printf("Wrong number of parameters\n");
28  return 1;
29  }
30 
31  RFConf conf(argv[1]);
32 
33  // Creation of event server instance. evs contains the instance
34  // RFEventServer& evs = RFEventServer::Create(argv[1]);
35 
36  // RFEventServer* evs = new RFEventServer(argv[1]);
37  evs = new RFEventServer(argv[1]);
38 
39  signal(SIGINT, sighandler);
40  signal(SIGTERM, sighandler);
41  printf("Signal handler installed\n");
42 
43  RFNSM nsm(conf.getconf("distributor", "nodename"), evs);
44  nsm.AllocMem(conf.getconf("system", "nsmdata"));
45  evs->SetNodeInfo(nsm.GetNodeInfo());
46 
47  evs->server();
48 
49  return 0;
50 }
Abstract base class for different kinds of events.
int main(int argc, char **argv)
Run all tests.
Definition: test_main.cc:91