lintel 0.2.0
Loading...
Searching...
No Matches
Classes | Public Member Functions | List of all members
lintel::ProcessInfoDto Class Reference

#include <ProcessInfoDto.h>

Inheritance diagram for lintel::ProcessInfoDto:
lintel::JsonSerializable

Public Member Functions

 ProcessInfoDto (const ProcessInfo &processInfo)
 
 ProcessInfoDto ()=default
 
const std::string & getId () const
 
const std::filesystem::path & getPath () const
 
const std::vector< std::string > & getArgs () const
 
bool isAutoRestart () const
 
int32_t getRestarts () const
 
int32_t getMaxAutoRestarts () const
 
lintel::ProcessId getProcessId () const
 
bool isRunning () const
 
int32_t getExitCode () const
 
bool isExitCodeValid () const
 
const std::string & getGroupName () const
 
const std::string & getGroupId () const
 
std::optional< int64_t > getUptimeSeconds () const
 
std::optional< double > getCpuPercent () const
 
std::optional< uint64_t > getMemoryBytes () const
 
bool isResourceDataValid () const
 
void serialize (rapidjson::Writer< rapidjson::StringBuffer > *writer) const override
 
bool deserialize (const rapidjson::Value &obj) override
 
- Public Member Functions inherited from lintel::JsonSerializable
 JsonSerializable ()=default
 
virtual ~JsonSerializable ()=default
 
virtual std::string serialize () const
 
virtual void deserialize (const std::string &json)
 

Detailed Description

DTO representing detailed process information

Constructor & Destructor Documentation

◆ ProcessInfoDto() [1/2]

lintel::ProcessInfoDto::ProcessInfoDto ( const ProcessInfo &  processInfo)
explicit

Construct from a ProcessInfo model

Parameters
processInfoThe source process info

◆ ProcessInfoDto() [2/2]

lintel::ProcessInfoDto::ProcessInfoDto ( )
default

Default constructor

Member Function Documentation

◆ deserialize()

bool lintel::ProcessInfoDto::deserialize ( const rapidjson::Value &  obj)
overridevirtual

Deserialize from JSON

Parameters
objThe JSON value
Returns
True on success

Reimplemented from lintel::JsonSerializable.

◆ getArgs()

const std::vector< std::string > & lintel::ProcessInfoDto::getArgs ( ) const

Get the command line arguments

Returns
Vector of argument strings

◆ getCpuPercent()

std::optional< double > lintel::ProcessInfoDto::getCpuPercent ( ) const

Get the CPU usage in percent (if a delta is available)

Returns
The CPU percent or nullopt

◆ getExitCode()

int32_t lintel::ProcessInfoDto::getExitCode ( ) const

Get the exit code

Returns
The exit code

◆ getGroupId()

const std::string & lintel::ProcessInfoDto::getGroupId ( ) const

Get the group ID

Returns
The group ID

◆ getGroupName()

const std::string & lintel::ProcessInfoDto::getGroupName ( ) const

Get the group name

Returns
The group name

◆ getId()

const std::string & lintel::ProcessInfoDto::getId ( ) const

Get the process ID

Returns
The ID

◆ getMaxAutoRestarts()

int32_t lintel::ProcessInfoDto::getMaxAutoRestarts ( ) const

Get the maximum allowed auto-restarts

Returns
The max restarts

◆ getMemoryBytes()

std::optional< uint64_t > lintel::ProcessInfoDto::getMemoryBytes ( ) const

Get the resident memory usage in bytes (if readable)

Returns
The memory bytes or nullopt

◆ getPath()

const std::filesystem::path & lintel::ProcessInfoDto::getPath ( ) const

Get the executable path

Returns
The filesystem path

◆ getProcessId()

lintel::ProcessId lintel::ProcessInfoDto::getProcessId ( ) const

Get the OS process ID

Returns
The process ID

◆ getRestarts()

int32_t lintel::ProcessInfoDto::getRestarts ( ) const

Get the current restart count

Returns
The number of restarts

◆ getUptimeSeconds()

std::optional< int64_t > lintel::ProcessInfoDto::getUptimeSeconds ( ) const

Get the process uptime in seconds (if readable)

Returns
The uptime or nullopt

◆ isAutoRestart()

bool lintel::ProcessInfoDto::isAutoRestart ( ) const

Check if auto-restart is enabled

Returns
True if auto-restart is enabled

◆ isExitCodeValid()

bool lintel::ProcessInfoDto::isExitCodeValid ( ) const

Check if the exit code is meaningful

Returns
True if the exit code is valid

◆ isResourceDataValid()

bool lintel::ProcessInfoDto::isResourceDataValid ( ) const

Check if resource data is valid

Returns
True if resource data could be read

◆ isRunning()

bool lintel::ProcessInfoDto::isRunning ( ) const

Check if the process is running

Returns
True if running

◆ serialize()

void lintel::ProcessInfoDto::serialize ( rapidjson::Writer< rapidjson::StringBuffer > *  writer) const
overridevirtual

Serialize to JSON

Parameters
writerThe rapidjson writer

Implements lintel::JsonSerializable.


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