PixelLightAPI  .
Protected Member Functions
PLCore::SystemImpl Class Reference

Abstract base class for platform specific 'System' implementations. More...

#include <SystemImpl.h>

List of all members.

Protected Member Functions

 SystemImpl ()
 Constructor.
virtual ~SystemImpl ()
 Destructor.
virtual String GetPlatform () const =0
 Returns the name of the platform.
virtual String GetOS () const =0
 Returns the name and version of the operating system.
virtual char GetSeparator () const =0
 Returns the directory separator used by the operation system.
virtual String GetSharedLibraryPrefix () const =0
 Returns the shared library filename prefix used by the operation system.
virtual String GetSharedLibraryExtension () const =0
 Returns the shared library file extension used by the operation system.
virtual uint32 GetCPUMhz () const =0
 Get the CPU MHz.
virtual String GetComputerName () const =0
 Returns the name of the computer.
virtual String GetUserName () const =0
 Returns the current user name.
virtual String GetUserHomeDir () const =0
 Get home directory of the current user.
virtual String GetUserDataDir () const =0
 Get data directory of the current user.
virtual String GetDataDirName (const String &sName) const =0
 Get name of data directory for given application name.
virtual String GetExecutableFilename () const =0
 Get absolute path of application executable.
virtual String GetEnvironmentVariable (const String &sName) const =0
 Reads an environment variable.
virtual bool SetEnvironmentVariable (const String &sName, const String &sValue) const =0
 Writes an environment variable.
virtual void DeleteEnvironmentVariable (const String &sName) const =0
 Deletes an environment variable.
virtual bool Execute (const String &sCommand, const String &sParameters, const String &sWorkingDir) const =0
 Executes a system command (create a new process)
virtual String GetLocaleLanguage () const =0
 Returns the current program locale language information.
virtual String GetCurrentDir () const =0
 Returns the current directory.
virtual bool SetCurrentDir (const String &sPath)=0
 Sets the current directory.
virtual ThreadGetCurrentThread () const =0
 Returns a pointer to the current thread.
virtual void Exit (int nReturn)=0
 Exit the application immediately.
virtual const ConsoleGetConsole () const =0
 Returns the console instance.
virtual void UrgentMessage (const String &sMessage) const =0
 Primitive way (e.g. by using a message box) to be able to tell the user that something went terrible wrong.
virtual Time GetTime () const =0
 Returns the current date and time.
virtual uint64 GetMilliseconds () const =0
 Returns the number of milliseconds since the system was started.
virtual uint64 GetMicroseconds () const =0
 Retrieves the number of microseconds since the system was started.
virtual void Sleep (uint64 nMilliseconds) const =0
 Suspend the current thread for a specified time period.
virtual void Yield () const =0
 Yields the rest of the current threads time slice.
virtual float GetPercentageOfUsedPhysicalMemory () const =0
 Returns an approximation of the percentage of used physical memory (0.0-100.0)
virtual uint64 GetTotalPhysicalMemory () const =0
 Returns the total physical memory in bytes.
virtual uint64 GetFreePhysicalMemory () const =0
 Returns the current free physical memory in bytes.
virtual uint64 GetTotalVirtualMemory () const =0
 Returns the total virtual memory in bytes.
virtual uint64 GetFreeVirtualMemory () const =0
 Returns the current free virtual memory in bytes.

Detailed Description

Abstract base class for platform specific 'System' implementations.

Note:
  • Implementation of the bridge design pattern, this class is the implementor of the 'System' abstraction

Constructor & Destructor Documentation

virtual PLCore::SystemImpl::~SystemImpl ( ) [protected, virtual]

Destructor.


Member Function Documentation

virtual String PLCore::SystemImpl::GetPlatform ( ) const [protected, pure virtual]

Returns the name of the platform.

Returns:
Platform string (for instance 'Windows' for Windows, 'Linux' for Linux and so on)
virtual String PLCore::SystemImpl::GetOS ( ) const [protected, pure virtual]

Returns the name and version of the operating system.

Returns:
OS information string (for instance 'Windows 7 Service Pack 1 (Build 7601)')
virtual char PLCore::SystemImpl::GetSeparator ( ) const [protected, pure virtual]

Returns the directory separator used by the operation system.

