home *** CD-ROM | disk | FTP | other *** search
/ Dream 57 / Amiga_Dream_57.iso / Amiga / Programmation / c / Extensions / APPSource.lha / APlusPlus / libsource / LvObject.cxx < prev    next >
Encoding:
C/C++ Source or Header  |  1994-08-29  |  1.3 KB  |  67 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/LvObject.cxx,v $
  9.  **   $Revision: 1.6 $
  10.  **   $Date: 1994/07/27 11:50:56 $
  11.  **   $Author: Armin_Vogt $
  12.  **
  13.  ******************************************************************************/
  14.  
  15. // Living Objects depend on the AMIPROC package by Doug Walker and Steve Krueger.
  16. // At the moment it is therefore impossible to compile with GNU-C++.
  17. #ifdef __SASC
  18.  
  19.  
  20. #ifdef __SASC
  21.  
  22. extern "C" {
  23. #ifdef __SASC
  24. #include <proto/exec.h>
  25. #endif
  26. }
  27.  
  28. #include <APlusPlus/exec/LvObject.h>
  29.  
  30. static const char rcs_id[] = "$Id: LvObject.cxx,v 1.6 1994/07/27 11:50:56 Armin_Vogt Exp Armin_Vogt $";
  31.  
  32. // runtime type inquiry support
  33. typeinfo(LivingObject, no_bases, rcs_id)
  34.  
  35.  
  36. LivingObject::LivingObject()
  37. {
  38.    ap_msg = NULL;
  39. }
  40.  
  41. BOOL LivingObject::activate()
  42. {
  43.    if (ap_msg) return TRUE;
  44.  
  45.    ap_msg = AmiProc_Start((int (*)(void*))func,(void*)this);
  46.    return (ap_msg!=NULL);
  47. }
  48.  
  49. LivingObject::~LivingObject()
  50. {
  51.    AmiProc_Wait(ap_msg);
  52. }
  53.  
  54. BOOL LivingObject::isLiving()
  55. {
  56.    return (ap_msg!=NULL);
  57. }
  58.  
  59. int LivingObject::func(void *thisPtr)
  60. {
  61.    return ((LivingObject*)thisPtr)->main();
  62. }
  63.  
  64. #endif   // #ifdef __SASC
  65.  
  66. #endif
  67.