class PProcess: public PThread

This class represents an operating system process.

Inheritance:


Public

[more] Construction
[more] Overrides from class PObject
[more] Overrides from class PThread
[more] Process information functions
[more] Operating System information functions


Inherited from PThread:

Public

Overrides from PObject

Control functions

Miscellaneous


Inherited from PObject:

Public

Run Time Type functions

Comparison functions

I/O functions

Miscellaneous functions


Documentation

This class represents an operating system process. This is a running "programme" in the context of the operating system. Note that there can only be one instance of a PProcess class in a given programme.

The instance of a PProcess or its GUI descendent PApplication is usually a static variable created by the application writer. This is the initial änchor" point for all data structures in an application. As the application writer never needs to access the standard system main() function, it is in the library, the programmes execution begins with the virtual function PThread::Main() on a process.

o Construction

o AlphaCode
Code is still very much under construction.

o BetaCode
Code is largely complete and is under test.

o ReleaseCode
Code has all known bugs removed and is shipping.

o Overrides from class PObject

oComparison Compare( const PObject & obj ) const
Compare two process instances. This should almost never be called as a programme only has access to a single process, its own.

Returns:
EqualTo if the two process object have the same name.
Parameters:
obj - Other process to compare against.

o Overrides from class PThread

ovirtual void Terminate()
Terminate the process. Usually only used in abnormal abort situation.

ovirtual PString GetThreadName() const
Get the name of the thread. Thread names are a optional debugging aid.

Returns:
current thread name.

ovirtual void SetThreadName( const PString & name )
Change the name of the thread. Thread names are a optional debugging aid.

Returns:
current thread name.
Parameters:
name - New name for the thread.

o Process information functions

ostatic PProcess& Current()
Get the current processes object instance. The current process is the one the application is running in.

Returns:
pointer to current process instance.

ostatic BOOL IsInitialised()
Determine if the current processes object instance has been initialised. If this returns TRUE it is safe to use the PProcess::Current() function.

Returns:
TRUE if process class has been initialised.

ovoid SetTerminationValue( int value )
Set the termination value for the process.

The termination value is an operating system dependent integer which indicates the processes termiantion value. It can be considered a "return value" for an entire programme.

Parameters:
value - Value to return a process termination status.

oint GetTerminationValue() const
Get the termination value for the process.

The termination value is an operating system dependent integer which indicates the processes termiantion value. It can be considered a "return value" for an entire programme.

Returns:
integer termination value.

oPArgList& GetArguments()
Get the programme arguments. Programme arguments are a set of strings provided to the programme in a platform dependent manner.

Returns:
argument handling class instance.

oconst PString& GetManufacturer() const
Get the name of the manufacturer of the software. This is used in the default Äbout" dialog box and for determining the location of the configuration information as used by the PConfig class.

The default for this information is the empty string.

Returns:
string for the manufacturer name eg "Equivalence".

oconst PString& GetName() const
Get the name of the process. This is used in the default Äbout" dialog box and for determining the location of the configuration information as used by the PConfig class.

The default is the title part of the executable image file.

Returns:
string for the process name eg "MyApp".

oPString GetVersion( BOOL full = TRUE ) const
Get the version of the software. This is used in the default Äbout" dialog box and for determining the location of the configuration information as used by the PConfig class.

If the full parameter is TRUE then a version string built from the major, minor, status and build veriosn codes is returned. If FALSE then only the major and minor versions are returned.

The default for this information is "1.0".

Returns:
string for the version eg "1.0b3".
Parameters:
full - TRUE for full version, FALSE for short version.

oconst PFilePath& GetFile() const
Get the processes executable image file path.

Returns:
file path for program.

oDWORD GetProcessID() const
Get the platform dependent process identifier for the process. This is an arbitrary (and unique) integer attached to a process by the operating system.

Returns:
Process ID for process.

oPString GetUserName() const
Get the effective user name of the owner of the process, eg "root" etc. This is a platform dependent string only provided by platforms that are multi-user. Note that some value may be returned as a "simulated" user. For example, in MS-DOS an environment variable

Returns:
user name of processes owner.

ovirtual PString GetConfigurationFile()
Get the default file to use in PConfig instances

ovoid SetConfigurationPath( const PString & path )
Set the default file or set of directories to search for use in PConfig. To find the .ini file for use in the default PConfig() instance, this explicit filename is used, or if it is a set of directories separated by either ':' or ';' characters, then the application base name postfixed with ".ini" is searched for through those directories.

The search is actually done when the GetConfigurationFile() is called, this function only sets the internal variable.

Note for Windows, a path beginning with "HKEY_LOCAL_MACHINE
" or "HKEY_CURRENT_USER
" will actually search teh system registry for the application base name only (no ".ini") in that folder of the registry.

Parameters:
path - Explicit file or set of directories

o Operating System information functions

ostatic PString GetOSClass()
Get the class of the operating system the process is running on, eg ünix".

Returns:
String for OS class.

ostatic PString GetOSName()
Get the name of the operating system the process is running on, eg "Linux".

Returns:
String for OS name.

ostatic PString GetOSHardware()
Get the hardware the process is running on, eg "sparc".

Returns:
String for OS name.

ostatic PString GetOSVersion()
Get the version of the operating system the process is running on, eg "2033".

Returns:
String for OS version.

ostatic PDirectory GetOSConfigDir()
Get the configuration directory of the operating system the process is running on, eg "/etc" for Unix, "c:\windows" for Win95 or "c:\winnt\system32\drivers\etc" for NT.

Returns:
Directory for OS configuration files.


Direct child classes:
PServiceProcess

Alphabetic index HTML hierarchy of classes or Java



This page was generated with the help of DOC++.