DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
RemoteContext.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/RemoteContext.h to include/ers/RemoteContext.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 * RemoteContext.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_REMOTE_CONTEXT_H
22#define ERS_REMOTE_CONTEXT_H
23
28
29#include <ers/Context.hpp>
30
31namespace ers {
33{
34 RemoteProcessContext(const std::string& host_name,
35 int pid,
36 int tid,
37 const std::string& cwd,
38 int uid,
39 const std::string& uname,
40 const std::string& app_name)
41 : m_host_name(host_name)
42 , m_pid(pid)
43 , m_tid(tid)
44 , m_cwd(cwd)
45 , m_uid(uid)
46 , m_uname(uname)
47 , m_app_name(app_name)
48 {
49 ;
50 }
51
52 const std::string m_host_name;
53 const pid_t m_pid;
54 const pid_t m_tid;
55 const std::string m_cwd;
56 const int m_uid;
57 const std::string m_uname;
58 const std::string m_app_name;
59};
60
61class RemoteContext : public Context
62{
63public:
70 RemoteContext(const std::string& package,
71 const std::string& filename,
72 int line_number,
73 const std::string& function_name,
74 const RemoteProcessContext& pc)
75 : m_process(pc)
76 , m_package_name(package)
80 {
81 ;
82 }
83
84 virtual ~RemoteContext() { ; }
85
86 virtual Context* clone() const { return new RemoteContext(*this); }
87
88 const char* cwd() const { return m_process.m_cwd.c_str(); }
89
90 const char* file_name() const { return m_file_name.c_str(); }
91
92 const char* function_name() const
93 {
94 return m_function_name.c_str();
95 }
96
97 const char* host_name() const
98 {
99 return m_process.m_host_name.c_str();
100 }
101
102 int line_number() const { return m_line_number; }
103
104 const char* package_name() const { return m_package_name.c_str(); }
105
106 pid_t process_id() const { return m_process.m_pid; }
107
108 pid_t thread_id() const { return m_process.m_tid; }
109
110 void* const* stack_symbols() const { return 0; }
111
112 int stack_size() const { return 0; }
113
114 int user_id() const { return m_process.m_uid; }
115
116 const char* user_name() const { return m_process.m_uname.c_str(); }
117
118 const char* application_name() const { return m_process.m_app_name.c_str(); }
119
120private:
122 const std::string m_package_name;
123 const std::string m_file_name;
124 const std::string m_function_name;
125 const int m_line_number;
126};
127}
128
129#endif
An abstract interface to access an Issue context.
Definition Context.hpp:40
const char * application_name() const
const char * package_name() const
virtual Context * clone() const
const char * function_name() const
RemoteContext(const std::string &package, const std::string &filename, int line_number, const std::string &function_name, const RemoteProcessContext &pc)
void *const * stack_symbols() const
const char * cwd() const
const std::string m_package_name
pid_t thread_id() const
const char * user_name() const
const RemoteProcessContext m_process
const std::string m_function_name
const char * host_name() const
const char * file_name() const
pid_t process_id() const
const std::string m_file_name
const std::string m_app_name
const std::string m_host_name
RemoteProcessContext(const std::string &host_name, int pid, int tid, const std::string &cwd, int uid, const std::string &uname, const std::string &app_name)
const std::string m_uname