Returns:
The directory separator used by the operation system (e.g. '/' on Linux, '\' on Windows)
virtual String PLCore::SystemImpl::GetSharedLibraryPrefix ( ) const [protected, pure virtual]

Returns the shared library filename prefix used by the operation system.

Returns:
The shared library filename prefix used by the operation system (e.g. 'lib' as in 'libPLCore.so' on Linux, no prefix as in 'PLCore.dll' on Windows)
virtual String PLCore::SystemImpl::GetSharedLibraryExtension ( ) const [protected, pure virtual]

Returns the shared library file extension used by the operation system.

Returns:
The shared library file extension used by the operation system (e.g. 'so' on Linux, 'dll' on Windows)
virtual uint32 PLCore::SystemImpl::GetCPUMhz ( ) const [protected, pure virtual]

Get the CPU MHz.

Returns:
CPU MHz
virtual String PLCore::SystemImpl::GetComputerName ( ) const [protected, pure virtual]

Returns the name of the computer.

Returns:
Computer name
virtual String PLCore::SystemImpl::GetUserName ( ) const [protected, pure virtual]

Returns the current user name.

Returns:
User name
virtual String PLCore::SystemImpl::GetUserHomeDir ( ) const [protected, pure virtual]

Get home directory of the current user.

Returns:
The home directory of the current user (native path style)
virtual String PLCore::SystemImpl::GetUserDataDir ( ) const [protected, pure virtual]

Get data directory of the current user.

Returns:
The data directory of the current user (native path style)
virtual String PLCore::SystemImpl::GetDataDirName ( const String sName) const [protected, pure virtual]

Get name of data directory for given application name.

Parameters:
[in]sNameApplication name
Returns:
Name of data directory in native style of used OS
virtual String PLCore::SystemImpl::GetExecutableFilename ( ) const [protected, pure virtual]

Get absolute path of application executable.

Returns:
Path to executable (native path style, e.g. on Windows: 'C:.exe')
virtual String PLCore::SystemImpl::GetEnvironmentVariable ( const String sName) const [protected, pure virtual]

Reads an environment variable.

Parameters:
[in]sNameName of the environment variable to read
Returns:
Content of the variable
virtual bool PLCore::SystemImpl::SetEnvironmentVariable ( const String sName,
const String sValue 
) const [protected, pure virtual]

Writes an environment variable.

Parameters:
[in]sNameName of the environment variable to write
[in]sValueValue to write into the variable
Returns:
'true' if the variable has been set successfully, else 'false'
virtual void PLCore::SystemImpl::DeleteEnvironmentVariable ( const String sName) const [protected, pure virtual]

Deletes an environment variable.

Parameters:
[in]sNameName of the environment variable to delete
virtual bool PLCore::SystemImpl::Execute ( const String sCommand,
const String sParameters,
const String sWorkingDir 
) const [protected, pure virtual]

Executes a system command (create a new process)

Parameters:
[in]sCommandCommand to execute
[in]sParametersParameters to pass to the command
[in]sWorkingDirWorking directory in which to execute the command
Returns:
'true' if the command has been executed successfully, else 'false'
virtual String PLCore::SystemImpl::GetLocaleLanguage ( ) const [protected, pure virtual]

Returns the current program locale language information.

Returns:
The current program locale language information
virtual String PLCore::SystemImpl::GetCurrentDir ( ) const [protected, pure virtual]

Returns the current directory.

Returns:
Path to the current directory as the OS provided it (native path style)
Note:
  • On Windows for example "C:\Programs\App"
virtual bool PLCore::SystemImpl::SetCurrentDir ( const String sPath) [protected, pure virtual]

Sets the current directory.

Parameters:
[in]sPathPath to the current directory
Returns:
'true', if all went fine, else 'false'
virtual Thread* PLCore::SystemImpl::GetCurrentThread ( ) const [protected, pure virtual]

Returns a pointer to the current thread.

Returns:
Current thread, a null pointer on main thread or error
virtual void PLCore::SystemImpl::Exit ( int  nReturn) [protected, pure virtual]

Exit the application immediately.

Parameters:
[in]nReturnReturn value
virtual const Console& PLCore::SystemImpl::GetConsole ( ) const [protected, pure virtual]

Returns the console instance.

Returns:
The console instance
virtual void PLCore::SystemImpl::UrgentMessage ( const String sMessage) const [protected, pure virtual]

Primitive way (e.g. by using a message box) to be able to tell the user that something went terrible wrong.

Parameters:
[in]sMessageMessage to show
Remarks:
Do not misuse this method in order to communicate with the user on a regular basis. This method does only exist to be able to tell the user that something went terrible wrong. There are situations were one can't use a log file, command line or something like this. Even when using e.g. a log file to write out error information - an application may e.g. just close directly after it's start without any further information and the user may even think that the application didn't start in the first place for an unknown reason. In such a situation, it's polite to inform the user that something went terrible wrong and providing a short hint how the issue may be solved. This method wasn't named "MessageBox()" by intend - because such a feature may not be available on the used platform or is handled in another way as a normal MS Windows message box.
virtual Time PLCore::SystemImpl::GetTime ( ) const [protected, pure virtual]

Returns the current date and time.

Returns:
Date and time string
virtual uint64 PLCore::SystemImpl::GetMilliseconds ( ) const [protected, pure virtual]

Returns the number of milliseconds since the system was started.

Returns:
Number of milliseconds elapsed since the system was started
virtual uint64 PLCore::SystemImpl::GetMicroseconds ( ) const [protected, pure virtual]

Retrieves the number of microseconds since the system was started.

Returns:
Number of microseconds elapsed since the system was started
virtual void PLCore::SystemImpl::Sleep ( uint64  nMilliseconds) const [protected, pure virtual]

Suspend the current thread for a specified time period.

Parameters:
[in]nMillisecondsNumber of milliseconds to sleep
virtual void PLCore::SystemImpl::Yield ( ) const [protected, pure virtual]

Yields the rest of the current threads time slice.

virtual float PLCore::SystemImpl::GetPercentageOfUsedPhysicalMemory ( ) const [protected, pure virtual]

Returns an approximation of the percentage of used physical memory (0.0-100.0)

Returns:
An approximation of the percentage of used physical memory
virtual uint64 PLCore::SystemImpl::GetTotalPhysicalMemory ( ) const [protected, pure virtual]

Returns the total physical memory in bytes.

Returns:
The total physical memory in bytes
virtual uint64 PLCore::SystemImpl::GetFreePhysicalMemory ( ) const [protected, pure virtual]

Returns the current free physical memory in bytes.

Returns:
The current free physical memory in bytes
virtual uint64 PLCore::SystemImpl::GetTotalVirtualMemory ( ) const [protected, pure virtual]

Returns the total virtual memory in bytes.

Returns:
The total virtual memory in bytes
virtual uint64 PLCore::SystemImpl::GetFreeVirtualMemory ( ) const [protected, pure virtual]

Returns the current free virtual memory in bytes.

Returns:
The current free virtual memory in bytes

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


PixelLight PixelLight 0.9.10-R1
Copyright (C) 2002-2011 by The PixelLight Team
Last modified Fri Dec 23 2011 15:51:16
The content of this PixelLight document is published under the
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported