process-cpp 3.0.0
A simple convenience library for handling processes in C++11.
core::posix::Process Class Reference

The Process class models a process and possible operations on it. More...

#include <process.h>

+ Inheritance diagram for core::posix::Process:
+ Collaboration diagram for core::posix::Process:

Classes

struct  Private
 

Public Member Functions

 Process (pid_t pid)
 Creates a process instance wrapping an existing process.
 
virtual ~Process () noexcept
 Frees resources associated with the process.
 
virtual pid_t pid () const
 Query the pid of the process.
 
virtual ProcessGroup process_group_or_throw () const
 Queries the id of the process group this process belongs to.
 
virtual ProcessGroup process_group (std::error_code &se) const noexcept(true)
 Queries the id of the process group this process belongs to.
 
- Public Member Functions inherited from core::posix::Signalable
virtual void send_signal_or_throw (Signal signal)
 Sends a signal to this signalable object.
 
virtual void send_signal (Signal signal, std::error_code &e) noexcept(true)
 Sends a signal to this signalable object.
 

Static Public Member Functions

static Process invalid ()
 Returns an invalid instance for testing purposes.
 

Additional Inherited Members

- Protected Member Functions inherited from core::posix::Signalable
CORE_POSIX_DLL_LOCAL Signalable (pid_t pid)
 

Detailed Description

The Process class models a process and possible operations on it.

The process class is implicitly shared.

Definition at line 44 of file process.h.

Constructor & Destructor Documentation

◆ Process()

core::posix::Process::Process ( pid_t  pid)
explicit

Creates a process instance wrapping an existing process.

Exceptions
Throwstd::system_error if pid is invalid, i.e., pid < 0.
Parameters
pidThe process identifier of the existing process.

Definition at line 47 of file process.cpp.

References pid().

+ Here is the call graph for this function:

◆ ~Process()

core::posix::Process::~Process ( )
virtualnoexcept

Frees resources associated with the process.

Definition at line 55 of file process.cpp.

Member Function Documentation

◆ invalid()

Process core::posix::Process::invalid ( )
static

Returns an invalid instance for testing purposes.

Returns
An invalid instance.

Definition at line 38 of file process.cpp.

Referenced by TEST(), and TEST().

◆ pid()

◆ process_group()

ProcessGroup core::posix::Process::process_group ( std::error_code &  se) const
virtualnoexcept

Queries the id of the process group this process belongs to.

Returns
A tuple with the first element being the id of the process group this process belongs to and the second element a boolean flag indicating an error if true.

Definition at line 74 of file process.cpp.

Referenced by TEST(), and TEST().

◆ process_group_or_throw()

ProcessGroup core::posix::Process::process_group_or_throw ( ) const
virtual

Queries the id of the process group this process belongs to.

Exceptions
std::system_errorin case of errors.
Returns
The id of the process group this process belongs to.

Definition at line 64 of file process.cpp.

References pid().

+ Here is the call graph for this function:

The documentation for this class was generated from the following files: