DABC (Data Acquisition Backbone Core)  2.9.9
HadaqTypeDefs.cxx
Go to the documentation of this file.
1 // $Id: HadaqTypeDefs.cxx 4566 2020-07-28 15:06:45Z linev $
2 
3 /************************************************************
4  * The Data Acquisition Backbone Core (DABC) *
5  ************************************************************
6  * Copyright (C) 2009 - *
7  * GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
8  * Planckstr. 1, 64291 Darmstadt, Germany *
9  * Contact: http://dabc.gsi.de *
10  ************************************************************
11  * This software can be used under the GPL license *
12  * agreements as stated in LICENSE.txt file *
13  * which is part of the distribution. *
14  ************************************************************/
15 
16 #include "hadaq/HadaqTypeDefs.h"
17 
18 #include <cstdio>
19 #include <sys/time.h>
20 #include <ctime>
21 
22 
23 const char* hadaq::typeUdpDevice = "hadaq::UdpDevice";
24 
25 const char* hadaq::protocolHld = "hld";
26 const char* hadaq::protocolHadaq = "hadaq";
27 
28 // Command names used in combiner module:
29 //const char* hadaq::comStartServer = "StartServer";
30 //const char* hadaq::comStopServer = "StopServer";
31 //const char* hadaq::comStartFile = "StartFile";
32 //const char* hadaq::comStopFile = "StopFile";
33 
34 
35 // tag names for xml config file:
36 const char* hadaq::xmlBuildFullEvent = "HadaqBuildEvents";
37 
38 //const char* hadaq::xmlServerKind = "HadaqServerKind";
39 
40 //const char* hadaq::xmlServerScale = "HadaqServerScale";
41 //const char* hadaq::xmlServerLimit = "HadaqServerLimit";
42 
43 const char* hadaq::xmlHadaqTrignumRange = "TriggerNumRange";
44 const char* hadaq::xmlHadaqTriggerTollerance = "TriggerTollerance";
45 const char* hadaq::xmlHadaqDiffEventStats = "AccountLostEventDiff";
46 const char* hadaq::xmlEvtbuildTimeout = "BuildDropTimeout";
47 const char* hadaq::xmlMaxNumBuildEvt = "MaxNumBuildEvt";
48 const char* hadaq::xmlHadesTriggerType = "HadesTriggerType";
49 const char* hadaq::xmlHadesTriggerHUB = "HadesTriggerHUB";
50 
51 
52 std::string hadaq::FormatFilename (uint32_t runid, uint16_t ebid)
53 {
54  // same
55  char buf[128];
56  time_t iocTime = runid + HADAQ_TIMEOFFSET;
57  struct tm tm_res;
58  size_t off = strftime(buf, 128, "%y%j%H%M%S", localtime_r(&iocTime, &tm_res));
59  if(ebid!=0) snprintf(buf+off, 128-off, "%02d", ebid);
60  return std::string(buf);
61 }
62 
64 {
65  struct timeval tv;
66  gettimeofday(&tv, NULL);
67  return tv.tv_sec - hadaq::HADAQ_TIMEOFFSET;
68 }
const char * xmlHadaqTriggerTollerance
const char * xmlHadesTriggerHUB
const char * xmlMaxNumBuildEvt
const char * xmlEvtbuildTimeout
const char * xmlHadaqDiffEventStats
@ HADAQ_TIMEOFFSET
Definition: defines.h:115
const char * xmlBuildFullEvent
const char * xmlHadaqTrignumRange
const char * protocolHld
std::string FormatFilename(uint32_t runid, uint16_t ebid=0)
const char * typeUdpDevice
const char * protocolHadaq
const char * xmlHadesTriggerType
uint32_t CreateRunId()