MythTV  master
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | List of all members
MythSystem Class Referenceabstract

class for managing sub-processes. More...

#include <mythsystem.h>

Inheritance diagram for MythSystem:
Inheritance graph
[legend]

Public Types

enum  Priority {
  kIdlePriority = 0, kLowestPriority, kLowPriority, kNormalPriority,
  kHighPriority, kHighestPriority, kTimeCriticalPriority, kInheritPriority
}
 Priorities that can be used for cpu and disk usage of child process. More...
 
typedef enum MythSystem::Priority Priority
 Priorities that can be used for cpu and disk usage of child process. More...
 

Public Member Functions

virtual ~MythSystem (void)=default
 
virtual uint GetFlags (void) const =0
 Returns the flags passed to the constructor. More...
 
virtual QString GetStartingPath (void) const =0
 Returns the starting path of the program. More...
 
virtual Priority GetCPUPriority (void) const =0
 Return the CPU Priority of the program. More...
 
virtual Priority GetDiskPriority (void) const =0
 Return the Disk Priority of the program. More...
 
virtual bool Wait (uint timeout_ms=0)=0
 Blocks until child process is collected or timeout reached. More...
 
virtual QIODevice * GetStandardInputStream (void)=0
 Returns the standard input stream for the program if the kMSStdIn flag was passed to the constructor. More...
 
virtual QIODevice * GetStandardOutputStream (void)=0
 Returns the standard output stream for the program if the kMSStdOut flag was passed to the constructor. More...
 
virtual QIODevice * GetStandardErrorStream (void)=0
 Returns the standard error stream for the program if the kMSStdErr flag was passed to the constructor. More...
 
virtual void Signal (MythSignal)=0
 Sends the selected signal to the program. More...
 
virtual int GetExitCode (void) const =0
 returns the exit code, if any, that the program returned. More...
 

Static Public Member Functions

static MythSystemCreate (const QStringList &args, uint flags=kMSNone, QString startPath=QString(), Priority cpuPriority=kInheritPriority, Priority diskPriority=kInheritPriority)
 
static MythSystemCreate (const QString &args, uint flags=kMSNone, QString startPath=QString(), Priority cpuPriority=kInheritPriority, Priority diskPriority=kInheritPriority)
 

Protected Member Functions

 MythSystem ()=default
 

Private Member Functions

 MythSystem (const MythSystem &)
 
MythSystemoperator= (const MythSystem &)
 

Detailed Description

class for managing sub-processes.

This is a hopefully simple interface for managing sub-processes.

The general usage is: { QScopedPointer sys(MythSystem::Create("touch /tmp/i.am.legend")); }

Definition at line 81 of file mythsystem.h.

Member Typedef Documentation

◆ Priority

Priorities that can be used for cpu and disk usage of child process.

Member Enumeration Documentation

◆ Priority

Priorities that can be used for cpu and disk usage of child process.

Enumerator
kIdlePriority 

run only when no one else wants to

kLowestPriority 
kLowPriority 
kNormalPriority 

run as a normal program

kHighPriority 
kHighestPriority 
kTimeCriticalPriority 
kInheritPriority 

Use parent priority.

Definition at line 85 of file mythsystem.h.

Constructor & Destructor Documentation

◆ ~MythSystem()

virtual MythSystem::~MythSystem ( void  )
virtualdefault

◆ MythSystem() [1/2]

MythSystem::MythSystem ( )
protecteddefault

◆ MythSystem() [2/2]

MythSystem::MythSystem ( const MythSystem )
private

Member Function Documentation

◆ Create() [1/2]

MythSystem * MythSystem::Create ( const QStringList &  args,
uint  flags = kMSNone,
QString  startPath = QString(),
Priority  cpuPriority = kInheritPriority,
Priority  diskPriority = kInheritPriority 
)
static

◆ Create() [2/2]

MythSystem * MythSystem::Create ( const QString &  args,
uint  flags = kMSNone,
QString  startPath = QString(),
Priority  cpuPriority = kInheritPriority,
Priority  diskPriority = kInheritPriority 
)
static

Definition at line 217 of file mythsystem.cpp.

◆ GetFlags()

virtual uint MythSystem::GetFlags ( void  ) const
pure virtual

Returns the flags passed to the constructor.

Implemented in MythSystemLegacyWrapper.

◆ GetStartingPath()

virtual QString MythSystem::GetStartingPath ( void  ) const
pure virtual

Returns the starting path of the program.

Implemented in MythSystemLegacyWrapper.

◆ GetCPUPriority()

virtual Priority MythSystem::GetCPUPriority ( void  ) const
pure virtual

Return the CPU Priority of the program.

Implemented in MythSystemLegacyWrapper.

◆ GetDiskPriority()

virtual Priority MythSystem::GetDiskPriority ( void  ) const
pure virtual

Return the Disk Priority of the program.

Implemented in MythSystemLegacyWrapper.

◆ Wait()

virtual bool MythSystem::Wait ( uint  timeout_ms = 0)
pure virtual

Blocks until child process is collected or timeout reached.

If the timeout is not provided or a timeout of 0 is provided this will block until the sub-program exits.

Returns
true if program has exited and has been collected.

Implemented in MythSystemLegacyWrapper.

◆ GetStandardInputStream()

virtual QIODevice* MythSystem::GetStandardInputStream ( void  )
pure virtual

Returns the standard input stream for the program if the kMSStdIn flag was passed to the constructor.

Note: The stream this returns is already open.

Implemented in MythSystemLegacyWrapper.

◆ GetStandardOutputStream()

virtual QIODevice* MythSystem::GetStandardOutputStream ( void  )
pure virtual

Returns the standard output stream for the program if the kMSStdOut flag was passed to the constructor.

Note: The stream this returns is already open.

Implemented in MythSystemLegacyWrapper.

◆ GetStandardErrorStream()

virtual QIODevice* MythSystem::GetStandardErrorStream ( void  )
pure virtual

Returns the standard error stream for the program if the kMSStdErr flag was passed to the constructor.

Note: The stream this returns is already open.

Implemented in MythSystemLegacyWrapper.

◆ Signal()

virtual void MythSystem::Signal ( MythSignal  )
pure virtual

Sends the selected signal to the program.

Implemented in MythSystemLegacyWrapper.

◆ GetExitCode()

virtual int MythSystem::GetExitCode ( void  ) const
pure virtual

returns the exit code, if any, that the program returned.

Returns -1 if the program exited without exit code. Returns -2 if the program has not yet been collected. Returns an exit code 0..255 if the program exited with exit code.

Implemented in MythSystemLegacyWrapper.

◆ operator=()

MythSystem& MythSystem::operator= ( const MythSystem )
private

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