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
{
42
struct
LocalProcessContext
43
{
44
LocalProcessContext
(
const
char
*
const
host_name,
45
const
char
*
const
cwd,
46
int
uid,
47
const
char
*
const
uname )
48
:
m_host_name
( host_name ),
49
m_cwd
( cwd ),
50
m_uid
( uid ),
51
m_uname
( uname )
52
{ ; }
53
54
const
char
*
const
m_host_name
;
55
const
char
*
const
m_cwd
;
56
const
int
m_uid
;
57
const
char
*
const
m_uname
;
58
};
59
60
class
LocalContext
:
public
Context
61
{
62
public
:
63
71
LocalContext
(
const
char
*
package_name
,
72
const
char
*
filename
,
73
int
line_number
,
74
const
char
*
function_name
,
75
bool
debug
=
false
);
76
77
virtual
~LocalContext
()
78
{ ; }
79
80
virtual
Context
*
clone
() const
81
{
return
new
LocalContext
( *
this
); }
82
83
const
char
*
cwd
() const
84
{
return
c_process
.m_cwd; }
85
86
const
char
*
file_name
() const
87
{
return
m_file_name
; }
88
89
const
char
*
function_name
() const
90
{
return
m_function_name
; }
91
92
const
char
*
host_name
() const
93
{
return
c_process
.m_host_name; }
94
95
int
line_number
() const
96
{
return
m_line_number
; }
97
98
const
char
*
package_name
() const
99
{
return
m_package_name
; }
100
101
pid_t
process_id
() const
102
{ return ::getpid(); }
103
104
pid_t
thread_id
() const
105
{
return
m_thread_id
; }
106
107
void
*
const
*
stack_symbols
() const
108
{
return
m_stack
; }
109
110
int
stack_size
() const
111
{
return
m_stack_size
; }
112
113
int
user_id
() const
114
{
return
c_process
.m_uid; }
115
116
const
char
*
user_name
() const
117
{
return
c_process
.m_uname; }
118
119
const
char
*
application_name
()
const
;
120
121
static
void
resetProcessContext
();
122
123
private
:
124
static
const
LocalProcessContext
c_process
;
125
126
const
char
*
const
m_package_name
;
127
const
char
*
const
m_file_name
;
128
const
char
*
const
m_function_name
;
129
const
int
m_line_number
;
130
const
pid_t
m_thread_id
;
131
void
*
m_stack
[64];
132
const
int
m_stack_size
;
133
};
134
}
135
138
#define ERS_HERE_DEBUG ers::LocalContext( ERS_PACKAGE, __FILE__, __LINE__, __PRETTY_FUNCTION__, true )
139
140
#ifndef ERS_NO_DEBUG
141
#define ERS_HERE ERS_HERE_DEBUG
142
#else
143
#define ERS_HERE ers::LocalContext( ERS_PACKAGE, __FILE__, __LINE__, __PRETTY_FUNCTION__, false)
144
#endif
145
146
#endif
147
Context.hpp
ers::Context
An abstract interface to access an Issue context.
Definition
Context.hpp:41
ers::LocalContext::application_name
const char * application_name() const
Definition
LocalContext.cpp:102
ers::LocalContext::function_name
const char * function_name() const
Definition
LocalContext.hpp:89
ers::LocalContext::line_number
int line_number() const
Definition
LocalContext.hpp:95
ers::LocalContext::m_file_name
const char *const m_file_name
Definition
LocalContext.hpp:127
ers::LocalContext::user_name
const char * user_name() const
Definition
LocalContext.hpp:116
ers::LocalContext::stack_size
int stack_size() const
Definition
LocalContext.hpp:110
ers::LocalContext::host_name
const char * host_name() const
Definition
LocalContext.hpp:92
ers::LocalContext::file_name
const char * file_name() const
Definition
LocalContext.hpp:86
ers::LocalContext::~LocalContext
virtual ~LocalContext()
Definition
LocalContext.hpp:77
ers::LocalContext::process_id
pid_t process_id() const
Definition
LocalContext.hpp:101
ers::LocalContext::m_line_number
const int m_line_number
Definition
LocalContext.hpp:129
ers::LocalContext::m_function_name
const char *const m_function_name
Definition
LocalContext.hpp:128
ers::LocalContext::package_name
const char * package_name() const
Definition
LocalContext.hpp:98
ers::LocalContext::clone
virtual Context * clone() const
Definition
LocalContext.hpp:80
ers::LocalContext::thread_id
pid_t thread_id() const
Definition
LocalContext.hpp:104
ers::LocalContext::m_stack
void * m_stack[64]
Definition
LocalContext.hpp:131
ers::LocalContext::LocalContext
LocalContext(const char *package_name, const char *filename, int line_number, const char *function_name, bool debug=false)
Definition
LocalContext.cpp:87
ers::LocalContext::user_id
int user_id() const
Definition
LocalContext.hpp:113
ers::LocalContext::m_thread_id
const pid_t m_thread_id
Definition
LocalContext.hpp:130
ers::LocalContext::cwd
const char * cwd() const
Definition
LocalContext.hpp:83
ers::LocalContext::resetProcessContext
static void resetProcessContext()
ers::LocalContext::m_stack_size
const int m_stack_size
Definition
LocalContext.hpp:132
ers::LocalContext::c_process
static const LocalProcessContext c_process
Definition
LocalContext.hpp:124
ers::LocalContext::m_package_name
const char *const m_package_name
Definition
LocalContext.hpp:126
ers::LocalContext::stack_symbols
void *const * stack_symbols() const
Definition
LocalContext.hpp:107
ers
Definition
Logger.hxx:202
ers::debug
void debug(const Issue &issue, int level=debug_level())
Definition
ers.hpp:85
ers::LocalProcessContext
Definition
LocalContext.hpp:43
ers::LocalProcessContext::m_cwd
const char *const m_cwd
Definition
LocalContext.hpp:55
ers::LocalProcessContext::m_host_name
const char *const m_host_name
Definition
LocalContext.hpp:54
ers::LocalProcessContext::m_uid
const int m_uid
Definition
LocalContext.hpp:56
ers::LocalProcessContext::m_uname
const char *const m_uname
Definition
LocalContext.hpp:57
ers::LocalProcessContext::LocalProcessContext
LocalProcessContext(const char *const host_name, const char *const cwd, int uid, const char *const uname)
Definition
LocalContext.hpp:44
tablepositions::filename
@ filename
Definition
ui_constants.hpp:11
Generated on
for DUNE-DAQ by
1.17.0