DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
Process.hpp
Go to the documentation of this file.
1/*
2 * Process.h
3 * OksSystem
4 *
5 * Created by Matthias Wiesmann on 18.01.05.
6 * Copyright 2005 CERN. All rights reserved.
7 *
8 */
9
10#ifndef OKSSYSTEM_PROCESS
11#define OKSSYSTEM_PROCESS
12
13#include <sys/types.h>
14#include <string>
15
16namespace OksSystem {
17
25 class Process {
26protected:
27 pid_t m_process_id ;
28 std::string m_process_name ;
29 static const char* const SYS_EXITS_NAMES[] ;
30 static const char* const TEST_EXITS_NAMES[] ;
31 static const char* const OK_EXIT_NAME ;
32 static const char* const SIGNAL_EXIT_NAME ;
33 static const int TEST_BASE_VALUE ;
34 static const int TEST_MAX_VALUE ;
35 static const int TERMINATION_WAIT ;
37public:
38 static const char* exit_text(int return_value) ;
39 static std::string exit_pretty(int return_value) ;
40 static const Process *instance() throw() ;
41 static void set_name(const std::string &name) throw() ;
42 Process();
43 Process(const Process &other) ;
44 Process(pid_t pid) ;
45 Process(pid_t pid, const std::string &name);
46 ~Process() throw() ;
47 operator pid_t() const throw() ;
48 int join(bool throw_non_zero=false) const ;
49 void signal(int signal) const ;
50 bool exists() const ;
51 bool equals(const Process &other) const throw() ;
52 void terminate() const ;
53 pid_t process_id() const throw();
54 std::string to_string() const throw();
55 } ; // Process
56
57} // OksSystem
58
59std::ostream& operator<<(std::ostream& stream, const OksSystem::Process &proc) ;
60bool operator ==(const OksSystem::Process &a, const OksSystem::Process &b) throw();
61bool operator !=(const OksSystem::Process &a, const OksSystem::Process &b) throw();
62
63#endif
Wrapper for process manipulation.
Definition Process.hpp:25
static const int TERMINATION_WAIT
wait time before deciding a termination signal did not work
Definition Process.hpp:35
static const Process * instance()
Definition Process.cpp:72
static const char *const OK_EXIT_NAME
string to describe 0 exit value
Definition Process.hpp:31
static const char * exit_text(int return_value)
the textual description of standard exit codes
Definition Process.cpp:42
static const char *const SIGNAL_EXIT_NAME
string to describe signal exited value
Definition Process.hpp:32
bool equals(const Process &other) const
Comparison method.
Definition Process.cpp:193
static const int TEST_BASE_VALUE
first value for test manager exit codes
Definition Process.hpp:33
pid_t m_process_id
process identifier
Definition Process.hpp:27
void terminate() const
Terminate the process.
Definition Process.cpp:202
static const char *const SYS_EXITS_NAMES[]
names for standard system exit values
Definition Process.hpp:29
static void set_name(const std::string &name)
Definition Process.cpp:83
static const int TEST_MAX_VALUE
last value for test manager exit codes
Definition Process.hpp:34
static std::string exit_pretty(int return_value)
Definition Process.cpp:55
static const char *const TEST_EXITS_NAMES[]
names for testing exit values
Definition Process.hpp:31
pid_t process_id() const
the id of the process
Definition Process.cpp:244
static Process * s_instance
singleton instance
Definition Process.hpp:36
std::string m_process_name
process name - only to be used for display
Definition Process.hpp:28
std::string to_string() const
String conversion method.
Definition Process.cpp:232