Cppcheck
Public Member Functions | Private Member Functions | Private Attributes | List of all members
ProcessExecutor Class Reference

This class will take a list of filenames and settings and check then all files using threads. More...

#include <processexecutor.h>

Inheritance diagram for ProcessExecutor:
Executor

Public Member Functions

 ProcessExecutor (const std::list< FileWithDetails > &files, const std::list< FileSettings > &fileSettings, const Settings &settings, SuppressionList &suppressions, ErrorLogger &errorLogger, CppCheck::ExecuteCmdFn executeCommand)
 
 ProcessExecutor (const ProcessExecutor &)=delete
 
ProcessExecutoroperator= (const ProcessExecutor &)=delete
 
unsigned int check () override
 
- Public Member Functions inherited from Executor
 Executor (const std::list< FileWithDetails > &files, const std::list< FileSettings > &fileSettings, const Settings &settings, SuppressionList &suppressions, ErrorLogger &errorLogger)
 
virtual ~Executor ()=default
 
 Executor (const Executor &)=delete
 
Executoroperator= (const Executor &)=delete
 
void reportStatus (std::size_t fileindex, std::size_t filecount, std::size_t sizedone, std::size_t sizetotal)
 Information about how many files have been checked. More...
 

Private Member Functions

bool handleRead (int rpipe, unsigned int &result, const std::string &filename)
 Read from the pipe, parse and handle what ever is in there. More...
 
bool checkLoadAverage (size_t nchildren)
 Check load average condition. More...
 
void reportInternalChildErr (const std::string &childname, const std::string &msg)
 Reports internal errors related to child processes. More...
 

Private Attributes

CppCheck::ExecuteCmdFn mExecuteCommand
 

Additional Inherited Members

- Protected Member Functions inherited from Executor
bool hasToLog (const ErrorMessage &msg)
 Check if message is being suppressed and unique. More...
 
- Protected Attributes inherited from Executor
const std::list< FileWithDetails > & mFiles
 
const std::list< FileSettings > & mFileSettings
 
const SettingsmSettings
 
SuppressionListmSuppressions
 
ErrorLoggermErrorLogger
 

Detailed Description

This class will take a list of filenames and settings and check then all files using threads.

Definition at line 43 of file processexecutor.h.

Constructor & Destructor Documentation

◆ ProcessExecutor() [1/2]

ProcessExecutor::ProcessExecutor ( const std::list< FileWithDetails > &  files,
const std::list< FileSettings > &  fileSettings,
const Settings settings,
SuppressionList suppressions,
ErrorLogger errorLogger,
CppCheck::ExecuteCmdFn  executeCommand 
)

Definition at line 66 of file processexecutor.cpp.

References Settings::jobs, and Executor::mSettings.

◆ ProcessExecutor() [2/2]

ProcessExecutor::ProcessExecutor ( const ProcessExecutor )
delete

Member Function Documentation

◆ check()

unsigned int ProcessExecutor::check ( )
overridevirtual

◆ checkLoadAverage()

bool ProcessExecutor::checkLoadAverage ( size_t  nchildren)
private

Check load average condition.

Parameters
nchildren- count of currently ran children
Returns
true - if new process can be started

Definition at line 209 of file processexecutor.cpp.

References Settings::loadAverage, and Executor::mSettings.

Referenced by check().

◆ handleRead()

bool ProcessExecutor::handleRead ( int  rpipe,
unsigned int &  result,
const std::string &  filename 
)
private

Read from the pipe, parse and handle what ever is in there.

Returns
False in case of an recoverable error - will exit process on others

Definition at line 129 of file processexecutor.cpp.

References ErrorMessage::deserialize(), InternalError::errorMessage, Executor::hasToLog(), Executor::mErrorLogger, ErrorLogger::reportErr(), and ErrorLogger::reportOut().

Referenced by check().

◆ operator=()

ProcessExecutor& ProcessExecutor::operator= ( const ProcessExecutor )
delete

◆ reportInternalChildErr()

void ProcessExecutor::reportInternalChildErr ( const std::string &  childname,
const std::string &  msg 
)
private

Reports internal errors related to child processes.

Parameters
msgThe error message

Definition at line 393 of file processexecutor.cpp.

References emptyString, error, SuppressionList::isSuppressed(), Executor::mErrorLogger, Executor::mSuppressions, normal, and ErrorLogger::reportErr().

Referenced by check().

Member Data Documentation

◆ mExecuteCommand

CppCheck::ExecuteCmdFn ProcessExecutor::mExecuteCommand
private

Definition at line 71 of file processexecutor.h.

Referenced by check().


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