Retired Document
Important: This sample code may not represent best practices for current development. The project may use deprecated symbols and illustrate technologies and techniques that are no longer recommended.
Headers/Process.h
/* |
File: Process.h |
Contains: TProcess is a Process Manager class. |
Process.h contains the header file information for the TProcess class construction. |
Written by: Kent Sandvik |
Copyright: Copyright © 1992-1999 by Apple Computer, Inc., All Rights Reserved. |
You may incorporate this Apple sample source code into your program(s) without |
restriction. This Apple sample source code has been provided "AS IS" and the |
responsibility for its operation is yours. You are not permitted to redistribute |
this Apple sample source code as "Apple sample source code" after having made |
changes. If you're going to re-distribute the source, we require that you make |
it clear in the source that the code was descended from Apple sample source |
code, but that you've made changes. |
Change History (most recent first): |
8/18/1999 Karl Groethe Updated for Metrowerks Codewarror Pro 2.1 |
*/ |
// Declare label for this header file |
#ifndef _PROCESS_ |
#define _PROCESS_ |
#ifndef _DTSCPLUSLIBRARY_ |
#include "DTSCPlusLibrary.h" |
#endif |
// Toolbox Include Files |
#ifndef __PROCESSES__ |
#include <Processes.h> |
#endif |
#ifndef __APPLEEVENTS__ |
#include <AppleEvents.h> |
#endif |
#ifndef __OSUTILS__ |
#include <OSUtils.h> |
#endif |
// GLOBAL TYPEDEFS AND ENUMS |
const ProcessSerialNumber kMyProcess = { |
kNoProcess, kNoProcess}; |
// _________________________________________________________________________________________________________ // |
// Class Interface |
class TProcess |
// The TProcess class provides information from the Process Manager. |
{ |
public: |
// CONSTRUCTORS & DESTRUCTORS |
TProcess(ProcessSerialNumber = kMyProcess); // default constructors |
virtual~ TProcess(); // virtual destructor |
// MAIN INTERFACE |
virtual Boolean KillApplication(ProcessSerialNumber*);// quit the application |
virtual short GetNumProcesses(); // get the N amount of currently running procs |
virtual ProcessInfoRec GetProcessInfoRec(); // fetch the whole process info rec |
virtual unsigned long GetProcessSize(); // get the size of the process |
virtual unsigned long GetFreeMem(); // get free memory available for the process |
virtual unsigned long GetLaunchDate(); // get in seconds the launch time |
virtual Boolean FindProcess(OSType signature);// find process with the right signature |
// PUBLIC ACCESSORS AND MUTATORS |
virtual ProcessSerialNumber GetMyProcessID() const; |
virtual ProcessSerialNumber GetProcessID() const; |
// ITERATORS |
virtual void Next(); // next PSN |
virtual Boolean Last(); // last PSN? |
virtual void First(); // reset to first PSN |
// INITIATION ROUTINES |
protected: |
virtual Boolean IProcess(); // initialize needed class information |
// FIELDS |
private: |
ProcessSerialNumber fProcessID; // any specific PSN number |
ProcessSerialNumber fMyProcessID; // our PSN number |
ProcessSerialNumber fFirstPSN; // the first one we got |
Boolean fFirstTime; // signals order of iterators |
Boolean fLast; // used to signal last process in an iterator list |
Boolean fState; // state of the object |
OSErr fError; // latest toolbox error |
}; |
#endif |
// _________________________________________________________________________________________________________ // |
/* Change History (most recent last): |
No Init. Date Comment |
1 khs 6/10/92 New file |
2 khs 7/6/92 First decent working class |
*/ |
Copyright © 2003 Apple Computer, Inc. All Rights Reserved. Terms of Use | Privacy Policy | Updated: 2003-01-14