source: drsdaq/VME/atlas/include/DFDebug/DFDebug.h@ 739

Last change on this file since 739 was 22, checked in by ogrimm, 16 years ago
First commit of drsdaq program
  • Property svn:executable set to *
File size: 3.3 KB
Line 
1/********************************************************/
2/* file: DFDebug.h (originally ROSDebug.h) */
3/* description: Nice macros for debugging purposesq */
4/* maintainer: Markus Joos, CERN/PH-ESS */
5/********************************************************/
6
7#include <iostream>
8#include <sys/types.h>
9#include <unistd.h>
10#include <pthread.h>
11#include "DFDebug/GlobalDebugSettings.h"
12
13#ifndef DFDEBUG_H
14#define DFDEBUG_H
15
16 #if (DEBUG_LEVEL>0)
17 #define DEBUG_TEXT(my_package, level, text)\
18 {\
19 int oldState;\
20 pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &oldState);\
21 DF::GlobalDebugSettings::lock();\
22 pthread_t my_tid;\
23 my_tid = pthread_self();\
24 if ((my_package == DF::GlobalDebugSettings::packageId()) || (DF::GlobalDebugSettings::packageId() == 0))\
25 if (DF::GlobalDebugSettings::traceLevel() >= level)\
26 std::cout << std::dec << "Debug(" << my_package << "," << my_tid << "): " << text << std::endl;\
27 DF::GlobalDebugSettings::unlock();\
28 pthread_setcancelstate(oldState, 0);\
29 }
30 #else
31 #define DEBUG_TEXT(my_package, level, text)
32 #endif
33
34 #define OUT_TEXT(my_package, text)\
35 {\
36 int oldState;\
37 pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &oldState);\
38 std::cout << "Printout(" << my_package << "): " << text << std::endl;\
39 pthread_setcancelstate(oldState, 0);\
40 }
41
42 #define ERR_TEXT(my_package, text)\
43 {\
44 int oldState;\
45 pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &oldState);\
46 std::cerr << "Error(" << my_package << "): " << text << std::endl;\
47 pthread_setcancelstate(oldState, 0);\
48 }
49
50 #define HEX(n) std::hex << n << std::dec
51
52 // Definition of some package identifiers
53 // Naming convention:
54 // DFDB_<A>_<B> with:
55 // A = (abbreviated) package name without underscores
56 // B = Suidentifier within package
57 //
58 // NOTE:
59 // IF YOU ARE ADDING A NEW PACKAGE HERE DO NOT FORGET TO ALSO ADD
60 // IT TO THE DFDEBUG_MENU TEST PROGRAM IN ../SRC/TEST
61 //
62
63 enum
64 {
65 DFDB_ROSFM = 1, //ROSFragmentManagement
66 DFDB_ROSEF, //ROSEventFragment
67 DFDB_ROSSWROBIN, //ROSSWRobin
68 DFDB_ROSFILAR, //ROSfilar
69 DFDB_ROSMEMPOOL, //ROSMemoryPool
70 DFDB_ROSEIM, //ROSEventInputManager
71 DFDB_ROSIO, //ROSIO
72 DFDB_ROSTG, //Trigger generator in ROSIO
73 DFDB_SLINK, //ROSslink
74 DFDB_ROSSOLAR, //ROSsolar
75 DFDB_ROSQUEST, //ROSsolar (QUEST)
76 DFDB_QUEUE, //Queue debugging (ROSSWRobin, ROSIO, ROSCore)
77 DFDB_ROSCORE, //ROSCore
78 DFDB_ROSROBIN, //ROSRobin
79 DFDB_DFDB, //DFDebug
80 DFDB_CMEMRCC = 100, //cmem_rcc
81 DFDB_IORCC, //io_rcc
82 DFDB_VMERCC, //vme_rcc
83 DFDB_RCCTS, //rcc_time_stamp
84 DFDB_RCDEXAMPLE = 300, //RCDExample
85 DFDB_RCDBITSTRING, //RCDBitString
86 DFDB_RCDMENU, //RCDMenu
87 DFDB_RCDMODULE, //RCDModule
88 DFDB_RCDTTC, //RCDTtc
89 DFDB_RCDVME, //RCDVme
90 DFDB_RCDLTP, //RCDLTPModule and RCDLTPConfiguration
91 DFDB_RCDRODBUSY, //rcc_rodbusy and RODBusyModule
92 DFDB_RCDTTCVIMODULE, //RCDTtcviModule
93 DFDB_RF2TTC, //RF2TTC and RFRX modules
94 DFDB_TTCVI = 400 //Ttcvi
95 };
96
97#endif //DFDEBUG_H
Note: See TracBrowser for help on using the repository browser.