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.
Sources/Process.h
/* _________________________________________________________________________________________________________ // |
Copyright © 1992 Apple Computer, Inc. All rights reserved. |
Macintosh Developer Technical Support.C++ Macintosh Toolbox Framework. |
Date: Wednesday, June 10, 1992 22:37:24 |
Revision comments are at the end of this file. |
--- |
TProcess is a Process Manager class. |
Process.h contains the header file information for the TProcess class construction. |
_________________________________________________________________________________________________________ */ |
// Declare label for this header file |
#ifndef _PROCESS_ |
#define _PROCESS_ |
// Toolbox Include Files |
#ifndef __TYPES__ |
#include <Types.h> |
#endif |
#ifndef __PROCESSES__ |
#include <Processes.h> |
#endif |
#ifndef __APPLEEVENTS__ |
#include <AppleEvents.h> |
#endif |
#ifndef __OSUTILS__ |
#include <OSUtils.h> |
#endif |
// Global structures |
ProcessSerialNumber gNullPSN = { |
kNoProcess, kNoProcess}; |
// SLM definitions |
#define kTProcessID "slm:dtsl$TProcess" |
#ifndef __LIBRARYMANAGERCLASSES__ |
#include <LibraryManagerClasses.h> |
#endif |
// _________________________________________________________________________________________________________ // |
// Class Interface |
class TProcess : public TDynamic |
{ |
// The TProcess classÉ |
public: |
// CONSTRUCTORS & DESTRUCTORS |
TProcess(); // default constructors |
virtual~ TProcess(); // virtual destructor |
// MAIN INTERFACES |
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 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 |
protected: |
// INITIATION ROUTINES |
virtual Boolean IProcess(); // initialize needed class information |
public: |
virtual void Initialize(ProcessSerialNumber = gNullPSN);// default constructors |
private: |
// FIELDS |
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; |
Boolean fState; // state of the object |
}; |
#endif _PROCESS_ |
// _________________________________________________________________________________________________________ // |
/* 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