process-cpp: core::posix::Process Class Reference

process-cpp 3.0.0 A simple convenience library for handling processes in C++11.

Classes | Public Member Functions | Static Public Member Functions | List of all members
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. More...
virtual | ~Process () noexcept
| Frees resources associated with the process. More...
virtual pid_t | pid () const
| Query the pid of the process. More...
virtual ProcessGroup | process_group_or_throw () const
| Queries the id of the process group this process belongs to. More...
virtual ProcessGroup | process_group (std::error_code &se) const noexcept(true)
| Queries the id of the process group this process belongs to. More...
Public Member Functions inherited from core::posix::Signalable
virtual void | send_signal_or_throw (Signal signal)
| Sends a signal to this signalable object. More...
virtual void | send_signal (Signal signal, std::error_code &e) noexcept(true)
| Sends a signal to this signalable object. More...

## Static Public Member Functions
static Process | invalid ()
| Returns an invalid instance for testing purposes. More...

## 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

  Throw | std::system_error if pid is invalid, i.e., pid < 0.

Parameters

  pid | The 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().

## ◆ pid()

pid_t core::posix::Process::pid | ( |  | ) | const
| virtual

Query the pid of the process.

Returns
  The pid of the process.

Definition at line 59 of file process.cpp.

Referenced by core::posix::linux::proc::process::operator<<(), core::posix::linux::proc::process::operator>>(), Process(), process_group_or_throw(), TEST(), and core::posix::ChildProcess::wait_for().

## ◆ 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().

## ◆ 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_error | in 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:

- /build/process-cpp/src/process-cpp-3.0.1/include/core/posix/process.h
- /build/process-cpp/src/process-cpp-3.0.1/src/core/posix/process.cpp