Sources/TestTool.cp

/* _________________________________________________________________________________________________________ //
  Copyright © 1992 Apple Computer, Inc. All rights reserved.
  Macintosh Developer Technical Support.C++ Macintosh Toolbox Framework.
  Date: Wednesday, August 10, 1992 22:37:30
  Revision comments are at the end of this file.
  ---
  TProcess is a Process Manager class.
  TestTool.cp contains the class body information for testing the TProcess class.
  _________________________________________________________________________________________________________ */
 
 
#include "Process.h"
 
#ifndef __LIBRARYMANAGERUTILITIES__
#include <LibraryManagerUtilities.h>
#endif
 
#include <iostream.h>
 
 
main()
{
    // Prologue.
    InitLibraryManager();                       // Initialize the SLM
 
    TLibraryManager * testMgr = GetLocalLibraryManager();// Get pointer to the TLibraryManager
 
    if (testMgr == NULL)
    {
        cout << "Couldn't get a TLibraryManager\n" << endl;
        return 1;
    }
 
    testMgr->TraceLogOn();                      // turn on the trace
 
    // Test phase.
    cout << "Start TProcess testing!\n" << endl;
 
    // Get our TProcess object from SLM.
    TProcess * myProcess = (TProcess *)testMgr->NewObject(kTProcessID);
    if (!myProcess)
        cout << "Could not create new object!!!\n" << endl;
 
 
    myProcess->Initialize();                    // initialize with current Process
    cout << "First test, the current process\n" << endl;
    cout << "We have just now " << myProcess->GetNumProcesses() << " processes running." << endl;
    cout << "This process has " << myProcess->GetFreeMem() << " memory free." << endl;
 
 
    cout << "Final test, try to find a process with signature 'MACS' (Finder) " << endl;
    TProcess * findProc = new TProcess;
    if (findProc->FindProcess('MACS'))
        cout << " Finder Process found!" << endl;
 
    // Epilogue.
    CleanupLibraryManager();
    return 0;
}
 
 
// _________________________________________________________________________________________________________ //
 
/*  Change History (most recent last):
  No        Init.   Date        Comment
  1         khs     8/10/92     New file, SLM support
*/