home *** CD-ROM | disk | FTP | other *** search
/ Dream 57 / Amiga_Dream_57.iso / Amiga / Programmation / c / Extensions / APPSource.lha / APlusPlus / libsource / IntuiRoot.cxx < prev    next >
Encoding:
C/C++ Source or Header  |  1994-08-29  |  2.4 KB  |  96 lines

  1. /******************************************************************************
  2.  **
  3.  **   C++ Class Library for the Amiga⌐ system software.
  4.  **
  5.  **   Copyright (C) 1994 by Armin Vogt  **  EMail: armin@uni-paderborn.de
  6.  **   All Rights Reserved.
  7.  **
  8.  **   $Source: apphome:RCS/libsource/IntuiRoot.cxx,v $
  9.  **   $Revision: 1.1 $
  10.  **   $Date: 1994/07/27 11:49:28 $
  11.  **   $Author: Armin_Vogt $
  12.  **
  13.  ******************************************************************************/
  14.  
  15.  
  16. #include <APlusPlus/intuition/IntuiRoot.h>
  17.  
  18.  
  19. static const char rcs_id[] = "$Id: IntuiRoot.cxx,v 1.1 1994/07/27 11:49:28 Armin_Vogt Exp Armin_Vogt $";
  20.  
  21.  
  22. /*------------------------- IntuiRoot methods --------------------------------*/
  23.  
  24. // initialise global static variable
  25. IntuiRoot* IntuiRoot::APPIntuiRoot = NULL;
  26.  
  27. // runtime type inquiry support
  28. intui_typeinfo(IntuiRoot, derived(from(ScreenC)), rcs_id)
  29.  
  30.  
  31. IntuiRoot::IntuiRoot() : ScreenC(NULL,(UBYTE*)NULL)
  32. {
  33.    iob_count = 0;
  34.    _dprintf("IntuiRoot initialised.\n");
  35. }
  36.  
  37. IntuiRoot::~IntuiRoot()
  38. {
  39.    _dprintf("IntuiRoot::~IntuiRoot()\n");
  40.  
  41.    FOREACHSAFE(IntuiObject,this)
  42.    {
  43.       _dprintf("kill status=%ld at %lx\n ",node->status(),(APTR)node);
  44.       delete node;
  45.       _dprintf("\tkilled.\n");
  46.    }
  47.    NEXTSAFE
  48.    _dprintf("IntuiRoot::~IntuiRoot() done.\n");
  49.  
  50.    /** This may prevent executing setAttributes() on a deleted object.
  51.     ** But its the sendNotification() routine duty to check for the integrity of each
  52.     ** addressed IntuiObject before calling setAttributes on it.
  53.     ** Otherwise this may become a source of random enforcer hits when the deleted
  54.     ** object's memory  may already have been overwritten or not!
  55.     **/
  56.    setAttributesIsRecurrent = TRUE;
  57. }
  58.  
  59. BOOL IntuiRoot::APPinitialise(int argc, char* argv[])
  60.    /* MUST be called before creating any A++ IntuiObject classes.
  61.    */
  62. {
  63.    APPIntuiRoot = new IntuiRoot;
  64.    if (APPOK(APPIntuiRoot))
  65.    {
  66.       _dprintf("IntuiRoot initialised.\n");
  67.       return TRUE;
  68.    }
  69.    else return FALSE;
  70. }
  71.  
  72. void IntuiRoot::APPexit()
  73. {
  74.    if (APPIntuiRoot)
  75.    {
  76.       delete APPIntuiRoot;
  77.       APPIntuiRoot = NULL;
  78.    }
  79. }
  80.  
  81.  
  82.  
  83. int main(int argc,char *argv[])
  84. {
  85.    if (IntuiRoot::APPinitialise(argc,argv))
  86.    {
  87.       APPmain(argc,argv);     // user main
  88.       IntuiRoot::APPexit();   // destroy all IntuiObjects
  89.       return 0;
  90.    }
  91.    else
  92.    {
  93.       puterr("FATAL ERROR: could not create IntuiRoot! Programm exits.\n");
  94.       return 1;
  95.    }
  96. }