home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / CLASS.ZIP / OBJECT.H < prev    next >
Text File  |  1993-01-31  |  2KB  |  67 lines

  1. #ifndef OBJECT_H
  2. #define OBJECT_H
  3. #ifndef DEBUG
  4. #define NDEBUG
  5. #endif /* !DEBUG */
  6. #include <assert.h>
  7. #include <stdio.h>
  8. #include <stdlib.h>
  9.  
  10.  
  11. #define INCL_DOSSEMAPHORES
  12. #include <os2.h>
  13.  
  14.  
  15. typedef unsigned int Boolean;
  16.  
  17.  
  18. #ifdef DEBUG
  19. #define printFileLine() fprintf(stderr, "%s:%u\n", __FILE__, __LINE__)
  20. #else
  21. #define printFileLine() (void)1
  22. #endif
  23.  
  24. class object
  25. {    public:
  26.         Boolean bSuccessfullConstructed;
  27.         HMTX hMtxAccess;
  28. /*
  29.         inline int objectSuccessfullConstructed(void)
  30.         {       return successfullConstructed;
  31.         };
  32.         inline int setObjectUnsuccessfullConstructed(void)
  33.         {       successfullConstructed = 0;
  34.         };
  35. */
  36.         /*inline void constructionFailed(void); */
  37.     object(void);
  38.     virtual ~object(void);
  39.         void *operator new(unsigned int iSize);
  40.         void operator delete(void *pObject);
  41.         inline Boolean getExclusivAccess(void)
  42.         {      return !DosRequestMutexSem(hMtxAccess, (unsigned int)SEM_INDEFINITE_WAIT);
  43.         }
  44.         inline void freeExclusivAccess(void)
  45.         {       DosReleaseMutexSem(hMtxAccess);
  46.         }
  47.         
  48. };
  49.  
  50.  
  51. class construct:virtual public object
  52. {       public:
  53.         virtual void run(void);
  54.         virtual void doSomething(void);
  55.         virtual Boolean init(void);
  56.         virtual Boolean initPre(void);
  57.         virtual Boolean create(void);
  58.         virtual Boolean initPost(void);
  59.         virtual void destructPost(void);
  60.         virtual void destructPre(void);
  61.         virtual void destruct(void);
  62.        virtual void destructAll(void);
  63. };
  64.  
  65.  
  66. #endif /* !OBJECT_H */
  67.