DUNE-DAQ
DUNE Trigger and Data Acquisition software
Toggle main menu visibility
Loading...
Searching...
No Matches
dunedaq
sourcecode
ers
include
ers
LocalContext.hpp
Go to the documentation of this file.
1
/*
2
* DUNE DAQ modification notice:
3
* This file has been modified from the original ATLAS ers source for the DUNE DAQ project.
4
* Fork baseline commit: 8267df82a4f6fe6bf02c4014923eba19eddc4614 (2020-04-14).
5
* Renamed since fork: yes (from ers/LocalContext.h to include/ers/LocalContext.hpp).
6
*
7
* Original copyright:
8
* Copyright (C) 2001-2020 CERN for the benefit of the ATLAS collaboration.
9
* Licensed under the Apache License, Version 2.0.
10
*/
11
12
/*
13
* LocalContext.h
14
* ers
15
*
16
* Created by Serguei Kolos on 26.11.05.
17
* Copyright 2004 CERN. All rights reserved.
18
*
19
*/
20
21
#ifndef ERS_LOCAL_CONTEXT_H
22
#define ERS_LOCAL_CONTEXT_H
23
28
29
#include <sys/types.h>
30
#include <unistd.h>
31
32
#include <
ers/Context.hpp
>
33
34
#ifdef DUNEDAQ_PACKAGE_NAME
35
#define ERS_PACKAGE DUNEDAQ_PACKAGE_NAME
36
#else
37
#define ERS_PACKAGE "unknown"
38
#endif
39
40
namespace
ers
{
41
struct
LocalProcessContext
42
{
43
LocalProcessContext
(
const
char
*
const
host_name,
const
char
*
const
cwd,
int
uid,
const
char
*
const
uname)
44
:
m_host_name
(host_name)
45
,
m_cwd
(cwd)
46
,
m_uid
(uid)
47
,
m_uname
(uname)
48
{
49
;
50
}
51
52
const
char
*
const
m_host_name
;
53
const
char
*
const
m_cwd
;
54
const
int
m_uid
;
55
const
char
*
const
m_uname
;
56
};
57
58
class
LocalContext
:
public
Context
59
{
60
public
:
68
LocalContext
(
const
char
*
package_name
,
69
const
char
*
filename
,
70
int
line_number
,
71
const
char
*
function_name
,
72
bool
debug
=
false
);
73
74
virtual
~LocalContext
() { ; }
75
76
virtual
Context
*
clone
() const {
return
new
LocalContext
(*
this
); }
77
78
const
char
*
cwd
() const {
return
c_process
.
m_cwd
; }
79
80
const
char
*
file_name
() const {
return
m_file_name
; }
81
82
const
char
*
function_name
() const
83
{
84
return
m_function_name
;
85
}
86
87
const
char
*
host_name
() const {
return
c_process
.
m_host_name
; }
88
89
int
line_number
() const {
return
m_line_number
; }
90
91
const
char
*
package_name
() const {
return
m_package_name
; }
92
93
pid_t
process_id
() const { return ::getpid(); }
94
95
pid_t
thread_id
() const {
return
m_thread_id
; }
96
97
void
*
const
*
stack_symbols
() const {
return
m_stack
; }
98
99
int
stack_size
() const {
return
m_stack_size
; }
100
101
int
user_id
() const {
return
c_process
.
m_uid
; }
102
103
const
char
*
user_name
() const {
return
c_process
.
m_uname
; }
104
105
const
char
*
application_name
()
const
;
106
107
static
void
resetProcessContext
();
108
109
private
:
110
static
const
LocalProcessContext
c_process
;
111
112
const
char
*
const
m_package_name
;
113
const
char
*
const
m_file_name
;
114
const
char
*
const
m_function_name
;
115
const
int
m_line_number
;
116
const
pid_t
m_thread_id
;
117
void
*
m_stack
[64];
118
const
int
m_stack_size
;
119
};
120
}
121
124
#define ERS_HERE_DEBUG ers::LocalContext(ERS_PACKAGE, __FILE__, __LINE__, __PRETTY_FUNCTION__, true)
125
126
#ifndef ERS_NO_DEBUG
127
#define ERS_HERE ERS_HERE_DEBUG
128
#else
129
#define ERS_HERE ers::LocalContext(ERS_PACKAGE, __FILE__, __LINE__, __PRETTY_FUNCTION__, false)
130
#endif
131
132
#endif
Context.hpp
ers::Context
An abstract interface to access an Issue context.
Definition
Context.hpp:40
ers::LocalContext::application_name
const char * application_name() const
Definition
LocalContext.cpp:104
ers::LocalContext::function_name
const char * function_name() const
Definition
LocalContext.hpp:82
ers::LocalContext::line_number
int line_number() const
Definition
LocalContext.hpp:89
ers::LocalContext::m_file_name
const char *const m_file_name
Definition
LocalContext.hpp:113
ers::LocalContext::user_name
const char * user_name() const
Definition
LocalContext.hpp:103
ers::LocalContext::stack_size
int stack_size() const
Definition
LocalContext.hpp:99
ers::LocalContext::host_name
const char * host_name() const
Definition
LocalContext.hpp:87
ers::LocalContext::file_name
const char * file_name() const
Definition
LocalContext.hpp:80
ers::LocalContext::~LocalContext
virtual ~LocalContext()
Definition
LocalContext.hpp:74
ers::LocalContext::process_id
pid_t process_id() const
Definition
LocalContext.hpp:93
ers::LocalContext::m_line_number
const int m_line_number
Definition
LocalContext.hpp:115
ers::LocalContext::m_function_name
const char *const m_function_name
Definition
LocalContext.hpp:114
ers::LocalContext::package_name
const char * package_name() const
Definition
LocalContext.hpp:91
ers::LocalContext::clone
virtual Context * clone() const
Definition
LocalContext.hpp:76
ers::LocalContext::thread_id
pid_t thread_id() const
Definition
LocalContext.hpp:95
ers::LocalContext::m_stack
void * m_stack[64]
Definition
LocalContext.hpp:117
ers::LocalContext::LocalContext
LocalContext(const char *package_name, const char *filename, int line_number, const char *function_name, bool debug=false)
Definition
LocalContext.cpp:88
ers::LocalContext::user_id
int user_id() const
Definition
LocalContext.hpp:101
ers::LocalContext::m_thread_id
const pid_t m_thread_id
Definition
LocalContext.hpp:116
ers::LocalContext::cwd
const char * cwd() const
Definition
LocalContext.hpp:78
ers::LocalContext::resetProcessContext
static void resetProcessContext()
ers::LocalContext::m_stack_size
const int m_stack_size
Definition
LocalContext.hpp:118
ers::LocalContext::c_process
static const LocalProcessContext c_process
Definition
LocalContext.hpp:110
ers::LocalContext::m_package_name
const char *const m_package_name
Definition
LocalContext.hpp:112
ers::LocalContext::stack_symbols
void *const * stack_symbols() const
Definition
LocalContext.hpp:97
ers
Definition
Logger.hxx:231
ers::debug
void debug(const Issue &issue, int level=debug_level())
Definition
ers.hpp:91
ers::LocalProcessContext
Definition
LocalContext.hpp:42
ers::LocalProcessContext::m_cwd
const char *const m_cwd
Definition
LocalContext.hpp:53
ers::LocalProcessContext::m_host_name
const char *const m_host_name
Definition
LocalContext.hpp:52
ers::LocalProcessContext::m_uid
const int m_uid
Definition
LocalContext.hpp:54
ers::LocalProcessContext::m_uname
const char *const m_uname
Definition
LocalContext.hpp:55
ers::LocalProcessContext::LocalProcessContext
LocalProcessContext(const char *const host_name, const char *const cwd, int uid, const char *const uname)
Definition
LocalContext.hpp:43
tablepositions::filename
@ filename
Definition
ui_constants.hpp:13
Generated on
for DUNE-DAQ by
1.18.0